From: Wolfgang Schuster via ntg-context <ntg-context@ntg.nl>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Cc: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
Subject: Re: \definemeasure / \dimexpr
Date: Sun, 13 Nov 2022 13:17:19 +0100 [thread overview]
Message-ID: <ff33ed1f-c1e0-6893-079e-86dc7dac4324@gmail.com> (raw)
In-Reply-To: <eb6ec12d-03e5-8ce5-80ce-60ea73bd2837@fiee.net>
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
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@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
___________________________________________________________________________________
next prev parent reply other threads:[~2022-11-13 12:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-03 20:32 Henning Hraban Ramm via ntg-context
2022-11-03 20:51 ` Hans Hagen via ntg-context
2022-11-03 21:43 ` Henning Hraban Ramm via ntg-context
2022-11-04 10:37 ` Henning Hraban Ramm via ntg-context
2022-11-04 10:52 ` Herbert Voss via ntg-context
2022-11-04 11:09 ` Henning Hraban Ramm via ntg-context
2022-11-13 10:37 ` Henning Hraban Ramm via ntg-context
2022-11-13 12:17 ` Wolfgang Schuster via ntg-context [this message]
2022-11-13 14:31 ` Henning Hraban Ramm via ntg-context
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ff33ed1f-c1e0-6893-079e-86dc7dac4324@gmail.com \
--to=ntg-context@ntg.nl \
--cc=wolfgang.schuster.lists@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).