When modifying my answer to this question I came across some odd behaviour.
If \color{<color>}
is used at the start of a top-aligned \parbox
, then the entire box is moved downwards, like this:
\documentclass{article}
\usepackage{xcolor}
\begin{document}
Word
\framebox{\parbox[t]{1cm}{word}} %% <- this is fine
\framebox{\parbox[t]{1cm}{\textcolor{blue}{word}}} %% <- this is fine
\framebox{\parbox[t]{1cm}{\color{blue}word}} %% <- ??
\framebox{\parbox[t]{1cm}{\hskip0pt\color{blue}word}} %% <- this is fine
\framebox{\parbox[t]{1cm}{\leavevmode\color{blue}word}} %% <- this is fine
\framebox{\parbox[t]{1cm}{$\displaystyle\int$}} %% <- this is fine
\framebox{\parbox[t]{1cm}{\color{blue}$\displaystyle\int$}} %% <- ??
\end{document}
(The \framebox
es are just there to show the locations/sizes of the \parbox
es.)
Can someone tell me why this happens (and how I can best avoid it)?
texdoc grfguide