Headers and Footers

From Wiki
Revision as of 22:29, 30 January 2005 by Thomas (talk | contribs)
Jump to navigation Jump to search

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.