Difference between revisions of "Headers and Footers"
Jump to navigation
Jump to search
(Deleted stuff that should go in the sandbox) |
|||
Line 1: | Line 1: | ||
+ | Headers with centered content | ||
+ | ConTeXt offers the possibility to have mirrored headers (for odd and even pages); content can be in two parts, at the inner and outer margin of each page. But how do you get a header that will have one part of its content centered and one part in the outer margin? (This is a common setup for books: chapter title centered, page number in outer margin.) Hans posted this solution to the list: | ||
+ | |||
+ | <texcode> | ||
+ | \setuppagenumbering[alternative=doublesided] | ||
+ | |||
+ | \setupheadertexts[] | ||
+ | \setupheadertexts[\setups{text a}][][][\setups{text b}] | ||
+ | |||
+ | \startsetups[text a] | ||
+ | \rlap{\pagenumber} | ||
+ | \hfill | ||
+ | \getmarking[chapter] | ||
+ | \hfill | ||
+ | \llap{whatever} | ||
+ | \stopsetups | ||
+ | |||
+ | \startsetups[text b] | ||
+ | \rlap{whatever} | ||
+ | \hfill | ||
+ | \getmarking[section] | ||
+ | \hfill | ||
+ | \llap{\pagenumber} | ||
+ | \stopsetups | ||
+ | |||
+ | </texcode> | ||
+ | |||
+ | The use of the TeX primitive rlap and llap allows centering of content. |
Revision as of 22:29, 30 January 2005
Headers with centered content
ConTeXt offers the possibility to have mirrored headers (for odd and even pages); content can be in two parts, at the inner and outer margin of each page. But how do you get a header that will have one part of its content centered and one part in the outer margin? (This is a common setup for books: chapter title centered, page number in outer margin.) Hans posted this solution to the list:
\setuppagenumbering[alternative=doublesided] \setupheadertexts[] \setupheadertexts[\setups{text a}][][][\setups{text b}] \startsetups[text a] \rlap{\pagenumber} \hfill \getmarking[chapter] \hfill \llap{whatever} \stopsetups \startsetups[text b] \rlap{whatever} \hfill \getmarking[section] \hfill \llap{\pagenumber} \stopsetups
The use of the TeX primitive rlap and llap allows centering of content.