[NTG-context] page arrangement

Hans Hagen ntg-context@ntg.nl
Sun, 04 Jan 2004 19:57:07 +0100


At 09:01 25/12/2003, you wrote:

>Here is testing code:
>---------------------------------------------------
>\setuppapersize[A5,landscape][A4]
>\setuparranging[4SIDE]
>%\setuppagenumbering[alternative=singlesided]
>
>\newcount\N
>
>\starttext
>   \switchtobodyfont[20pt]
>   \loop
>     \advance\N by1
>     \vfill
>     \cbox{Page \the\N}
>     \vfill\eject
>   \ifnum\N<8\repeat
>\stoptext

fyi: in context:

\starttext
   \dorecurse {8} {\startstandardmakeup \cbox{Page \recurselevel} 
\stopstandardmakeup}
\stoptext

actually 4SIDE is not the right name (compared to 2SIDE), maybe 4SEQUENCE 
is better

\def\poparrangedpagesTWOTOPSIDE
   {\ifnum\arrangedpageN>\zerocount
      \bgroup
      \gdef\arrangedpageN{2}\poparrangedpagesTWO
      \let\arrangedpageA\arrangedpageC
      \let\arrangedpageB\arrangedpageD
      \gdef\arrangedpageN{2}\poparrangedpagesTWO
      \doglobal\newcounter\arrangedpageN
      \egroup
   \fi}

\def\pusharrangedpageTWOTOPSIDE#1%
   {\doglobal\increment\arrangedpageN
    \reportarrangedpage\arrangedpageN
    \ifcase\arrangedpageN
    \or \handlearrangedpageXandY{#1}000\arrangedpageA %  1
    \or \handlearrangedpageXandY{#1}000\arrangedpageC %  2
    \or \handlearrangedpageXandY{#1}000\arrangedpageB %  1
    \or \handlearrangedpageXandY{#1}000\arrangedpageD %  2
      \poparrangedpages
    \fi}

\installpagearrangement 2TOPSIDE
   {\dosetuparrangement{1}{2}{4}{2}{3}%
      \pusharrangedpageTWOTOPSIDE\poparrangedpagesTWOTOPSIDE\handlearrangedpageTOP}

works ok with :

\setuppapersize[A5,landscape][A4] \setuparranging[2TOPSIDE]

\starttext
   \dorecurse{8}{Page \recurselevel\page}
\stoptext

Hans
Hans