# Highlight equations by temporary changing the formatting of their number

I am writing a long paper having 100+ equations, and want to highlight a few key equations. Since the journal won't let me use boxes around equations, I am trying to have their label being typeset differently, e.g. as (5*) instead of (5). This should only affect specific equations. I have been trying to set up a new environment similar to subequations, but without success.

-

## migrated from stackoverflow.comSep 21 '12 at 11:54

This question came from our site for professional and enthusiast programmers.

I finally got what I wanted by (temporarily) redefining the parentheses around the equation numbers to include a star. This also works in other environments such as align

\documentclass{article}
\usepackage{amsmath}
\makeatletter
\newenvironment{highlightequation}{%
\def\tagform@##1{\maketag@@@{(\ignorespaces##1\unskip\@@italiccorr*)}}%
\ignorespaces
}{%
\def\tagform@##1{\maketag@@@{(\ignorespaces##1\unskip\@@italiccorr)}}%
\ignorespacesafterend
}
\makeatother

\begin{document}
A highlighted equation:
\begin{highlightequation}
$$t(s) = r'(s)$$
\end{highlightequation}
A minor equation, needs no highlight:
$$a(s) = b'(s)$$
Highlighting also works amsmath environments, such as align:
\begin{highlightequation}
\begin{subequations}
\begin{align}
t(s) & = r'(s) \\
t(s) & = r'(s)
\end{align}
\end{highlightequation}
\end{subequations}
\end{document}


The result looks like this:

-

You can redefine the equation number printing mechanism \theequation to add the star * using a form of "switching":

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\newcommand{\eqspecialnum}{% Special equation numbering
\renewcommand{\theequation}{\arabic{equation}*}}
\newcommand{\eqnormalnum}{% Regular equation numbering
\renewcommand{\theequation}{\arabic{equation}}}
\begin{document}
Some text.
$$f(x)=ax^2+bx+c \label{eqn:1}$$
Some more text. See \eqref{eqn:3}.
$$f(x)=ax^2+bx+c \label{eqn:2}$$
And then some more text. \eqspecialnum % Switch to special numbering.
$$f(x)=ax^2+bx+c \label{eqn:3}$$
And here is even more text.
$$f(x)=ax^2+bx+c \label{eqn:4}$$
This piece of text is even longer. \eqnormalnum % Switch back to normal.
$$f(x)=ax^2+bx+c \label{eqn:5}$$
The end.
\end{document}


Here \eqspecialnum switches the numbering scheme to have a star * appended to the equation number, while \eqnormalnum returns the default behaviour of the numbering. Referencing accommodates this redefinition, as can be seen in the given example.

-
Many thanks for your answer. This works when the equation number is plain arabic in the rest of the document, but conflicts with packages such as subequations that redefine \theequation. Ideally, the macro \theequation should be stored, reused in combination with a * to produce the number, and then restored. Unfortunately, I did not find a way to implement this. –  user1687113 Sep 21 '12 at 7:34

This is a improved and combines solution of the already existing answers.

Werner’s answer can easily modified to make the new \theequation dependent on the old own by using its definition in

\expandafter\def\expandafter\theequation\expandafter{\theequation*}


Though it would be doable to strip the * in another redefinition of \theequation it is easier to just use the original definition that is stored with \let.

I also have added local variants \stareq and \nostareq that add or remove the * respectively.

Another solution, more along the lines of the OP’s answer is to used mathtools\newtagform and the switch \usetagform (internally it does basically the same with \maketag@@@ but provides a nicer interface). These tagform-changing solutions have the disadvantage of having to repeat ( and ) (which may be changed according to a different style).
The \stareq variant will still work, the \nostareq unfortunately won’t.

## Code

\documentclass{article}
\usepackage{mathtools}
\let\origTheequation\theequation                                       % Solution 1
\newtagform{starred}{(}{*)}                                            % Solution 2

\newcommand{\eqspecialnum}{% Switch to starred version
\let\origTheequation\theequation                                   % Solution 1
\expandafter\def\expandafter\theequation\expandafter{\theequation*}% Solution 1
%   \usetagform{starred}%                                                Solution 2
}
\newcommand{\eqnormalnum}{% Switch to normal version
\let\theequation\origTheequation                                   % Solution 1
%   \usetagform{default}%                                                Solution 2
}
\newcommand*{\stareq}{\stepcounter{equation}\tag{\theequation*}}       % Solution 1 and 2
\newcommand*{\nostareq}{\stepcounter{equation}\tag{\origTheequation}}  % Solution 1 only
\begin{document}
$$f(x)=ax^2+bx+c$$
See \eqref{eqn:3} and \eqref{eqn:4}.
$$f(x)=ax^2+bx+c$$
Switch to special numbering: \eqspecialnum % Switch to special numbering.
\begin{align}
f(x) & =ax^2+bx+c \label{eqn:3} \\
f(x) & =ax^2+bx+c \label{eqn:4}
\end{align}
$$f(x)=ax^2+bx+c$$
Switch back to normal:       \eqnormalnum
$$f(x)=ax^2+bx+c$$
$$f(x)=ax^2+bx+c$$\stareq
$$f(x)=ax^2+bx+c$$

Switch to special numbering: \eqspecialnum % Switch to special numbering.
\begin{align}
f(x) & =ax^2+bx+c \\
f(x) & =ax^2+bx+c \nostareq
\end{align}
$$f(x)=ax^2+bx+c$$
Switch back to normal:       \eqnormalnum
\end{document}


-