[NTG-context] Re: Layout stuff

h h extern pragma at wxs.nl
Mon Mar 21 01:30:53 CET 2005


Paul Tremblay wrote:
>>There is, of course, \parshape. And I know that Hans does a lot of
>>paragraph trickery (see for example coloumns).
>>
>  
> If you can get pages with different widths to work, please let me know!
> Like I said, I posted the problematic code in the wiki. It would be
> great to get this to work.

for controlled situations it's doable by setting the parshape

so, for novels you can use:

\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

no guarantees, no kernel stuff either, maybe some fun module

hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
      tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------



More information about the ntg-context mailing list