header in the middle on doublesided layout
Hello, I would like to set a different header on left and right page, but I would like it to be centered on page. How do I do that? The command \setupheadertexts[a][b] puts "a b" on one page and "b a" on the other while \setupheadertexts[a][b][c][d] puts "a b" on one page and "c d" on the other. On single-sided layouts I could use \setupheadertexts[a] or \setupheadertexts[][a][] but using 6 parameters on double-sided doesn't work. I am now hacking with \setupheadertexts[\hbox{\kern-5mm\myheaderright}][][][\hbox{\myheaderleft\kern-5mm}] \def\myheaderright{\hbox to "textwidth+10mm"{...}} but that's a bit ugly. Mojca
On Mon, Mar 22, 2010 at 12:29 PM, Mojca Miklavec
Hello,
I would like to set a different header on left and right page, but I would like it to be centered on page. How do I do that?
The command \setupheadertexts[a][b] puts "a b" on one page and "b a" on the other while \setupheadertexts[a][b][c][d] puts "a b" on one page and "c d" on the other. On single-sided layouts I could use \setupheadertexts[a] or \setupheadertexts[][a][] but using 6 parameters on double-sided doesn't work.
I am now hacking with \setupheadertexts[\hbox{\kern-5mm\myheaderright}][][][\hbox{\myheaderleft\kern-5mm}] \def\myheaderright{\hbox to "textwidth+10mm"{...}} but that's a bit ugly.
Mojca Why don't you use setups ? %%%%% \showframe
\setuppagenumbering[alternative=doublesided,location=footer] \startsetups Header:Left \vbox to \headerheight{\vss \ruledhbox{\centerline{ \getmarking[chapter][first] }} \vss} \stopsetups \startsetups Header:Right \vbox to \headerheight{\vss \ruledhbox{\centerline{ \getmarking[chapter][first] }} \vss} \stopsetups \setupheadertexts[\setups{Header:Left}][][\setups{Header:Right}][] \starttext \dorecurse{4}{\chapter{ch \recurselevel} \section{sec \recurselevel}\page} \stoptext %%%%%%% -- luigi
On Mon, Mar 22, 2010 at 12:58 PM, luigi scarso
On Mon, Mar 22, 2010 at 12:29 PM, Mojca Miklavec
wrote: Hello,
I would like to set a different header on left and right page, but I would like it to be centered on page. How do I do that?
The command \setupheadertexts[a][b] puts "a b" on one page and "b a" on the other while \setupheadertexts[a][b][c][d] puts "a b" on one page and "c d" on the other. On single-sided layouts I could use \setupheadertexts[a] or \setupheadertexts[][a][] but using 6 parameters on double-sided doesn't work.
I am now hacking with \setupheadertexts[\hbox{\kern-5mm\myheaderright}][][][\hbox{\myheaderleft\kern-5mm}] \def\myheaderright{\hbox to "textwidth+10mm"{...}} but that's a bit ugly.
Mojca Why don't you use setups ?
Sorry, the first was wrong. %%%%% \showframe \setuppagenumbering[alternative=doublesided,location=footer] \startsetups Header:Left \vbox to \headerheight{\vss \ruledhbox{\centerline{\strut Header:Left \getmarking[chapter][first]}} \vss} \stopsetups \startsetups Header:Right \vbox to \headerheight{\vss \ruledhbox{\centerline{\strut Header:Right \getmarking[chapter][last]}} \vss} \stopsetups \setupheadertexts[\setups{Header:Left}][][][\setups{Header:Right}] \starttext \dorecurse{4}{% \edef\T{\recurselevel} \expandafter\chapter\expandafter{\recurselevel{}Chapter } \section{Section}} \stoptext %%%%%%% -- luigi
Am 22.03.10 16:35, schrieb luigi scarso:
\starttext \dorecurse{4}{% \edef\T{\recurselevel} \expandafter\chapter\expandafter{\recurselevel{}Chapter } \section{Section}} \stoptext
\dorecurse{4}{\chapter{#1 Chapter}\section{Section}} or \dorecurse{4}{\expanded{\chapter{\recurselevel{} Chapter}}\section{Section}} Wolfgang
On Mon, Mar 22, 2010 at 4:40 PM, Wolfgang Schuster
Am 22.03.10 16:35, schrieb luigi scarso:
\starttext \dorecurse{4}{% \edef\T{\recurselevel} \expandafter\chapter\expandafter{\recurselevel{}Chapter } \section{Section}} \stoptext
\dorecurse{4}{\chapter{#1 Chapter}\section{Section}} Runaway argument? {\dorecurse {4}{\chapter {##1 Chapter}\section {Section}} \stoptext ! File ended while scanning use of \xdorecurse. <inserted text> \par <*> ./test.tex
or \dorecurse{4}{\expanded{\chapter{\recurselevel{} Chapter}}\section{Section}}
Runaway argument? {\dorecurse {4}{\expanded {\chapter {\recurselevel {} Chapter}}\section \ETC. ! File ended while scanning use of \xdorecurse. <inserted text> \par <*> ./test.tex
-- luigi
\starttext \dorecurse{4}{\chapter{#1 Chapter}\section{Section}} \dorecurse{4}{\expanded{\chapter{\recurselevel{} Chapter}}\section{Section}} \stoptext Wolfgang
On Mon, Mar 22, 2010 at 5:02 PM, Wolfgang Schuster
\starttext
\dorecurse{4}{\chapter{#1 Chapter}\section{Section}}
\dorecurse{4}{\expanded{\chapter{\recurselevel{} Chapter}}\section{Section}}
\stoptext
Wolfgang
aha, now I've seen :'ve put them inside my first \direcurse{4}{%.. BTW mkii and miv are different here. %%%%%%% \showframe \setuppagenumbering[alternative=doublesided,location=footer] \startsetups Header:Left \vbox to \headerheight{\vss \ruledhbox{\centerline{\strut Header:Left \getmarking[chapter][first]}} \vss} \stopsetups \startsetups Header:Right \vbox to \headerheight{\vss \ruledhbox{\centerline{\strut Header:Right \getmarking[chapter][last]}} \vss} \stopsetups \setupheadertexts[\setups{Header:Left}][][][\setups{Header:Right}] \starttext \dorecurse{4}{% \expandafter\chapter\expandafter{\recurselevel{}Chapter } \section{Section} } \dorecurse{4}{\chapter{#1 Chapter}\section{Section}} \dorecurse{4}{\expanded{\chapter{ Chapter (\recurselevel)}}\section{Section}} \stoptext
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- luigi
On Mon, Mar 22, 2010 at 12:58, luigi scarso wrote:
On Mon, Mar 22, 2010 at 12:29 PM, Mojca Miklavec wrote:
I would like to set a different header on left and right page, but I would like it to be centered on page. How do I do that?
I am now hacking with \setupheadertexts[\hbox{\kern-5mm\myheaderright}][][][\hbox{\myheaderleft\kern-5mm}] \def\myheaderright{\hbox to "textwidth+10mm"{...}} but that's a bit ugly.
Mojca
Why don't you use setups ?
I do use setups on the outer level (not on the inner), but that hardly makes a difference (\setups{Header:Left} and \myleftheader are almost equal). \startsetups[header with logo] \doifmodeelse {twosided} {\setupheadertexts [\hbox{\kern-5mm\myheaderright}][] [][\hbox{\myheaderleft\kern-5mm}]} {\setupheadertexts[\myheaderright]} \stopsetups and then another structure full of hboxes, struts & kerns ... but I find it ugly to use explicit kerning just to get the header alignment right. But apparently everyone is hacking with boxes here. That's also OK if there's no better option. Thanks, Mojca
On 22-3-2010 22:04, Mojca Miklavec wrote:
On Mon, Mar 22, 2010 at 12:58, luigi scarso wrote:
On Mon, Mar 22, 2010 at 12:29 PM, Mojca Miklavec wrote:
I would like to set a different header on left and right page, but I would like it to be centered on page. How do I do that?
I am now hacking with \setupheadertexts[\hbox{\kern-5mm\myheaderright}][][][\hbox{\myheaderleft\kern-5mm}] \def\myheaderright{\hbox to "textwidth+10mm"{...}} but that's a bit ugly.
Mojca
Why don't you use setups ?
I do use setups on the outer level (not on the inner), but that hardly makes a difference (\setups{Header:Left} and \myleftheader are almost equal).
\startsetups[header with logo] \doifmodeelse {twosided} {\setupheadertexts [\hbox{\kern-5mm\myheaderright}][] [][\hbox{\myheaderleft\kern-5mm}]} {\setupheadertexts[\myheaderright]} \stopsetups
and then another structure full of hboxes, struts& kerns ... but I find it ugly to use explicit kerning just to get the header alignment right.
But apparently everyone is hacking with boxes here. That's also OK if there's no better option.
\kern0pt should work or else \kern0pt\strut ----------------------------------------------------------------- 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 -----------------------------------------------------------------
Am 22.03.10 12:58, schrieb luigi scarso:
\showframe \setuppagenumbering[alternative=doublesided,location=footer]
\startsetups Header:Left \vbox to \headerheight{\vss \ruledhbox{\centerline{ \getmarking[chapter][first] }} \vss} \stopsetups
\startsetups Header:Right \vbox to \headerheight{\vss \ruledhbox{\centerline{ \getmarking[chapter][first] }} \vss} \stopsetups
\setupheadertexts[\setups{Header:Left}][][\setups{Header:Right}][]
\starttext \dorecurse{4}{\chapter{ch \recurselevel} \section{sec \recurselevel}\page} \stoptext
You can replace the nested boxes with framedtext \showframe \setuppagenumbering[alternative=doublesided,location=footer] \startsetups header:left \startframedtext[frame=off,width=\hsize,height=\vsize,align={middle,middle}] \getmarking[chapter][first] \stopframedtext \stopsetups \startsetups header:right \startframedtext[frame=off,width=\hsize,height=\vsize,align={middle,middle}] \getmarking[chapter][first] \stopframedtext \stopsetups \setupheadertexts[\doifoddpageelse{\setups[header:right]}{\setups[header:left]}] \starttext \dorecurse{4}{\chapter{Chapter #1}\section{Section #1}} \stoptext Wolfgang
Am 23.03.10 07:06, schrieb Wolfgang Schuster:
You can replace the nested boxes with framedtext And another one:
\showframe \setuppagenumbering[alternative=doublesided,location=footer] \setupheader[text][middletext=\strut\doifoddpageelse{\getmarking[section][first]}{\getmarking[section][last]}] \starttext \dorecurse{4} {\chapter{Chapter #1} \dorecurse{3}{\section{Section #1.##1}}} \stoptext Wolfgang
On Tue, Mar 23, 2010 at 11:50 AM, Wolfgang Schuster
Am 23.03.10 07:06, schrieb Wolfgang Schuster:
You can replace the nested boxes with framedtext
And another one:
\showframe
\setuppagenumbering[alternative=doublesided,location=footer]
\setupheader[text][middletext=\strut\doifoddpageelse{\getmarking[section][first]}{\getmarking[section][last]}]
\starttext \dorecurse{4} {\chapter{Chapter #1} \dorecurse{3}{\section{Section #1.##1}}} \stoptext
Wolfgang
different behavior between mkiv and mkii --- what is right ? -- luigi
On Tue, Mar 23, 2010 at 12:00 PM, Wolfgang Schuster
Am 23.03.10 11:55, schrieb luigi scarso:
different behavior between mkiv and mkii --- what is right ?
I think mkiv is right, the left page should contain the header (last section here) unless specified otherwise. I don't know. This is right, for both.
\showframe \setuppagenumbering[alternative=doublesided,location=footer] \setupheader[text][middletext=\strut\doifoddpageelse{\getmarking[section][first]}{\getmarking[section][last]}] \starttext \dorecurse{4} {\chapter{Chapter #1} \dorecurse{3}{\section{Section #1.##1}\input knuth \input tufte }} \stoptext It seem that for mkii a blank page is not part of a chapter --- this is logical: the chapter ends before. For mkiv blank page is part of a chapter --- this is also ok: the chapter ends just before the next chapter. -- luigi
Am 23.03.10 12:11, schrieb luigi scarso:
It seem that for mkii a blank page is not part of a chapter --- this is logical: the chapter ends before. For mkiv blank page is part of a chapter --- this is also ok: the chapter ends just before the next chapter.
This affects only marks and not other header/footer texts, is this now also correct? \showframe \setuppagenumbering[alternative=doublesided,location=footer] \setupheader [text] [lefttext=left, middletext=\strut\doifoddpageelse{\getmarking[section][first]}{\getmarking[section][last]}] \starttext \dorecurse{2} {\chapter{Chapter #1} \dorecurse{3}{\section{Section #1.##1}\input knuth \ifnum#1=2\relax\input tufte \fi}} \stoptext Wolfgang
On Tue, Mar 23, 2010 at 12:19 PM, Wolfgang Schuster
Am 23.03.10 12:11, schrieb luigi scarso:
It seem that for mkii a blank page is not part of a chapter --- this is logical: the chapter ends before. For mkiv blank page is part of a chapter --- this is also ok: the chapter ends just before the next chapter.
This affects only marks and not other header/footer texts, is this now also correct?
\showframe
\setuppagenumbering[alternative=doublesided,location=footer]
\setupheader [text] [lefttext=left,
middletext=\strut\doifoddpageelse{\getmarking[section][first]}{\getmarking[section][last]}]
\starttext \dorecurse{2} {\chapter{Chapter #1} \dorecurse{3}{\section{Section #1.##1}\input knuth \ifnum#1=2\relax\input tufte \fi}} \stoptext No, mkii != mkiv at page 2; mkiv shows 'Section 1.3' at middle and 'left' at the right side, while mkii shows only 'left' at the right side. Now I should say that mkiv is right --- at least it looks more reasonable than mkii .
-- luigi
On Mar 22, 2010, at 12:29 PM, Mojca Miklavec wrote:
Hello,
I would like to set a different header on left and right page, but I would like it to be centered on page. How do I do that?
The command \setupheadertexts[a][b] puts "a b" on one page and "b a" on the other while \setupheadertexts[a][b][c][d] puts "a b" on one page and "c d" on the other. On single-sided layouts I could use \setupheadertexts[a] or \setupheadertexts[][a][] but using 6 parameters on double-sided doesn't work.
I am now hacking with \setupheadertexts[\hbox{\kern-5mm\myheaderright}][][][\hbox{\myheaderleft\kern-5mm}] \def\myheaderright{\hbox to "textwidth+10mm"{...}} but that's a bit ugly.
Mojca
Also see http://wiki.contextgarden.net/Headers_and_Footers#Headers_with_centered_cont... Thomas
Hi, her yet my two cents, May be it is worthwhile to consider a set of setups and using layerframed. This gives to my knowledge the most of flexibility. Willi On 22 Mar 2010, at 12:29, Mojca Miklavec wrote:
Hello,
I would like to set a different header on left and right page, but I would like it to be centered on page. How do I do that?
The command \setupheadertexts[a][b] puts "a b" on one page and "b a" on the other while \setupheadertexts[a][b][c][d] puts "a b" on one page and "c d" on the other. On single-sided layouts I could use \setupheadertexts[a] or \setupheadertexts[][a][] but using 6 parameters on double-sided doesn't work.
I am now hacking with \setupheadertexts[\hbox{\kern-5mm\myheaderright}][][][\hbox {\myheaderleft\kern-5mm}] \def\myheaderright{\hbox to "textwidth+10mm"{...}} but that's a bit ugly.
Mojca ______________________________________________________________________ _____________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ______________________________________________________________________ _____________
participants (6)
-
Hans Hagen
-
luigi scarso
-
Mojca Miklavec
-
Thomas A. Schmitz
-
Willi Egger
-
Wolfgang Schuster