Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Greetings,

I'm using the following settings for fancyhdr in a two-page book-derived documentclass:

\pagestyle{fancy}
\fancyhf{}
\fancyhead[LO]{\sffamily \footnotesize \rightmark}
\fancyhead[RE]{\sffamily \footnotesize \leftmark}
\fancyfoot[LO]{\footnotesize \thepage~{\color{red}\vline}}
\fancyfoot[RE]{\footnotesize {\color{red}\vline}~\thepage}
\fancyfootoffset{0.5cm}
\fancypagestyle{plain} {
 \fancyhf{} % get rid of headers on plain pages
 \renewcommand{\headrulewidth}{0pt} % and the line
 \renewcommand{\footrulewidth}{0pt} % and the line
}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}

But, somehow, the page number on even pages gets slightly below those on odd...

Help? :)

share|improve this question

2 Answers 2

up vote 3 down vote accepted

I'm not quite sure the reason for your problem, but it goes away if I change to \textcolor{red}{\vline} instead of {\color{red}\vline}.

share|improve this answer

This is a known problem: \color doesn't switch to horizontal mode (it doesn't "start a line"). So if you are in vertical mode (as you are e.g. at the start of a \parbox) the following text which starts horizontal mode is forced on a new line. You get this effect e.g. in \parbox or in p-cells of a tabular. The solution is either to use \textcolor as already suggested or to quite vmode before the color command.

\documentclass{article}
\usepackage{xcolor}
\begin{document}
xxx
\parbox[t]{1cm}{abc}
\parbox[t]{1cm}{\color{red}abc}
\parbox[t]{1cm}{\leavevmode\color{blue}abc}
\end{document} 
share|improve this answer

Your Answer

 
discard

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.