KOMA-scrartcl Type Area

From Wiki
Revision as of 04:19, 5 September 2005 by Brooks (talk | contribs) (And another. Sigh.)
Jump to navigation Jump to search

< From LaTeX to ConTeXt >


The scrartcl class from the KOMA package does some fairly sophisticated calculations to determine an optimal page layout, with the text width set in terms of average characters-per-line, and the text height and location set to provide pleasing proportions based on that and the paper proportions. A sample document (with a framebox to show the text area) is simply:



The following code duplicates the scrartcl calculations to set the text area and produces a similar sample document, again with a framed box to show the text area. Note that, because this depends on \lineheight and sets the text area width based on a measurement of a typeset alphabet, it should be applied after any font setup.

% Set binding correction value (mode=BCOR turns it on).

% Set visible page width.

% Determine the paper aspect ratio.

% Set the textarea width to 2.6 alphabets.
\newdimen\Width \Width=\dimexpr(2.6\wd\scratchbox)

% Set the textarea height proportional to the width.
\newdimen\Height \Height=\dimexpr(\Ratio\Width)

% Set the margin/gutter widths to be equal on a full spread.
    {\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.


This can be processed with a -mode=BCOR option on texexec to activate the binding correction, or with a -mode=oneside option to activate the single-sided page layout rather than the (default) double-sided version.