## LaTeX forum ⇒ Text Formatting ⇒ Two line header, one line spanning columns Topic is solved

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Singularity
Posts: 155
Joined: Sat Jan 22, 2011 9:55 pm

### Two line header, one line spanning columns

I would like to create a two line header on each page, but one of the lines should be centered and span columns. Something like this

Name: _______________ Date: ____
Test 1: Ch 1.6 thorugh 3.4

Or I might want the "Test.." line on top and then the name (but that's minor).

I've tried various solutions, including this
\documentclass[addpoints]{exam} \pagestyle{headandfoot}\lhead{\makebox[.5\textwidth][l]{Name:\enspace\hrulefill}}\chead{\hspace{1ex} \\ Test 1: Ch 1.5 thorugh 3.4}\rhead{\makebox[.25\textwidth]{Date:\enspace\hrulefill}} \footrule\lfoot{Test 1: Ch 1.5 through 3.4}\cfoot{}\rfoot{Page \thepage\ of \numpages} \begin{document}question 1 \\ question 1 \\ question 3 \\ etc.\vdots\end{document}

But the title line is overwriting the blank space for name.

Adding "\extraheadheight" didn't make a difference, and I could not find antying in the fancyhdr package to help. Did I stump LaTeX?

Tags:

Johannes_B
Site Moderator
Posts: 4116
Joined: Thu Nov 01, 2012 4:08 pm
Something like this?

\documentclass[addpoints]{exam} \newcommand{\examNo}{Test 1: Ch 1.5 thorugh 3.4} \extraheadheight{\baselineskip}\pagestyle{headandfoot}\firstpageheader{%\makebox[.5\textwidth][l]{Name:\enspace\hrulefill}\\}{%~\\ \examNo}{%\makebox[.25\textwidth]{Date:\enspace\hrulefill}\\%}\firstpageheadrule \footrule\lfoot{\examNo}\cfoot{}\rfoot{Page \thepage\ of \numpages} \begin{document}\begin{questions}\question A question \question Another question\end{questions}\end{document}

Best regards
Johanns
The smart way: Calm down and take a deep breath, read posts and provided links attentively, try to understand and ask if necessary.