[NTG-context] \definemeasure / \dimexpr

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Sun Nov 13 13:17:19 CET 2022


Henning Hraban Ramm via ntg-context schrieb am 13.11.2022 um 11:37:
> One problem left with dimensions that I can’t reproduce in a minimal 
> example:
>
> I want to calculate the spine width of the cover from the number of 
> content pages:
>
> \useexternalfigure[CONTENT][book.pdf]
> \getfiguredimensions[CONTENT]
> \definemeasure[SpineWidth][2mm + (0.135mm * \noffigurepages/2)]

You can try

     \expanded{\definemeasure[SpineWidth][...]}

> That works so far, if I output \measure{SpineWidth} it shows the right 
> size (~42pt).
>
> But if I use this measure in
> \setlayer[width=\measure{SpineWidth}]{...}
> it’s very small.
> I guess \noffigurepages is 1 at that point (from another image) and 
> I’d need to expand it first.
>
> Am I right that the expansion happens only at the “execution” of 
> \measure? How would I do that? \expanded\noffigurepages doesn’t work.
>
>
> Another issue:
>
> 0.135mm is the paper thickness of 90 g/m² (= 0.09mm per sheet) with 
> 1.5 bulk. But
> \definemeasure[SpineWidth][2mm + (0.09mm * 1.5 * 90)]
> doesn’t work:

You can use integers to multiply or divide a length, a float is only allowed
before a length. e.g. 1.5\scratchdimen or 1.5\dimexpr ...\relax

In your case you have to use

     \definemeasure[SpineWidth][2mm + (0.09mm * 3 * 90 / 2)]

or

     \definemeasure[SpineWidth][2mm + (0.09mm * 135)]


Wolfgang



More information about the ntg-context mailing list