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.

  *  It conflates paper size and page size -- try adding
   \setuppapersize[A5][A3] and you will see what I mean.
  *  I do not see where your solution adapts the width to the alphabet
   width -- the referenced wiki page does; your version uses
   \baselineskip an an indirect stand-in. (Also, the comment is now
   misleading: Width is set proportionate to the determined height, not
   height proportionate to a determined width.) As far as characters
   per line, there are so many variables -- serif or sans, large or
   small x-height, ... but for single column texts with book faces 50
   to 70 characters width is typical, 40 to 50 for two-column setting.
   You pick your authority and make your choice --
  *  Binding correction is a press-time issue. Page layout should not
   deal with it -- it is handled during imposition after the paper
   weight and binding methods are settled. Two different trades. (If
   you need a quickie leaflet printed on standard untrimmed paper
   perhaps you might want to look at it, but not beyond that.) As long
   as you don't use BCOR mode, however, this is irrelevant to your
   layout, and I would remove all references to it.
 * Is this for a one-sided or two-sided document? You have
   \setuppagenumbering configured for two-sided, but calculate margins
   based on a mode suggesting a one-sided document.

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.

--
Rik

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

maillist : [email protected] / 
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