[Tex/LaTex] Spacing between lhead and rhead content while wrapping

fancyhdrheader-footer

I am having troubles with wrapped text in the header.

At the moment it looks like this:
two muppets

And this is how I would like it to look like:
two muppets

This is my code:

\documentclass[12pt,a4paper]{article}

\usepackage{titling}  
\usepackage{geometry} 
\usepackage{fancyhdr}

\geometry{a4paper, left=30mm,right=20mm, top=25mm, bottom=20mm}

\setlength{\headheight}{12.7mm}
\pagestyle{fancy}
\fancyhf{}
\lhead{\textbf{\thetitle}}
\rhead{\textit{\thepage}}

\title{This is a really long title which takes lot of space in header, so it is wrapped over to the next line.}

\begin{document}
\end{document}

Basically I need some spacing between lhead and rhead content, no matter if lhead content will be wrapped into multiline.

Best Answer

The headers in a document are for orientation of the reader. The might want to know, in which part of a document he is (where the duck am i?).

So a header should not be very long, you can give shorter names for the table of contents and the header with \chapter[short title for toc and head]{long title which can, but shall not, confuse the reader by using many many words}. If you want to (have to) stick with a long header, you can use a minipage.

kreideHeaderMinipage

\documentclass[12pt,a4paper]{article}

\usepackage{titling}  
\usepackage{geometry} 
\usepackage{fancyhdr}
\usepackage{blindtext}

\geometry{a4paper, left=30mm,right=20mm, top=25mm, bottom=20mm}

\setlength{\headheight}{12.7mm}
\pagestyle{fancy}
\fancyhf{}
\lhead{\minipage[b]{.8\linewidth}\textbf{\thetitle}\endminipage}
\rhead{\textit{\thepage}}

\title{This is a really long title which takes lot of space in
header, so it is wrapped over to the next line.}

\begin{document}
\maketitle
\blinddocument
\end{document}

With the optional argument, you can change the alignment of the minipage in respect to the rest of the line (where the page number rests).