4

In LaTeX the fancyhdr package provides the lhead, chead and rhead macros that allow me to create the left, center and right parts of the header. These macros also enable me to treat each part of the header as a column. For example the following MWE:

\documentclass{article}

\usepackage{fancyhdr}
\pagestyle{fancy}

\lhead{\textbf{A\\ B}}
\chead{\textbf{C\\ D}}
\rhead{\textbf{E}}

\begin{document}

Some Text

\end{document}

Produces the following document: MWE

Notice how A and B are stacked on top of each other.

How can I achieve this in ConTeXt?

8

See \setupheadertexts on the ConTeXt wiki and the ConTeXt user manual.

Also see the header and footer section on the ConTeXt wiki.

% The default header is bigger, and by default, the header is top aligned.
% So change the header size
\setuplayout
  [header=2\lineheight,
   headerdistance=\lineheight]

% By default, no frames are drawn around the header.
% Change that to draw a rule at the bottom of the header.
\setupbackgrounds[header][text][frame=off, bottomframe=on]

% Set the headers in bold.
\setupheader[style=bold]

% By default, the header is a \hbox. We define a dedicated \vbox to 
% place multiple lines in the header.
\defineframed[headerframed]
             [frame=off,
              align=middle,
              width=fit]

\setupheadertexts[\headerframed{C \\ D}]
\setupheadertexts[\headerframed{A \\ B}][\headerframed{E \\ F}]

\starttext
\input knuth
\stoptext

which gives

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.