Difference between revisions of "KOMA-scrartcl Type Area"
Jump to navigation
Jump to search
(changed to texcode instead of pre) |
m (Slight formatting and clarification.) |
||
Line 1: | Line 1: | ||
− | < [[From LaTeX to ConTeXt]] | + | < [[From LaTeX to ConTeXt]] > |
− | LaTeX: | + | == LaTeX == |
+ | |||
+ | The <tt>scrartcl</tt> 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: | ||
− | |||
<texcode> | <texcode> | ||
\documentclass[DIVcalc,twoside]{scrartcl} | \documentclass[DIVcalc,twoside]{scrartcl} | ||
Line 11: | Line 12: | ||
</texcode> | </texcode> | ||
− | ConTeXt | + | == ConTeXt == |
The following code duplicates the <tt>scrartcl</tt> calculations to set the text area and produces a similar sample document, again with a framed box to show the text area. | The following code duplicates the <tt>scrartcl</tt> calculations to set the text area and produces a similar sample document, again with a framed box to show the text area. | ||
+ | |||
<texcode> | <texcode> | ||
\def\BCOR{3mm}% eventual bounding correction | \def\BCOR{3mm}% eventual bounding correction | ||
Line 35: | Line 37: | ||
\stoptext | \stoptext | ||
</texcode> | </texcode> | ||
− | |||
− | |||
− |
Revision as of 00:49, 4 September 2005
LaTeX
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:
\documentclass[DIVcalc,twoside]{scrartcl} \begin{document} \noindent\framebox{\rule{0pt}{\textheight}\rule{\textwidth}{0pt}} \end{document}
ConTeXt
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.
\def\BCOR{3mm}% eventual bounding correction \newdimen\PageWidth \PageWidth=\paperwidth \doifmode{BCOR}{\PageWidth=\dimexpr(\PageWidth-\BCOR)} \edef\Ratio{\withoutpt{\the\dimexpr(2\paperheight/(\PageWidth/32768))}} \setbox\scratchbox\hbox{\dorecurse{26}{\character\recurselevel}} \newdimen\Width \newdimen\Height \newdimen\Back \Width=\dimexpr(2.6\wd\scratchbox) \Height=\dimexpr(\Ratio\Width) \doifmodeelse{oneside}{\Back=\dimexpr((\PageWidth - \Width) / 2)} {\Back=\dimexpr((\PageWidth - \Width) / 3)} \doifmode{BCOR}{\Back=\dimexpr(\Back + \BCOR)} \edef\Top{\the\dimexpr((\paperheight - \Height) / 3 - 3\lineheight)} \Height=\dimexpr(\Height + 8\lineheight) \setuplayout[backspace=\the\Back,height=\the\Height,width=\the\Width, header=2\lineheight,headerdistance=\lineheight, footer=2\lineheight,footerdistance=3\lineheight,topspace=\Top] \starttext \framed[width=\textwidth,height=\textheight]{} \stoptext