2

Often I have a chain of equations but later on I only want to refer that the first statement is equal to the last one. There are some options to do that:

\begin{align}
  \label{equation}
      a    
  &=  b \\ 
  &=  c \\
  &=  d \\
  &=  e \\
  &=  f
\end{align}
Equation~\eqref{equation} gives $a=f$.

\begin{align}
      a    \label{equation_first}
  &=  b \\ 
  &=  c \\
  &=  d \\
  &=  e \\
  &=  f    \label{equation_last}
\end{align}
Equation~\eqref{equation_first}--\eqref{equation_last} gives $a=f$.

\newcommand\numberthis{\addtocounter{equation}{1}\tag{\theequation}}
\begin{align*}
      a    
  &=  b \\ 
  &=  c \\
  &=  d \\
  &=  e \\
  &=  f    \numberthis \label{equation2}
\end{align*}
Equation~\eqref{equation2} gives $a=f$.

\begin{equation}
  \label{equation_split}
  \begin{split}
        a    
    &=  b \\ 
    &=  c \\
    &=  d \\
    &=  e \\
    &=  f 
  \end{split}
\end{equation}
Equation~\eqref{equation_split} gives $a=f$.

My four options

  • The first one is just bad, as (2)--(5) are displayed, but not included in the reference.
  • The second one is more or less okay, but after all it is one equation while it looks like I need six equations.
  • The third one is a hack I found here (alternativly I could have used align* and lots of nonumbers). This version is okay, but does not look that good. Sure, I could put the tag on the center line, but that‘s manual work (I have to (not forget to) redo that stuff after adding some lines) and there is not always a center line.
  • The fourth option looks quite good. However, I pretty much always used align[*] up to now. Are there any problems with equation+split?

How do you tag multi line equations? Why?

  • 2
    There are no problems with equation+split and this is absolutely the right way do go here. Split is just an aligning environment which automatically sets the single label to where you want it: to the centre. – LaRiFaRi Jun 11 '15 at 13:49
  • @LaRiFaRi: Ah, perfect. I will use that option then. :) – Keba Jun 11 '15 at 14:00
  • @LaRiFaRi -- although "center tags" is the default for split, it's also possible to specify that the tag is to go at the bottom (for tags on the right) or the top (for tags on the left) with the option tbtags. – barbara beeton Jun 11 '15 at 14:03
  • @barbarabeeton thanks, did not know that. I added some links for comparison between split and aligned below. – LaRiFaRi Jun 11 '15 at 14:29
4

You could use the aligned environment:

\documentclass[10pt]{article}
\usepackage{amsmath}
\usepackage{hyperref}
\begin{document}
\begin{equation}
    \begin{aligned}
    a &= b\\
      &= c\\
      &= d\\
      &= e\\
      &= f
      \label{eq:EqAligned}
    \end{aligned}
\end{equation}
Equation \ref{eq:EqAligned}...
\end{document}

It centers the number vertically even if the number of equations is even, and the reference works fine.

  • Thanks for your answer, but please explain the difference (and advantages/disadvantages) to my fourth option, thanks. – Keba Jun 11 '15 at 14:05
  • I'm not an expert of Latex, and I've never used the split environment, but aligned worked always fine so far. I've found this question, if you're interested: tex.stackexchange.com/questions/187938/… – MarcoG Jun 11 '15 at 14:12
  • @Keba tex.stackexchange.com/q/187938 and tex.stackexchange.com/q/63929. In your case, split results in more vertical space above and below the math part. And the centering is handled a bit different. Hardly visible here, but you may want to check for bigger math lines. – LaRiFaRi Jun 11 '15 at 14:27
  • 1
    @MarcoG Welcome to TeX.SX! Thank you for answering here and for participating in this community. – LaRiFaRi Jun 11 '15 at 14:30

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.