6

How use "align" but with numeration of just some equation ? For example,

\begin{align}

f(x)&=P(x)\\

&= Q(x)\\

&=R(x)

\end{align}

will numerate all equation. How can I do if I want to numerate only the second equation for example ? I tried

\begin{align*}

f(x)&=P(x)\\

&= Q(x)\tag{2}\\

&=R(x)

\end{align*}

but I would like to numerote it in a coherent way with previous numerotation, i.e. if the previous equation is numeroted with (6) I want to give automatically the number (7). Is it possible ?

  • 5
    What about of \nonumber in the same line of the equation that should not be numbered ;-) – user31729 Dec 27 '17 at 10:46
  • 4
    Remember: Blank lines are not allowed in the environments of the amsmath package. – Mico Dec 27 '17 at 10:55
  • 1
    @ChristianHupfer -- with amsmath, \notag is equivalent to \nonumber. – barbara beeton Dec 27 '17 at 14:27
  • 1
    @barbarabeeton: But the O.P. does not use \notag neither ;-) And I think it is a clear duplicate – user31729 Dec 27 '17 at 15:44
6

When using align or similar environments, \nonumber suppresses numbering of the given line. You only need \tag if you need special labelling.

Sample output

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{align}
  f(x)&=P(x) \nonumber \\
      &=Q(x) \label{eq:2} \\
      &=R(x) \nonumber \\
      &=S(x) \tag{S}\label{eq:S} \\
      &=T(x) \nonumber
\end{align}

Refer to \eqref{eq:2} and \eqref{eq:S}

\end{document}
  • That was what I was looking for. (+1) and thanks a lot :-) – Surb Dec 27 '17 at 14:14
3

This does what you want:

\begin{equation}
\begin{aligned}
f(x)&=P(x)\\
&= Q(x)\\
&=R(x)
\end{aligned}
\end{equation}

The equation number is vertically centred by default. You can have it at the top or at the bottom with the options [t] or [b].

  • I think the OP wants this without the \tag{2} so gets the automatic number – David Carlisle Dec 27 '17 at 10:55
  • Yes, @DavidCarlisle is right. I don't want to have \tag{2} to have a coherent number with previous numerotations. – Surb Dec 27 '17 at 11:01
  • I tried it work (except replace \tag by \label – Surb Dec 27 '17 at 11:02
  • @Surb: Yes, I copied your code to start with, and forgot to remove \tag{2}. I've fixed it. – Bernard Dec 27 '17 at 11:04
  • 1
    @Surb: You also have the possibility to nest all this in the subequations environment which will number lines as (7a), (7b), &c., with always the possibility to use \nonumber (or \notag) for specific lines. – Bernard Dec 27 '17 at 12:08
2

I would choose the path of Andrew swann, but instead of removing numbers in align I would add numbers to align* this has already been shown, and here I cite the answer from align* but show one equation number at the end :

Use \tag:

\documentclass{article}
\usepackage{amsmath}
\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\begin{document}
\begin{align*}
    a &=b \\
    &=c \numberthis \label{eqn}
\end{align*}
Equation \eqref{eqn} shows that $a=c$.
\begin{equation}
    d = e
\end{equation}
\end{document}

See page 3 of the amsmath package >documentation for details.

This answer was given by Ian Thompson

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.