4

I can't seem to be able to align our logo and page number in the footer. I have the code below:

\pagestyle{fancy} % enable fancy page style
\renewcommand\headrulewidth{0pt}
\renewcommand\footrulewidth{0pt}
\fancyhf{} % clear header and footer
\fancyhead[L]{\leftmark} % leftmark shows the chapter, rightmark shows the section.
\fancyfoot[C]{\thepage}
\fancyfoot[R]{ % right
   \includegraphics[scale=0.5]{general_images/logo.png}
}

How can I align the page number and the logo? Any ideas?

doncherry
  • 54,637
Dimitris
  • 495
  • 1
  • 6
  • 10
  • 2
    Please provide a full minimal working example (MWE) that illustrates your problem. – N.N. Sep 29 '11 at 09:31
  • 1
    You want them aligned how? We can't see your logo image. How big is the logo? Should the bottom of the logo align with the baseline of the text? Should the top of the logo align with the baseline plus the ex height? Explain what you want. "align" is pretty vague... – Seamus Sep 29 '11 at 09:36
  • 1
    If I'm understanding your question correctly, there's another question asking about the same thing: http://tex.stackexchange.com/questions/2440/how-to-vertically-align-headers-footers-in-fancyhdr-package. Please let us know if that solves your problem. If so, we'll probably close this question as a duplicate. – doncherry Sep 29 '11 at 15:27
  • 1
    @doncherry: Now I see your link--yes, very similar question. If the answer here (with calculation for different alignment) would be a bit more useful, we might mark the other existing question as duplicate instead. – Stefan Kottwitz Sep 29 '11 at 15:49

1 Answers1

3

With \includegraphics, the base line for alignment is at the bottom. You could use \raisebox to raise or to lower the image. The calc package can help in calculating if required. For example for top alignment

\usepackage{calc}
\fancyfoot[R]{
  \raisebox{1.2ex-\height}{\includegraphics{logo.png}}}

or with more calculation

\usepackage{calc}
\newlength{\myheight}
\fancyfoot[R]{
  \settoheight{\myheight}{\thepage}
  \raisebox{\myheight-\height}{\includegraphics{logo.png}}}

or for middle alignment instead

\raisebox{.5\myheight-.5\height}{\includegraphics{logo.png}}
Stefan Kottwitz
  • 231,401