Lost in the murky detail of designing a page layout
I'm out of my depth, I've looked at the s-*.tex layouts, and have read chapter 3 of the manual, but am not confident in designing a page layout. For instance, I'm not sure how I ensure that vsize comes out as a multiple of baselineskips, or how to ensure that double sided pages are printed correctly. My initial design parameters (for a double sided page) are: 1) paper size = A4 2) hsize = 2.5 times the length of the lowercase alphabet in the default font -- lucida-bright at 12pt. i.e. \setbox0={abcdefghijklmnopqrstuvwxyz} \hsize=2.5\wd0 3) vsize = golden-ratio times hsize (rounded to integer baselineskips) = 1.62\hsize 4) backspace margin = hsize divided by seven 5) topspace margin = backspace margin. How do I translate these into my \setuplayout parameters?
Guy Worthington
How do I translate these into my \setuplayout parameters?
=========================================================== \startbuffer \setuppapersize[A4][A4] \setbox0=\hbox{abcdefghijklmnopqrstuvwxyz} \setuplayout[width=2.5\wd0, header=0pt, headerdistance=0pt, footer=0pt, footerdistance=0pt, height=1.62\makeupwidth, backspace=.143\makeupwidth, topspace=\backspace, ] \stopbuffer \getbuffer \showframe \starttext \typebuffer %\the\wd0 \copy0 \copy0 %\showlayout \stoptext =========================================================== Patrick
Thanks Patrick for the example. It's a start (the A4 typesetting area looks good). Now I need to flesh out some of the details. If I explain how I'd go about it using Hans diagram on pg 30 of the english ConTeXt manual, maybe I'll make myself clearer (well at least clearer than my initial correspondence). 1) define A4 typesetting area width = 2.5 times the length of the lowercase alphabet in the default font -- lucida-bright at 12pt height = golden-ratio times width this is the inclusive area header + text + footer. 2) If you look at the figure on page 30 of the english ConTeXt manual, Hans has drawn a hatched area called "footer". I'd like the distance between the baseline of the last line of text in the main text area and the baseline of the footer to be equal to two times the leading of the main font in white space plus the leading of the footer line: footer = 2 * \baselineskip whitespace + \baselineskip footer text 3) If you look at the hatched area on page 30 called "header" I'd like the distance from the top of the header to baseline of line 1 of the main text to be the twice the leading of the main font in white space plus the height of a one strutbox. header = \baseline header text + 2 * \baselineskip whitespace + \ht\strutbox main text 4) If you look at the area on page 30 called text, I'd like the text area to 41 lines. height = 41 \baselineskip 5) I'd like any whitespace needed to compensate for underfull \vbox messages to be divided equally between the whitespace separating the header and the text and the footer and the text. 5) I'd like backspace and topspace margins to be equal to the width divided by seven.
At 04:07 PM 2/5/2003 +0800, you wrote:
Thanks Patrick for the example. It's a start (the A4 typesetting area looks good). Now I need to flesh out some of the details. If I explain how I'd go about it using Hans diagram on pg 30 of the english ConTeXt manual, maybe I'll make myself clearer (well at least clearer than my initial correspondence).
mainly a matter of calculating, like:
1) define A4 typesetting area
width = 2.5 times the length of the lowercase alphabet in the default font -- lucida-bright at 12pt
height = golden-ratio times width
this is the inclusive area header + text + footer.
\setbox\scratchbox\hbox{\dorecurse{26}{\character\recurselevel}} \def \MyRatio {1.5} \edef\MyWidth {\the\dimexpr(2.5\wd\scratchbox)} \edef\MyHeight{\the\dimexpr(\MyRatio\wd\scratchbox)} \setuplayout [height=\MyHeight, width=\MyWidth] \showframe \starttext \input tufte \stoptext ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
Thanks to Patrick and Hans I've a layout approaching what I want. My layout look slightly different to the one I'm posting. However this layout demonstrates my question, and uses a more available font. If you look at the output, you'll see, at the bottom of the main text area, whitespace. The whitespace exists because there isn't enough room to fit another line in the text area. My question is, can I specify an integer number of lines in the text area, and have the excess whitespace distributed evenly in my \headerdistance and \footerdistance. If this isn't possible without calculations, is it possible to log the underfull \vbox messages? So I've some feedback that I can use to adjust my \headerdistance and \footerdistance manually. %-- tryISOLayout.ctx -------------------------------------------- %output=pdf \setuppapersize[A4][A4] \setupencoding[default=texnansi] \setupbodyfont[cmr,14.4pt] \def\GoldenRatio{1.61803} \setbox0\hbox{\dorecurse{26}{\character\recurselevel}} \setuplayout[width=2.5\wd0, header=\lineheight, headerdistance=\lineheight, footer=\lineheight, footerdistance=\lineheight, height=\GoldenRatio\makeupwidth, backspace=\dimexpr(\makeupwidth/7), topspace=\dimexpr(\makeupwidth/7)] \showframe \starttext \startlinenumbering \dorecurse{5}{\input tufte} \stoplinenumbering \stoptext %-- end tryISOLayout.ctx -----------------------------------------
Guy Worthington
If you look at the output, you'll see, at the bottom of the main text area, whitespace. The whitespace exists because there isn't enough room to fit another line in the text area. My question is, can I specify an integer number of lines in the text area, and have the excess whitespace distributed evenly in my \headerdistance and \footerdistance.
%output=pdf \setuppapersize[A4][A4] \setupencoding[default=texnansi] \setupbodyfont[cmr,14.4pt] \def\GoldenRatio{1.61803} \setbox0\hbox{\dorecurse{26}{\character\recurselevel}} \setuplayout[width=2.5\wd0, header=\lineheight, footer=\lineheight, height=\GoldenRatio\makeupwidth, footerdistance=\dimexpr( (\makeupheight-37\lineheight-\headerheight-\footerheight) /2), % does not work, why? % headerdistance=\footerdistance, headerdistance=\dimexpr( (\makeupheight-37\lineheight-\headerheight-\footerheight) /2), backspace=\dimexpr(\makeupwidth/7), topspace=\dimexpr(\makeupwidth/7)] \showlayout \showframe \starttext \startlinenumbering \dorecurse{5}{\input knuth} \stoplinenumbering \stoptext %%% Local Variables: %%% mode: context %%% TeX-master: t %%% End: But: I have two questions: why does \headerdistance=\footerdistance not work the way I'd expect (making 'em equal)? Why is there a difference between knuth.tex and tufte.tex in the example (try \input tufte instead of \input knuth). Patrick
At 12:49 PM 2/6/2003 +0100, you wrote:
Guy Worthington
writes: Hello again,
If you look at the output, you'll see, at the bottom of the main text area, whitespace. The whitespace exists because there isn't enough room to fit another line in the text area. My question is, can I specify an integer number of lines in the text area, and have the excess whitespace distributed evenly in my \headerdistance and \footerdistance.
%output=pdf
\setuppapersize[A4][A4] \setupencoding[default=texnansi] \setupbodyfont[cmr,14.4pt]
\def\GoldenRatio{1.61803} \setbox0\hbox{\dorecurse{26}{\character\recurselevel}}
\setuplayout[width=2.5\wd0, header=\lineheight, footer=\lineheight, height=\GoldenRatio\makeupwidth, footerdistance=\dimexpr( (\makeupheight-37\lineheight-\headerheight-\footerheight) /2), % does not work, why?
there is some order in calculations; the header is calculated before the footer -) Hans ------------------------------------------------------------------------- Hans Hagen | PRAGMA ADE | pragma@wxs.nl Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com ------------------------------------------------------------------------- information: http://www.pragma-ade.com/roadmap.pdf documentation: http://www.pragma-ade.com/showcase.pdf -------------------------------------------------------------------------
Hello again Patrick, The reason I've taken so long to reply, is that I've been trying to understand TeX's line-breaking mechanism. Your perceptive question:
Why is there a difference between knuth.tex and tufte.tex in the example (try \input tufte instead of \input knuth).
In the example below %-- tryISOLayout.ctx ---------------------------------------- %output=pdf \setuppapersize[A4][A4] \setupencoding[default=texnansi] \setupbodyfont[cmr,14.4pt] \def\GoldenRatio{1.61803} \setbox0\hbox{\dorecurse{26}{\character\recurselevel}} \setuplayout[width=2.5\wd0, header=\lineheight, footer=\lineheight, height=\GoldenRatio\makeupwidth, headerdistance=\dimexpr( (\makeupheight-37\lineheight-\headerheight-\footerheight) /2), footerdistance=\headerdistance, backspace=\dimexpr(\makeupwidth/7), topspace=\dimexpr(\makeupwidth/7)] \showframe \starttext \startlinenumbering \dorecurse{5}{\input tufte} \stoplinenumbering \stoptext %-- end tryISOLayout.ctx ------------------------------------ I think is due to TeX trying very hard not to generate a widow line. Even after fiddling around with \looseness, I couldn't force TeX to add the 37th line. I've a feeling that if you come across a pathological case like the above, you really have to follow Knuth's advice and rewrite the paragraph.
Guy Worthington
I think is due to TeX trying very hard not to generate a widow line.
Even after fiddling around with \looseness, I couldn't force TeX to add the 37th line. I've a feeling that if you come across a pathological case like the above, you really have to follow Knuth's advice and rewrite the paragraph.
I was playing with \widowpenalty but it did not help. But setting \brokenpenalty=0 works fine (although it is not nice to have a hyphen as the last line) Patrick
participants (3)
-
Guy Worthington
-
Hans Hagen
-
Patrick Gundlach