Hi Bruce ! 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) :
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:
+[Max. altitude of the cave - ref. altitude] / [Min. altitude of the cave -
ref. altitude].
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):
* In the config.thc, I wrote 3 layouts
* 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.
* 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).
* 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 [e.g. \edef\cavemaxzc{\the\cavemaxz}] ), 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).
* In the thconfig, I made 3 changes to change the depth in the header:
* 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. <to be
read again> { 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
* 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 ?
* If I copy the 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 !)
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.
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 ?).
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?
Sorry for this long email,
Cheers,
Xavier
De: "List for Therion users" <[email protected]>
À: "List for Therion users" <[email protected]>
Cc: "Bruce Mutton" <[email protected]>
Envoyé: Jeudi 21 Février 2019 14:33:34
Objet: Re: [Therion] Depth in the header
Kia Ora Xavier
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.
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?
Personally I do not care much for the height relative to entrances, and I have
modified the header to report height like this.
Together with gridlines and altitude points throughout the map, the user of the
map can do their own maths!
Regarding ‘caves’ and ‘main entrances’, I explored some ideas in the wiki [
https://therion.speleo.sk/wiki/faq?s%5b%5d=entrance#how_do_i_specify_a_main_entrance_and_also_the_other_entrances
| here ]
Regards
Bruce
_______________________________________________
Therion mailing list
[email protected]
https://mailman.speleo.sk/listinfo/therion
<<attachment: Test-Depth_Header.zip>>
_______________________________________________ Therion mailing list [email protected] https://mailman.speleo.sk/listinfo/therion
