* Doublesided, with header text centered. @ 2006-06-08 17:44 John R. Culleton 2006-06-08 18:09 ` Aditya Mahajan 0 siblings, 1 reply; 9+ messages in thread From: John R. Culleton @ 2006-06-08 17:44 UTC (permalink / raw) 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. -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Doublesided, with header text centered. 2006-06-08 17:44 Doublesided, with header text centered John R. Culleton @ 2006-06-08 18:09 ` Aditya Mahajan 2006-06-09 17:06 ` Aditya Mahajan 0 siblings, 1 reply; 9+ messages in thread From: Aditya Mahajan @ 2006-06-08 18:09 UTC (permalink / raw) 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] Aditya ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Doublesided, with header text centered. 2006-06-08 18:09 ` Aditya Mahajan @ 2006-06-09 17:06 ` Aditya Mahajan 2006-06-09 18:42 ` John R. Culleton 0 siblings, 1 reply; 9+ messages in thread From: Aditya Mahajan @ 2006-06-09 17:06 UTC (permalink / raw) 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][Whatever] \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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Doublesided, with header text centered. 2006-06-09 17:06 ` Aditya Mahajan @ 2006-06-09 18:42 ` John R. Culleton 2006-06-09 19:33 ` Aditya Mahajan 2006-06-09 20:31 ` Willi Egger 0 siblings, 2 replies; 9+ messages in thread From: John R. Culleton @ 2006-06-09 18:42 UTC (permalink / raw) 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@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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Doublesided, with header text centered. 2006-06-09 18:42 ` John R. Culleton @ 2006-06-09 19:33 ` Aditya Mahajan 2006-06-09 20:43 ` John R. Culleton 2006-06-09 20:31 ` Willi Egger 1 sibling, 1 reply; 9+ messages in thread From: Aditya Mahajan @ 2006-06-09 19:33 UTC (permalink / raw) On Fri, 9 Jun 2006, John R. Culleton wrote: > 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@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. \def\MyHeader{ \doifoddpageelse{Odd Header} {Even Header}} \setupheadertexts[\MyHeader] If you want you can extend it to recognize keywords like date, pagenumber, section etc. Aditya ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Doublesided, with header text centered. 2006-06-09 19:33 ` Aditya Mahajan @ 2006-06-09 20:43 ` John R. Culleton 2006-06-09 21:16 ` Aditya Mahajan 0 siblings, 1 reply; 9+ messages in thread From: John R. Culleton @ 2006-06-09 20:43 UTC (permalink / raw) On Friday 09 June 2006 15:33, Aditya Mahajan wrote: > >> ntg-context@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. > > \def\MyHeader{ > \doifoddpageelse{Odd Header} > {Even Header}} > > \setupheadertexts[\MyHeader] > > If you want you can extend it to recognize keywords like date, > pagenumber, section etc. > Yes, I can do the above. Unfortunately the keywords like chapter lose their special meaning when enclosed in any way. For example \setupheadertexts [chapter] [][] [\hfil\hbox to 20em{\stretched{\tfb\sc Independent{}Publishing}}\hfil] ...works, but as soon as I place any command ahead of the keyword chapter it just becomes the word "chapter". for example this doesn't work: \setupheadertexts [\hfil chapter\hfil] [][] [\hfil\hbox to 20em{\stretched{\tfb\sc Independent{}Publishing}}\hfil] And if I put commands in the \setupheader statement then this works: \setupheader[text][before={\tfb\sc\hskip 1in}}] but this has no effect: \setupheader[text][before={\tfb\sc\hfil},after={\hfil}] I can of course roll my own as you suggest above. But if I want chapter as a variable then I will have to encapsulate my \chapter command thus: \def\Chapter#1{\global\def\mychaptername{#1}\chapter{#1}} ...and use \mychaptername in my home grown header routine. In fact I have done just that today: \def\mychapter{} \def\Chapter#1{\global\def\mychapter{\tfb\sc\hfil#1\hfil}\chapter#1} I can probably even get stretching in there if I work at it. I don't mind doing this kind of plain tex manipulation but it still seems to me that Context should handle it somehow. -- 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Doublesided, with header text centered. 2006-06-09 20:43 ` John R. Culleton @ 2006-06-09 21:16 ` Aditya Mahajan 0 siblings, 0 replies; 9+ messages in thread From: Aditya Mahajan @ 2006-06-09 21:16 UTC (permalink / raw) Cc: ntg-context On Fri, 9 Jun 2006, John R. Culleton wrote: > On Friday 09 June 2006 15:33, Aditya Mahajan wrote: >>>> ntg-context@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. >> >> \def\MyHeader{ >> \doifoddpageelse{Odd Header} >> {Even Header}} >> >> \setupheadertexts[\MyHeader] >> >> If you want you can extend it to recognize keywords like date, >> pagenumber, section etc. >> > Yes, I can do the above. Unfortunately the keywords like chapter > lose their special meaning when enclosed in any way. For example > \setupheadertexts > [chapter] > [][] > [\hfil\hbox to 20em{\stretched{\tfb\sc > Independent{}Publishing}}\hfil] > > ...works, but as soon as I place any command ahead of the keyword > chapter it just becomes the word "chapter". for example this > doesn't work: > [code snipped] You can use the \domagic macro from my previous email to handle chapter, date and pagenumber. > I can of course roll my own as you suggest above. But if I want > chapter as a variable then I will have to encapsulate my \chapter > command thus: > [code snipped] > > I don't mind doing this kind of plain tex manipulation but it > still seems to me that Context should handle it somehow. If you just want chapter markings, use \getmarking[chapter]. Aditya ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Doublesided, with header text centered. 2006-06-09 18:42 ` John R. Culleton 2006-06-09 19:33 ` Aditya Mahajan @ 2006-06-09 20:31 ` Willi Egger 2006-06-09 21:31 ` Aditya Mahajan 1 sibling, 1 reply; 9+ messages in thread From: Willi Egger @ 2006-06-09 20:31 UTC (permalink / raw) Hi John, Humble, if I understand your question correctly then for me the following works: \setupheadertexts[\hfill {\getmarking[section][last]}\hfill][pagenumber][pagenumber][\hfill Even page text\hfill] \setuppagenumbering[location=, alternative=doublesided] \starttext \dorecurse{20}{\input knuth\blank[1cm]} \stoptext I have to admit that there might something be broken. If I compile the sample I get the wrong sectionnumber in the header. i.e. the section number of the first section on the next page is given. If I use [first] instead of last, the first sectionnumber should be given, but in this sample still the section number of the first section of the following page is given. Hans may be you could have a look into this matter? - Or am I doing wrong things? Cheers Willi John R. Culleton wrote: > 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@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. > > > > ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: Doublesided, with header text centered. 2006-06-09 20:31 ` Willi Egger @ 2006-06-09 21:31 ` Aditya Mahajan 0 siblings, 0 replies; 9+ messages in thread From: Aditya Mahajan @ 2006-06-09 21:31 UTC (permalink / raw) On Fri, 9 Jun 2006, Willi Egger wrote: > Hi John, > > Humble, if I understand your question correctly then for me the > following works: > > \setupheadertexts[\hfill > {\getmarking[section][last]}\hfill][pagenumber][pagenumber][\hfill Even > page text\hfill] > \setuppagenumbering[location=, alternative=doublesided] > > \starttext > \dorecurse{20}{\input knuth\blank[1cm]} > \stoptext > > I have to admit that there might something be broken. If I compile the > sample I get the wrong sectionnumber in the header. i.e. the section > number of the first section on the next page is given. If I use [first] > instead of last, the first sectionnumber should be given, but in this > sample still the section number of the first section of the following > page is given. > Hans may be you could have a look into this matter? - Or am I doing > wrong things? It seems that something is broken. Even this simple example gives wrong headers \setupheadertexts[section] \starttext \dorecurse{20}{\section{Test \recurselevel}\input knuth\endgraf} \stoptext Aditya ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2006-06-09 21:31 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2006-06-08 17:44 Doublesided, with header text centered John R. Culleton 2006-06-08 18:09 ` Aditya Mahajan 2006-06-09 17:06 ` Aditya Mahajan 2006-06-09 18:42 ` John R. Culleton 2006-06-09 19:33 ` Aditya Mahajan 2006-06-09 20:43 ` John R. Culleton 2006-06-09 21:16 ` Aditya Mahajan 2006-06-09 20:31 ` Willi Egger 2006-06-09 21:31 ` Aditya Mahajan
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).