[NTG-context] \definemeasure / \dimexpr

Henning Hraban Ramm texml at fiee.net
Fri Nov 4 11:37:43 CET 2022


Am 03.11.22 um 22:43 schrieb Henning Hraban Ramm via ntg-context:
> Am 03.11.22 um 21:51 schrieb Hans Hagen via ntg-context:
>> On 11/3/2022 9:32 PM, Henning Hraban Ramm via ntg-context wrote:
>>> I’m constantly struggling with dimension calculations. Is there 
>>> anything I can read about the possibilities and limitations?
>>>
>>> e.g. with
>>> \definemeasure[PageWidth][132mm]
>>> none of the following works:
>>> \definemeasure[FlapWidth][0.8 * \measure{PageWidth}]
>>
>> use \measured (with a "d" to get a dimension)
> 
> Only in expressions like that or always?
> 
> In https://source.contextgarden.net/syst-aux.mkiv
> it looks like \measured returns a dimension, while \measure returns a 
> string (\the\measured), is this right?
> 
> So I should use \measure{} in setup keyvals, and \measured in dim 
> expressions?
> 
> Now, when I use calculated measures for a page size, I get:
> """
> You can't use '\dimexpr' in horizontal mode
> """

Here’s my MWE:
"""
\definemeasure[PageWidth][132mm]

\definemeasure[FlapWidth][\measured{PageWidth} * 0.8]

\starttext

FlapWidth: \measure{FlapWidth}

\stoptext
"""

Results in:

FlapWidth: 0.0pt.8


Longer example attached.


Hraban
-------------- next part --------------
A non-text attachment was scrubbed...
Name: covertest.tex
Type: application/x-tex
Size: 1315 bytes
Desc: not available
URL: <http://mailman.ntg.nl/pipermail/ntg-context/attachments/20221104/8e9b6ea3/attachment.tex>


More information about the ntg-context mailing list