On 2025-03-03 08:43, Thomas Meyer wrote:


You mean that:
% Set the textarea width to 2.6 alphabets.
\setbox\scratchbox\hbox{\dorecurse{26}{\character\recurselevel}}
\newdimen\Width \Width=\dimexpr(2.6\wd\scratchbox)
That's something I don't understand! What is a 2.6 alphabet? What means "scratchbox", "2.6\wd" ... ?

This is straight TeX (not the higher-level nicety of ConTeXt). What it does is create a throw-away box (a scratchbox) and sets in it horizontally one lower case alphabet of the current body font. It creates that alphabet by setting \character{1}\character{2}...\character{26} using a loop. It then measures the width of the box holding the 26 characters (\wd\scratchbox) and multiplies that by 2.6, depositing the result in \Width.

A more ConTeXt-y way to do this might be:

   \def\Alphabet{abcdefghijklmnopqrstuvwxyz}
   \setupbodyfont[libertinus,12pt]
   \setwidthof\Alphabet\to\AlphabetWidth

and then use width=2.6\AlphabetWidth in your layout

--
Rik
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to