[NTG-context] centered headertexts ??

Hans Hagen pragma at wxs.nl
Thu Jul 27 12:28:33 CEST 2006


Steffen Wolfrum wrote:
> Hi,
>
> apologies, I guess this one is a pretty easy question, but after  
> trying (almost) every combination I gave up...
>
> How do I get xxx and yyy set in the header's center??
>
>   
the ugly way :

\setupheadertexts[text][\hfill xxx \hfill][][][\hfill yyy\hfill]

> \setuppagenumbering [alternative=doublesided,location= 
> {header,marginedge}]
> \setupheadertexts[][xxx][yyy][]
>
>
> \starttext
>
> \input tufte
>
> \input knuth
>
> \input tufte
>
> \input knuth
>
> \input tufte
>
> \input knuth
>
> \stoptext
>   
we can consider a more explicit variant: 

\def\settext
  {\doquintupleempty\dosettext}

\def\dosettext[#1][#2][#3][#4][#5]% text header middle text/text
  {\iffifthargument
     \setvalue{\??tk#1#2\executeifdefined{\c!text:#3}\c!middletext}%
       {\dodoubletexts{\??tk#1}{#2}%
          {\c!leftstyle \c!leftcolor \c!leftwidth }{#4}%
          {\c!rightstyle\c!rightcolor\c!rightwidth}{#5}}%
   \else\iffourthargument
     \setvalue{\??tk#1#2\executeifdefined{\c!text:#3}\c!middletext}%
       {\dodoubletexts{\??tk#1}{#2}%
          {\c!leftstyle \c!leftcolor \c!leftwidth }{#4}%
          {\c!rightstyle\c!rightcolor\c!rightwidth}{#4}}%
   \else\ifthirdargument
     \setvalue{\??tk#1#2\c!middletext}%
       {\dodoubletexts{\??tk#1}{#2}%
          {\c!leftstyle \c!leftcolor \c!leftwidth }{#3}%
          {\c!rightstyle\c!rightcolor\c!rightwidth}{#3}}%
   \fi\fi\fi}

\def\resettext
  {\dotripleempty\doresettext}

\def\doresettext[#1][#2][#3]% text header middle
  {\ifthirdargument
     \letvalue{\??tk#1#2\executeifdefined{\c!text:#3}\c!middletext}\empty
   \else\ifsecondargument
     \letvalue{\??tk#1#2\c!lefttext  }\empty
     \letvalue{\??tk#1#2\c!middletext}\empty
     \letvalue{\??tk#1#2\c!righttext }\empty
   \fi\fi}

\setvalue{\c!middle:\c!text}{\c!middletext}
\setvalue{\c!left  :\c!text}{\c!lefttext  }
\setvalue{\c!right :\c!text}{\c!righttext }

\settext[text][header][middle][xxx][yyy]

(or maybe \setpagetext \resetpagetext) 

-----------------------------------------------------------------
                                          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