15

I know that the align environment labels all the lines, while the align* environment labels none of the lines. Is there a way to have the align environment label only some of the lines?

For example, suppose I have something like this:

\begin{align}
x+y 
\\
x-y 
\\
xy
\end{align}

This labels all three lines. Is there a way to only label, say, the second line (x-y)?

17

Use the command \notag

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align}
x+y 
\notag\\
x-y 
\\
xy
\end{align}
\end{document}

EDIT: You can also use the command \nonumber (see comment)

EDIT: If you want to tag only one equation you can use \tag. In the following example I combine the command \tag with \refstepcounter to create the command \tabeq

\documentclass{article}
\usepackage{amsmath}
\newcommand*\tageq{\refstepcounter{equation}\tag{\theequation}}
\begin{document}
\begin{align*}
x+y 
\\
x-y \tageq\label{1}
\\
xy
\end{align*}

\ref{1}
\end{document}
  • 2
    For standard LaTeX math environments you can also use \nonumber, but amsmath is recommended which uses \notag. There is also \tag{<label>} which allows you to set any other text instead of the number. – Martin Scharrer Aug 24 '11 at 18:37
  • 1
    You need to \notag the third line as well... – Seamus Aug 24 '11 at 20:41
  • Thanks! This is really useful! One question I still have though is, if I only want to tag one equation out of many, is there a way to do it without using \notag a bunch of times? Is there a way to use \tag in an align* environment but to have it follow the numbering of the document? – Alan C Aug 25 '11 at 4:24
  • @Alan C: I edit my post. – Marco Daniel Aug 25 '11 at 16:13
1
\documentclass{article}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs}
\begin{document}

\begin{align}
 y &= x+y \\
 y &= x-y \label{1} \\
 y &= xy
\end{align}

See Eqn.~\refeq{1} \ldots
\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.