TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using fancyhdrpackage for headings and footers. I have defined left-header as a big image, and I want to vertically align (to the top or to the center, the default is to the bottom) the text from the right-header. How can I do that?


\rhead{I want to vertically align THIS text}
share|improve this question



\rhead{I want to vertically align THIS text}


And don't ignore the warning of fancyhdr:

Package Fancyhdr Warning: \headheight is too small (12.0pt): 
 Make it at least 59.75078pt.

Use \headheight=22mm or something like this.

share|improve this answer
Nice idea... but unfortunately it doesn't work correctly. As I understand, I should use -1 for top-aligned, and -0.5 for center-aligned. Well, the raisebox seems to be off by 1em. (and sorry for the LONG delay before testing this) – Denilson Sá Oct 1 '10 at 22:18
Well it does work for me, I tested it. So something is different on your side: Either you changed the code or the graphic (which I don't have) inserts some border. Also I don't know what you mean by "off by 1em". "Off" relative to what? – Ulrike Fischer Oct 11 '10 at 11:31

I got a solution. It's a very ugly hack, but it works in my case (because I know in advance the height of the header).

\rhead{\parbox[b][21mm][t]{0.5\textwidth}{\raggedleft I want to vertically align THIS text}}

I'm accepting better solutions. :)

share|improve this answer

I think the problem is that in fancyhdr there is no easy way to communicate the width of a box in the left header to the right header. You could allocate a dimen register, place the width of the box in the left header into it, and use it in the right header, but I think much easier solution is to just place everything into the same header:

\lhead{\hbox to \hsize{%
       \hbox{\vtop{\vskip 0pt \hbox{\includegraphics[height=21mm]{some-fancy-logo.pdf}}}}%
       \hfill\hbox{\vtop{\vskip 0pt \hbox{I want to vertically align THIS text}}}}}

You probably don't even need fancyhdr.

share|improve this answer
Geez... What does all of that mean? Care to add a small description of what's going on there, in plain English? – Denilson Sá Aug 28 '10 at 4:55
Rather that trying to explain it clumsily myself, I will point you yo an excellent explanation by Victor Eijkhout in his TeX by Topics, at eijkhout.net/texbytopic/texbytopic.html. You want to look at the chapter on Boxes. – Jan Hlavacek Aug 28 '10 at 14:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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