Changes

Jump to navigation Jump to search
Present the problem more accurately, and add Hans's proposed work-around
Theoretically, one should be One is able to use different page layouts for the first, even and odd pages, but when it comes to varying text widths, ConTeXt doesn't adapt the paragraph width at a page boundary:
<texcode>
% setup layout for first page
</texcode>
This code sets up different sizes for each page. However, the text does not flow from one page to the next. For examleexample, if the even pages is very wide, and the odd page is narrow, then a paragraph starting on the even page and continuing on the odd page will run over.
Hans presented [[http://archive.contextgarden.net/message/20050321.003053.1d7975e1.html a workaround]] on the mailing list, with the caveat that it's "for novels only", meaning, no display math or floats. Consider yourself warned if you expect this to work beyond what's specified:<pretexcode>\startsetups [grid] [*default] \nopenalties\stopsetups \setuppagenumbering [alternative=doublesided] \setuplayout [grid=yes] \definelayout [odd] [width=10cm, lines=40] \definelayout [even] [width=8cm, lines=40] \setuplayout [odd] \setuptolerance [verytolerant] \showframe \def\SetLineWidths {\scratchtoks \emptytoks \ifdim\pagegoal=\maxdimen \scratchdimen\textheight \ifodd\realpageno \noflines\namedlayoutparameter{odd}{lines}% \else \noflines\namedlayoutparameter{even}{lines}% \fi \else \scratchdimen\dimexpr\pagegoal-\pagetotal\relax \advance\scratchdimen-\topskipgap \getnoflines\scratchdimen \fi \ifdim\scratchdimen<\lineheight \page \else \scratchcounter\noflines\relax \ifodd\realpageno \doSetLineWidths{odd}{even}% \else \doSetLineWidths{even}{odd}% \fi \parshape \scratchcounter \the\scratchtoks \relax \ignorespaces \fi} \def\doSetLineWidths#1#2% {\dorecurse\noflines {\appendetoks 0cm \namedlayoutparameter{#1}{width} \to\scratchtoks}% \dorecurse{2} {\advance\scratchcounter\namedlayoutparameter{#2}{lines}\relax \dorecurse{\namedlayoutparameter{#2}{lines}} {\appendetoks 0cm \namedlayoutparameter{#2}{width} \to\scratchtoks}% \advance\scratchcounter\namedlayoutparameter{#1}{lines}\relax \dorecurse{\namedlayoutparameter{#1}{lines}} {\appendetoks 0cm \namedlayoutparameter{#1}{width} \to\scratchtoks}}} \dontcomplain \EveryPar{\SetLineWidths} \starttext \dorecurse{25}{\dorecurse{4}{\input tufte }\par}
-----------------\stoptext| odd page || ||a paragraph from| the preceding page|that is too wide| for the page.| ||other paragraphs||fit fine. they ||fit.| |------------------</pretexcode>

Navigation menu