[NTG-context] Doublesided, with header text centered.

John R. Culleton john at wexfordpress.com
Fri Jun 9 20:42:20 CEST 2006


On Friday 09 June 2006 13:06, Aditya Mahajan wrote:
> On Thu, 8 Jun 2006, Aditya Mahajan wrote:
> > On Thu, 8 Jun 2006, John R. Culleton wrote:
> >> Here is a common situation. I need a doublesided layout so I can
> >> adjust the backspace. I want the header text on evens and odds
> >> centered over the text block. To simplify the issue let's say
> >> I want "left" on the evens and "right" on the odds. If I specify
> >> (per the manual)
> >> \setupheadertexts[text][left][right]
> >> then I get both words on both pages.
> >> If I use two extra sets of [] then I can get "left" on the left
> >> and "right" on the right but I cannot get them centered.
> >>
> >> I am missing something obvious I am sure. Anyone have a firm
> >> grasp of the obvious? I don't.
> >
> > If I understand you correctly, use \setupheadertexts[center]. If you
> > want something in the left, center and right, then do
> >
> > \setupheadertexts[left][right]
> > \setupheadertexts[center]
>
> I misread your mail. How about something like this
>
> \def\setupextendedheadertexts{%
>    \dosixtupleempty\dosetupextendedheadertexts}
>
> \def\dosetupextendedheadertexts[#1][#2][#3][#4][#5][#6]{
>    \setupheadertexts[] %Empty the center headers
>    \setupheadertexts
>      %Odd page
>      [{\rlap{#1}\hfill#2\hfill\llap{#3}}][]
>      %Even page
>      [][{\rlap{#4}\hfill#5\hfill\llap{#6}}]}
>
> \setupextendedheadertexts[odd-left][odd-center][odd-right][even-left][even-
>center][even-right]
>
> \starttext
> \dorecurse{10}{This is a test \page}
> \stoptext
>
>
> This does not take care of "magic" texts like pagenumber, section,
> chapter. If you want that, you can try (careful with linebreaks)
>
> \def\setupextendedheadertexts{%
>    \dosixtupleempty\dosetupextendedheadertexts}
>
> \def\dosetupextendedheadertexts[#1][#2][#3][#4][#5][#6]{
>    \setupheadertexts[] %Empty the center headers
>    \setupheadertexts
>      %Odd page
> [{\rlap{\domagic{#1}}\hfill\domagic{#2}\hfill\llap{\domagic{#3}}}][]
>      %Even page
> [][{\rlap{\domagic{#4}}\hfill\domagic{#5}\hfill\llap{\domagic{#6}}}]}
>
> \unprotect
> \def\domagic#1{%
>    \convertargument#1\to\ascii
>    \doifsomething\ascii{%
>      \doifelsemarking\ascii
>        {\getmarking[\ascii][\v!first]}
>        {\ConvertConstantAfter\doifelse\v!pagenumber{#1}
>          \@@plaatspaginanummer
>          {\ConvertConstantAfter\doifelse\v!date{#1}
>            {\currentdate}
>            {#1{}{}{}}}}}}
> \protect
>
> \setupextendedheadertexts[date][chapter][pagenumber][pagenumber][section][W
>hatever]
>
> \starttext
> \dorecurse{4}{
> \chapter{Chapter \recurselevel}
>    \input tufte \endgraf
>    \input tufte \endgraf
>    \input tufte \endgraf
>    \section{Section}
>    \input knuth
>    \input knuth
>    \input knuth
> }
>
> \stoptext
>
>
> Aditya
> _______________________________________________
> ntg-context mailing list
> ntg-context at ntg.nl

Very impressive, but surely there is a simpler solution! I just
want one header on the left hand page, a different one on the
right, and both of them centered on their respective pages.  



-- 
John Culleton
Books with answers to marketing and publishing questions:
http://wexfordpress.com/tex/shortlist.pdf

Book coaches, consultants and packagers:
http://wexfordpress.com/tex/packagers.pdf



More information about the ntg-context mailing list