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
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
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
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
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
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
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
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.
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
participants (3)
-
Aditya Mahajan
-
John R. Culleton
-
Willi Egger