Difference between revisions of "Headers and Footers"

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]

\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 macros rlap and llap allows centering of content.

Using capitals

In the previous example, the chapter title and the section title were fetched with the macro \getmarking which wraps around \fetchmark. However, in case you need a raw version of the mark, say for instance to put it uppercase, you may use this setup instead:

```
\startsetups[text a]
\rlap{\pagenumber}
\hfill
\expanded{\uppercase{\fetchmark[chapter][first}}
\hfill
\llap{whatever}
\stopsetups

\startsetups[text b]
\rlap{whatever}
\hfill
\expanded{\uppercase{\fetchmark[section][first}}
\hfill
\llap{\pagenumber}
\stopsetups

```

You can replace \uppercase by \WORD and so on.