[Tex/LaTex] page header logo overlapping page header text

fancyhdrheader-footerlogos

I am using the following LaTeX source to place a logo into page header:

\pagestyle{fancy}
\chead{\includegraphics[width=1.5cm,keepaspectratio]{./docs/log4cplus}}
\setlength{\headheight}{47.0pt}
\addtolength{\topmargin}{-4\baselineskip}

Unfortunately, when the text is long, it overlaps the logo:

overlapping text/logo

Can I fix this by raising the logo a little bit or by inserting some vertical white space on pages where the header text is too long/overlaps?

Best Answer

As mentioned in my comment, shift up the graphic with a \raisebox.

\documentclass{article}
\usepackage{fancyhdr}
\usepackage[demo]{graphicx}
\pagestyle{fancy}
\chead{\raisebox{\baselineskip}{%
  \includegraphics[width=1.5cm,height=1.5cm,keepaspectratio]{./docs/log4cplus}}}
\setlength{\headheight}{47.0pt}
\addtolength{\topmargin}{-4\baselineskip}
\begin{document}
\section{A very long header, very long indeed}
My section text
\end{document}

enter image description here