[NTG-context] \definemeasure / \dimexpr

Herbert Voss Herbert.Voss at fu-berlin.de
Fri Nov 4 11:52:35 CET 2022



Am 04.11.22 um 11:37 schrieb Henning Hraban Ramm via ntg-context:
> 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]
>

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


works

Herbert


> \starttext
>
> FlapWidth: \measure{FlapWidth}
>
> \stoptext
> """
>
> Results in:
>
> FlapWidth: 0.0pt.8
>
>
> Longer example attached.
>
>
> Hraban
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
>
> maillist : ntg-context at ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
> webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : https://contextgarden.net
> ___________________________________________________________________________________



More information about the ntg-context mailing list