There is a strange inconsistency between \overbrace
and \underbrace
when one wishes to have the associated text (above or below) in a different color.
\underbrace
behaves as expected and \overbrace
does not -- both the text below the brace and above are changed by the color command, not just the raised text. To try to fix a \color{black}
is required inside the {}
for the lower text. However, the brace remains red. Is this an error in xcolor
?
\documentclass[a4paper,12pt,oneside,pdftex]{article}
\usepackage{amsmath}
\usepackage[dvipsnames]{xcolor}
\begin{document}
$$\underbrace{x}_{\color{red} \sin t} \overbrace{x}^{\color{red} \sin t} \quad \overbrace{\color{black}x}^{\color{red} \sin t} $$
\end{document}
$$
in a LaTeX document to initiate and terminate display math mode; instead, use\[
and\]
. For more information on this issue, please see Why is\[ ... \]
preferable to$$ ... $$
?