Hi Xavier
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.
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).
:)
Bruce
From: Therion <therion-bounces@speleo.sk> On Behalf Of Xavier Robert via Therion
Sent: Tuesday, 26 February 2019 10:16
Subject: Re: [Therion] Depth in the header
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):
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" <therion@speleo.sk>
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 here
Regards
Bruce