[Tex/LaTex] colored equation numbers with breqn package

breqncolorequationsnumbering

I was experimenting with the use of breqn for a few unwieldy formulas, but wonder how to maintain the equation number coloring I'd been using, based on the following questions:

Changing the appearance of equation numbers with amsmath

Coloured equation number (without changing colour of reference using hyperref)

The following sample shows the color'ing commands that I used based on answer text in the links above (which I don't understand, so am not able to modify)

\documentclass[12pt]{scrreprt}
\usepackage{amsmath}
\usepackage[svgnames]{xcolor}
\usepackage{hyperref}
\hypersetup{colorlinks=true}
\usepackage{breqn}

\makeatletter
\let\mytagform@=\tagform@
\def\tagform@#1{\maketag@@@{\color{Red}(#1)}}
\makeatother

\begin{document}

\begin{dmath}
s = 1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17
+18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33
+34 +35 +36 +37 +38 +39 +40
\end{dmath}

\begin{equation}
a
=
b + c
\end{equation}

\end{document}

producing the following

red color on equation.  default color on dmath

I see in the breqn docs that there is a \eqnumcolor variable, but am not sure how to use it for this purpose?

Best Answer

You can use \renewcommand in the preamble to change it:

\renewcommand{\eqnumcolor}{\color{red}}

enter image description here

Code:

\documentclass[12pt]{scrreprt}
\usepackage{amsmath}
\usepackage[svgnames]{xcolor}
\usepackage{hyperref}
\hypersetup{colorlinks=true}
\usepackage{breqn}

\makeatletter
\let\mytagform@=\tagform@
\def\tagform@#1{\maketag@@@{\color{Red}(#1)}}
\makeatother

\renewcommand{\eqnumcolor}{\color{red}}

\begin{document}

\begin{dmath}
s = 1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17
+18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 +31 +32 +33
+34 +35 +36 +37 +38 +39 +40
\end{dmath}

\begin{equation}
a
=
b + c
\end{equation}
\end{document}
Related Question