1

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?

  • Modify the \includegraphics[]{} to be \raisebox{\baselineskip}{\includegraphics[width=1.5cm,keepaspectratio]{./docs/log4cplus}}}, which will move the graphic up one line space. – Steven B. Segletes Feb 10 '14 at 15:10
2

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.