I am having troubles with wrapped text in the header.

At the moment it looks like this:

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

This is my code:

\documentclass[12pt,a4paper]{article}

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

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

\pagestyle{fancy}
\fancyhf{}

\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.

• Hi and welcome, the header is for orientation of the reader (where the duck am i?). Give it a shorter title for the header, you can do \chapter[short title for toc and head]{long title which can, but shall not, confuse the reader by using many words} for example. – Johannes_B Dec 7 '14 at 14:42
• by the way, very good example. Thanks for that. – Johannes_B Dec 7 '14 at 14:43
• Try \lhead{\minipage[t]{.8\linewidth}\textbf{\thetitle}\endminipage}. You can change the alignment by changing [t] to [b]. – Johannes_B Dec 7 '14 at 14:45
• @Johannes_B Unfortunately I am not allowed to shorten the title. But your last suggestion works like a charm. I would mark it as right answer, if it would not be a plain comment to my question. Anyway, thank you very much, you saved me a lot of time. – zunder Dec 7 '14 at 14:53
• I recommend to use option includefoot for the first page (if your page number is at the bottom). – Johannes_B Dec 7 '14 at 15:00

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.

\documentclass[12pt,a4paper]{article}

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

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

\pagestyle{fancy}
\fancyhf{}

\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).