<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:Wingdings;
panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Menlo;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
mso-margin-top-alt:auto;
margin-right:0cm;
mso-margin-bottom-alt:auto;
margin-left:0cm;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.p1, li.p1, div.p1
{mso-style-name:p1;
margin:0cm;
margin-bottom:.0001pt;
font-size:8.5pt;
font-family:"Menlo",serif;}
span.EmailStyle19
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;}
span.s1
{mso-style-name:s1;}
span.apple-converted-space
{mso-style-name:apple-converted-space;}
span.EmailStyle24
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
/* List Definitions */
@list l0
{mso-list-id:1494838851;
mso-list-template-ids:-1706771034;}
@list l0:level1
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:36.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Symbol;}
@list l0:level2
{mso-level-number-format:bullet;
mso-level-text:o;
mso-level-tab-stop:72.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:"Courier New";
mso-bidi-font-family:"Times New Roman";}
@list l0:level3
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:108.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level4
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:144.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level5
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:180.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level6
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:216.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level7
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:252.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level8
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:288.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
@list l0:level9
{mso-level-number-format:bullet;
mso-level-text:;
mso-level-tab-stop:324.0pt;
mso-level-number-position:left;
text-indent:-18.0pt;
mso-ansi-font-size:10.0pt;
font-family:Wingdings;}
ol
{margin-bottom:0cm;}
ul
{margin-bottom:0cm;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-NZ link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Hi Xavier<o:p></o:p></p><p class=MsoNormal>I ran your example, just to check that it compiles as provided, and it does. I have not tried to unpick it – no time at present.<o:p></o:p></p><p class=MsoNormal>I think you have exhausted my metapost knowledge already, and come to the same road blocks and questions that I have previously experienced (converting variable types, doing maths with them, and parsing them from procedure to procedure (from file to file).<o:p></o:p></p><p class=MsoNormal>:)<o:p></o:p></p><p class=MsoNormal>Bruce<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Therion <therion-bounces@speleo.sk> <b>On Behalf Of </b>Xavier Robert via Therion<br><b>Sent:</b> Tuesday, 26 February 2019 10:16<br><b>Subject:</b> Re: [Therion] Depth in the header<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>Hi Bruce !<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>Thanks a lot for your answer, it has given me some ideas (I try to be synthetic and hopefully understandable, but I am really far to be a Tex guru, I may misunderstand this language) :<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>If I manually define a reference altitude that is the altitude of the main entrance, this is easy to calcul the depth for the header:<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>+[Max. altitude of the cave - ref. altitude] / <span style='background:white'>[Min. altitude of the cave - ref. altitude]. </span><o:p></o:p></span></p><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>I thus tried to do that by combining a thconfig (where I should define the altitude reference) and a config.thc (where I should define the layouts and Tex codes to perform all the calculs and tweek the header) files to port the coding to multiple thconfig's files (see attachements, I tried to comment all my changes and my problems):<o:p></o:p></span></p></div><ul type=disc><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level1 lfo1'><span style='font-size:12.0pt;font-family:"Arial",sans-serif'>In the config.thc, I wrote 3 layouts<o:p></o:p></span></li></ul><ul type=disc><ul type=circle><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level2 lfo1'><span style='font-size:12.0pt;font-family:"Arial",sans-serif'>a layout langue-en that define some variables in english (Presently, I also have the same in french and spanish). This is where I also define all the new tokens I eventually use in my layouts (clubs, synthesys, webpage,...). This is working very well.<o:p></o:p></span></li><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level2 lfo1'><span style='font-size:12.0pt;font-family:"Arial",sans-serif'>a layout headerl where I define all what I want to write in my header. I used the models from the Therion Wiki, and arrange it a bit to my desires... I specially wrote a section to modify the depth (between TEST / END TEST). This part seems OK, depending on the type of variables used (see further).<o:p></o:p></span></li><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level2 lfo1'><span style='font-size:12.0pt;font-family:"Arial",sans-serif'>a layout Testdepth : this is the layout where I calcul the altitude differences above and under the entrance inside a code tex-map - endcode block. Here, I have a problem: If I do this calcul by using directly numbers (i.e. I need to give the values as numbers [e.g. \edef\cavemaxzc{1008}], and not as variable<span style='background:white'>[e.g. \edef\cavemaxzc{\the\cavemaxz}]</span>), it is OK. If I try to use counters or token, I receive an error. The problem is that if I want to be able to use this code for a lot of caves, I need to be able to give the value of the tokens \cavemaxz and \caveminz. (I tried with \the\cavemaxz or \number\cavemaxz, and that does not work).<o:p></o:p></span></li></ul></ul><ul type=disc><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level1 lfo1'><span style='font-size:12.0pt;font-family:"Arial",sans-serif'>In the thconfig, I made 3 changes to change the depth in the header:<o:p></o:p></span></li></ul><ul type=disc><ul type=circle><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level2 lfo1'><span style='font-size:12.0pt;font-family:"Arial",sans-serif'>I manually define the variable \altref that correspond to the altitude of the entrance. If I declare the variable as a token (\newtoks) or a counter (\nexcount), I get an error: ! Missing number, treated as zero.<span class=s1><to be read again></span><span class=apple-converted-space> </span><span class=s1>{l.765 \newcount\altref \altref{1000}. I need to define it as \edef\altref{1000}. If this variable is empty, I also have an error, probably because this variable is not passed to the layouts in config.thc</span><o:p></o:p></span></li><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level2 lfo1'><span style='font-size:12.0pt;font-family:"Arial",sans-serif'>I call the layout Testdepth from the config.thc. In that case, I have the error: ! Missing number, treated as zero<to be read again> \relax l.755 ...hc = \numexpr \cavemaxzc - \altref \relax. It seems that the variable \altref that I defined is not passed to the Tex code in the layout Tesdepth. I fear that is because this new defined variable is not a token. May I true ?<o:p></o:p></span></li></ul></ul><div><ul type=disc><ul type=circle><li class=MsoNormal style='color:black;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;mso-list:l0 level2 lfo1'><span style='font-size:12.0pt;font-family:"Arial",sans-serif'>If I copy the <span style='background:white'>layout Testdepth from the config.thc and paste it inside the layout my_layout from the thconfig (while I comment the line copy Testdepth), it does work, if the \cavemaxz and \caveminz are defined as numbers and not as token or counters. If this variable is empty, I also have an error, probably because this variable is not passed to the layouts in config.thc. (On the contrary, the new counters \maxdepthc and \mindepthc are passed !)</span><o:p></o:p></span></li></ul></ul></div></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>If I good understood, in Tex, a token is not a number, and thus we cannot directly make any calculs with it. We need to translate it to a number.<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>Moreover, it seems that if we want to pass variables between layouts that are stored in different files (i.e. here config.thc and thconfig), the variable needs to be defined everywhere as tokens (or counters ?).<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>So I suppose that I need to find a way to translate a token or a counter into a number. Does anyone know how to do that?<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>Sorry for this long email,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>Cheers,<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>Xavier<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p></div><div class=MsoNormal align=center style='text-align:center'><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><hr size=2 width="100%" align=center id=zwchr></span></div><div><p class=MsoNormal><b><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>De: </span></b><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'>"List for Therion users" <<a href="mailto:therion@speleo.sk">therion@speleo.sk</a>><br><b>Envoyé: </b>Jeudi 21 Février 2019 14:33:34<br><b>Objet: </b>Re: [Therion] Depth in the header<o:p></o:p></span></p></div><div><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p></div><div><p class=MsoNormal><span style='color:black'>Kia Ora Xavier<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'>I don’t have a proper answer for you. It would seem to me that this is too complicated to become a built in feature. As you suggest, for an export of one cave the problem might be easier to solve, but where many caves are exported it might be difficult to conceive an automated approach.<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:black'>Maybe an easier thing to code would be something where the user could just choose a reference altitude to use as a notional zero altitude for your user defined metapost? <o:p></o:p></span></p><p class=MsoNormal><span style='color:black'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:black'>Personally I do not care much for the height relative to entrances, and I have modified the header to report height like this.<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'><img border=0 width=493 height=27 style='width:5.1354in;height:.2812in' id="Picture_x0020_1" src="cid:image001.png@01D4CE08.9791C500"><o:p></o:p></span></p><p class=MsoNormal><span style='color:black'>Together with gridlines and altitude points throughout the map, the user of the map can do their own maths!<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:black'>Regarding ‘caves’ and ‘main entrances’, I explored some ideas in the wiki <a href="https://therion.speleo.sk/wiki/faq?s%5b%5d=entrance#how_do_i_specify_a_main_entrance_and_also_the_other_entrances" target="_blank">here</a> <o:p></o:p></span></p><p class=MsoNormal><span style='color:black'> <o:p></o:p></span></p><p class=MsoNormal><span style='color:black'>Regards<o:p></o:p></span></p><p class=MsoNormal><span style='color:black'>Bruce<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:12.0pt;font-family:"Arial",sans-serif;color:black'><o:p> </o:p></span></p></div></div></div></body></html>