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.

I need to have fews equations aligned by =. These equations are to be displayed in particular color but not the equation numbers.

a = {1,2},            (1)
b = {4,8},            (2)

The two equations above appear in particular color (say red) but the equation numbers in paranthesis are to appear in default color. I tried the following code:

\textcolor{red}{
\begin{align}
 a \; & = \; \left\{1,2\right\}, \\
 b \; & = \; \left\{4,8\right\},
\end{align}
}

But this makes equation numbers also appear in red. And, when I use \textcolor inside align block, it generates error.

Can anyone suggest how can I get the desired formatting.

share|improve this question

1 Answer 1

up vote 4 down vote accepted
\documentclass{article}
\usepackage{amsmath,xcolor}
\makeatletter
\renewcommand\tagform@[1]{%
   \maketag@@@{\normalcolor\ignorespaces(#1)\unskip\@@italiccorr}}
\makeatother
\begin{document}

{\color{red}
\begin{align}
 a  & =  \left\{1,2\right\}, \\
 b  & =  \left\{4,8\right\},
\end{align}
}

\end{document}

enter image description here

share|improve this answer
    
\normalcolor has been in the definition of \tagform@ (in amsmath) for years, but clearly it's in the wrong place. i've entered a bug report. and while you're at it, might as well add \normalsize to keep tags the same size even if the content of the display is made smaller or larger. (tags look better at uniform size; this request was made long ago by ams copyeditors.) –  barbara beeton Aug 16 '11 at 13:24
    
Thanks a lot @Herbert. –  jitendra Aug 16 '11 at 21:44

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.