Difference between revisions of "KOMA-scrartcl Type Area"
Jump to navigation
Jump to search
(Added some explanation of what the code appears to be attempting to do.) |
(changed to texcode instead of pre) |
||
Line 4: | Line 4: | ||
The <tt>scrartcl</tt> class from the KOMA package does some fairly sophisticated calculations to determine an appropriate page layout. A sample document (with a framebox to show the text area) is simply: | The <tt>scrartcl</tt> class from the KOMA package does some fairly sophisticated calculations to determine an appropriate page layout. A sample document (with a framebox to show the text area) is simply: | ||
− | < | + | <texcode> |
\documentclass[DIVcalc,twoside]{scrartcl} | \documentclass[DIVcalc,twoside]{scrartcl} | ||
\begin{document} | \begin{document} | ||
\noindent\framebox{\rule{0pt}{\textheight}\rule{\textwidth}{0pt}} | \noindent\framebox{\rule{0pt}{\textheight}\rule{\textwidth}{0pt}} | ||
\end{document} | \end{document} | ||
− | </ | + | </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> |
\def\BCOR{3mm}% eventual bounding correction | \def\BCOR{3mm}% eventual bounding correction | ||
\newdimen\PageWidth \PageWidth=\paperwidth | \newdimen\PageWidth \PageWidth=\paperwidth | ||
Line 34: | Line 34: | ||
\framed[width=\textwidth,height=\textheight]{} | \framed[width=\textwidth,height=\textheight]{} | ||
\stoptext | \stoptext | ||
− | </ | + | </texcode> |
In the beta version of ConTeXt, there is probably a better way to achieve the | In the beta version of ConTeXt, there is probably a better way to achieve the | ||
same... | same... |
Revision as of 18:18, 26 July 2005
LaTeX:
The scrartcl class from the KOMA package does some fairly sophisticated calculations to determine an appropriate page layout. 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
In the beta version of ConTeXt, there is probably a better way to achieve the same...