Page LayoutNeed help on line alignment of multi-line headers

Information and discussion about page layout specific issues (e.g. header and footer lines, page formats, page numbers).
Post Reply
benbean
Posts: 6
Joined: Thu Mar 11, 2010 9:40 pm

Need help on line alignment of multi-line headers

Post by benbean »

I am having some difficulty in trying to align my left, centre and right headers with multiple lines. I have had a look through the fancyhdr documentation, google and the forum search but couldn't find the useful information so hopefully someone can offer help here.

Currently in my document I have:

\documentclass[11pt,a4paper]{article}
\usepackage{fancyhdr}
\thispagestyle{fancy}

\lhead{l-line1 \\ l-line2 \\ l-line3 \\ l-line4 \\ l-line5}
\chead{c-line1}
\rhead{r-line1 \\ r-line2 \\ r-line3 \\ r-line4 \\ r-line5 \\ r-line6}

LaTeX aligns each header from the bottom-most line so that the header is flush with the header decorative line.

What I would like in my document is for the top-most line in the header to be \chead{c-line1}, and then on the next line down, l-line1 and r-line1 to be on the same line. And similarly for l-line2 and r-line2, l-line3 and r-line3 etc.
So it would look something like (note the backslashes are to be viewed as empty space):

\\\\\\\ c-line1
l-line1 \\\\\\\ r-line1
l-line2 \\\\\\\ r-line2
l-line3 \\\\\\\ r-line3
l-line4 \\\\\\\ r-line4
l-line5 \\\\\\\ r-line5
\\\\\\\\\\\\\\\\ r-line6
------------------------

Any help is greatly appreciated.
Thank you for reading,
b.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

hesitz
Posts: 12
Joined: Mon Jun 07, 2010 2:32 am

Need help on line alignment of multi-line headers

Post by hesitz »

I'm new to LaTeX, so this might not be the optimal method, but one way is simple to pad the center column as below. The tilde(~} is a hard space that's necessary for the linebreaks to function. Notice I also added a linebreak at end of left header:

Code: Select all

\lhead{l-line1 \\ l-line2 \\ l-line3 \\ l-line4 \\ l-line5\\}
\chead{c-line1\\~\\~\\~\\~\\}
\rhead{r-line1 \\ r-line2 \\ r-line3 \\ r-line4 \\ r-line5 \\ r-line6}
It seems to me using vspace might be a cleaner method, but for some reason the lines don't line up properly when I try to skip an exact number of baselines:

Code: Select all

\lhead{l-line1 \\ l-line2 \\ l-line3 \\ l-line4 \\ l-line5\\}
\chead{c-line1\vspace{5.0\baselineskip}}
\rhead{r-line1 \\ r-line2 \\ r-line3 \\ r-line4 \\ r-line5 \\ r-line6}
Post Reply