[NTG-context] \definemeasure / \dimexpr

Henning Hraban Ramm texml at fiee.net
Sun Nov 13 11:37:20 CET 2022


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)]

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:

"""
Missing ) inserted for expression

<to be read again>

     .
<macro> \commalistcommand
     2mm + (0.09mm * 1.
     5 * \noffigurepages /2)
<macro> \measured
     #1->\dimexpr \ifcsname \??measure #1\endcsname \lastnamedcs
     \else \zeropoint \fi \relax
...
"""

I also tried 1.5sp since sp should be 1, but it didn’t help.


Hraban


More information about the ntg-context mailing list