Am 03.03.25 um 04:22 schrieb Rik Kabel:

On 2025-03-02 11:38, Thomas Meyer wrote:
> Hi Rik and autumnus, > > Sorry for my late reply, but thank you very much for your > suggestions on this topic. Your calculations are very complicated I > think. However, the type area is not the end of the story. > Unfortunately, the line length remains the same with your > suggestions, even if the font size is reduced. For good readability, > however, the number of characters in the line should remain more or > less constant and not increase. In any case, that's what I've read. > I have therefore orientated myself on this: https:// > wiki.contextgarden.net/Introduction/From_LaTeX_to_ConTeXt/KOMA- > scrartcl_Type_Area > > It looks like this for me now: > > \definebodyfontenvironment[12pt][interlinespace=15pt] > \setupbodyfont[libertinus, 12pt] > > \setuppagenumbering[location={footer,middle}, > alternative=doublesided] > > \setupindenting[yes, small, next] > > %\enablemode[BCOR] % Set binding correction value . > \doifmodeelse{BCOR}{\def\bindingcorr{5mm}}{\def\bindingcorr{0pt}} > > % Set visible page width. \newdimen\PageWidth > \PageWidth=\dimexpr(\paperwidth-\bindingcorr) > > % Determine the paper aspect ratio. \edef\Ratio{0.618} > %Golden Ratio > > % Set the textarea height proportional to the width. > \newdimen\Height \Height=41\baselineskip % constant > number of lines (41) \newdimen\Width \Width=\dimexpr(\Ratio\Height) > > % Set the margin/gutter widths to be equal on a full spread. % > \newdimen\Back \Back=\dimexpr(((\PageWidth - \Width) / 2) + > \bindingcorr) > > \enablemode[oneside] \newdimen\Back \doifmodeelse{oneside} > {\Back=\dimexpr(((\PageWidth - \Width) / 2) + \bindingcorr)} > {\Back=\dimexpr(((\PageWidth - \Width) / 3) + \bindingcorr)} > > > % Set the top and bottom margins in a 1:2 ratio, ignoring headers. > \edef\Top{\the\dimexpr((\paperheight - \Height) / 3 - 3\lineheight)} > > % Redefine \Height to include header and footer space. > \Height=\dimexpr(\Height + 8\lineheight) > > % Set up the page layout using the calculated parameters. > \setuplayout[ backspace=\the\Back, height=\the\Height, > width=\the\Width, header=2.5\lineheight, > headerdistance=0.5\lineheight, footer=4.5\lineheight, > footerdistance=0.5\lineheight, bottom=2\lineheight, > bottomdistance=0.5\lineheight, margindistance=0.2\lineheight, > topspace=\Top, grid=on, ] > > \starttext > > \showgrid > > \input knuth > > \input tufte > > \input knuth > > \input tufte > > \showlayout[1, pt, mm] > > \stoptext > > If I am wrong, please correct me. > > Greetings Thomas

You are correct that these are two different approaches. The version I showed  calculates fixed top and side margins based on page size and computes a type area of specific proportions after that. The user is still responsible for determining an appropriate font size and leading, and the line count follows from that. Your solution starts with a font size, leading and line count, then computes text height, and lastly text width, splitting the remaining space among the margins.


I think that there are a couple of problems with the code as shown.
How can I change that?
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" ... ?

Forget the comment. It is copied.
I think a regular font is just right for continuous text. (Here 68 characters per line)
Binding correction and pagenumbering is not so important as the other points I think.

Other than that, it does a fine job. Perhaps best practice calls for \relax at the end of some of the \dimexprs, but that isn't necessary in this case.

Thank you!

--
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
___________________________________________________________________________________

Thank you Rik, for your comments.   Now more questions remain, see above!

You can also sit between two stools: on the one hand a balanced type area, on the other a favourite font with too many/too few letters in a line.

Greetings Thomas