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 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.

share|improve this question

migrated from stackoverflow.com Sep 21 '12 at 11:54

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

add comment

3 Answers 3

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}
\begin{equation}
    t(s) = r'(s)
\end{equation}
\end{highlightequation}
A minor equation, needs no highlight:
\begin{equation}
    a(s) = b'(s)
\end{equation}
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:

result of compilation

share|improve this answer
add comment

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

enter image description here

\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.
\begin{equation} f(x)=ax^2+bx+c \label{eqn:1}\end{equation}
Some more text. See \eqref{eqn:3}.
\begin{equation} f(x)=ax^2+bx+c \label{eqn:2}\end{equation}
And then some more text. \eqspecialnum % Switch to special numbering.
\begin{equation} f(x)=ax^2+bx+c \label{eqn:3}\end{equation}
And here is even more text.
\begin{equation} f(x)=ax^2+bx+c \label{eqn:4}\end{equation}
This piece of text is even longer. \eqnormalnum % Switch back to normal.
\begin{equation} f(x)=ax^2+bx+c \label{eqn:5}\end{equation}
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.

share|improve this answer
1  
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
add comment

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}
\begin{equation} f(x)=ax^2+bx+c \end{equation}
See \eqref{eqn:3} and \eqref{eqn:4}.
\begin{equation} f(x)=ax^2+bx+c \end{equation}
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}
\begin{equation} f(x)=ax^2+bx+c \end{equation}
Switch back to normal:       \eqnormalnum 
\begin{equation} f(x)=ax^2+bx+c \end{equation}
\begin{equation} f(x)=ax^2+bx+c \stareq \end{equation}
\begin{equation} f(x)=ax^2+bx+c \end{equation}

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}
\begin{equation} f(x)=ax^2+bx+c \end{equation}
Switch back to normal:       \eqnormalnum 
\end{document}

Output

enter image description here

share|improve this answer
add comment

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.