Text FormattingUnderbrace color

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
pisoir
Posts: 8
Joined: Thu Aug 06, 2009 4:10 pm

Underbrace color

Post by pisoir »

Hello, is it possible to change the color of underbrace only? I have an equation that is in normal black color, and I underbrace some part of it. However, I want to have the underbrace in light gray color. Is is somehow possible to change the color only of the brace and not the text? Thank you.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Underbrace color

Post by frabjous »

You could just turn the color back to black inside the brace, e.g.:

Code: Select all

\documentclass{article}
\usepackage{xcolor}
\begin{document}
$\textcolor[gray]{0.8}{\underbrace{\textcolor{black}{this~is~black}}_{\textcolor{black}{this~too}}}$ 
\end{document}
pisoir
Posts: 8
Joined: Thu Aug 06, 2009 4:10 pm

Re: Underbrace color

Post by pisoir »

Thank you. That's what I actually did it the meantime. Here is my macro:

\newcommand{\ubcolor}[2]{\color{#1}{\underbrace{\color{black}{#2}}}}

Thanks anyway.
Post Reply