1

Up to now, I use the align environment. As I want to give each equation a specific reference number, I want to use the equation environment. So I tried this, which works for align:

\begin{equation}
x &=2 \\
&=1+1
\end{equation}

But this throws errors. Why doesn't it work?

Of course, I've searched for similar questions but there was no question out there, that handles specific this issue. (It was always very complex code; no minimal example)

4
  • 2
    equation cannot be split accross lines by design. That is why we have align and others, for example split. Why do you want to go to equation?
    – Johannes_B
    Oct 16, 2016 at 13:54
  • align number each line of equations! you should make effort to skip this nubering, so I do not understand your question
    – Zarko
    Oct 16, 2016 at 13:54
  • If you want only one number for the whole thing I would suggest sticking \nonumber at the end of lines you don't want numbered. There may also be a way to use align* and tell LaTeX to make an exception for the lines you want numbered.
    – Sean Lake
    Oct 16, 2016 at 13:56
  • 2
    within equation you could use the split environment, which aligns the = signs but results in only one number. see that amsmath documentation: texdoc amsmath. Oct 16, 2016 at 14:13

1 Answer 1

7

OK, the answer is trivial and has already been given in the comments, but since you insist on asking for a minimal working example (boldfaced :-), here it is:

\documentclass[a4paper]{article}
\usepackage{amsmath}

\begin{document}
Text before the equation.
\begin{equation}
    \begin{split}
        x &= 2 \\
          &= 1+1
    \end{split}
    \label{eq:x=2=1+1}
\end{equation}
Text after equation~\eqref{eq:x=2=1+1}, with a reference to the equation itself.
\end{document}
5
  • I cannot understand why this trivial answer got so many upvotes (or rather, any upvote at all! :-)
    – GuM
    Oct 16, 2016 at 19:22
  • If you insist, I can downvote… ;o)
    – Bernard
    Oct 16, 2016 at 20:12
  • @Bernard: Well, I guess that, after all, this is sort of a compensation for other situations in which you write a pretty deep answer to some though question, and you get just one upvote… ;-)
    – GuM
    Oct 16, 2016 at 22:54
  • This has been reported by many. The simple and obvious solutions get upvotes. If you want to gain rep quickly, don't spend more than five minutes on an answer.
    – Johannes_B
    Oct 17, 2016 at 16:47
  • I searched for "aligning equal sign in equations" in the TeX.SE search bar and got exactly what I (as a novice user) needed. As they say, SE helps future visitors, too! :o)
    – Frenzy Li
    Mar 8, 2017 at 14:50

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.