9

The following code

\begin{equation} \label{eq:test}
\begin{aligned} 
A=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\
B=BBBBBBBBBBBBBBBB\\
C=CCCCC, D=DDDDDDD\\    
E=EEEEE, F=FFFFFFF
\end{aligned}
\end{equation}

Alligns the equations from right while I need them to be at the center. Using gather does not allow me to give number to my equation. What is the standard way to implement what I intend to do?

enter image description here

  • 1
    Have you tried replacing aligned with gathered? – Mico Aug 11 '15 at 6:15
  • @Mico, Yes and here is the result: Package amsmath Error: \begin{gather} allowed only in paragraph mode \begin{gather} – ar2015 Aug 11 '15 at 12:07
  • Note that I wrote gathered, not gather. (See also the code in my answer.) – Mico Aug 11 '15 at 12:08
9

If you want to have each equation centered rather than aligned on some specific point (such as the first = symbol), you should use a gathered environment instead of an aligned environment.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{equation} \label{eq:test}
\begin{gathered}
A=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\
B=BBBBBBBBBBBBBBBB\\
C=CCCCC, D=DDDDDDD\\
E=EEEEE, F=FFFFFFF
\end{gathered}
\end{equation}
\end{document} 
4

Edit: I automatically assumed that you wanted all the equations aligned on the = sign. The right answer to center them is Mico's. However, this is another possibility that you may try.

You only need to tell Latex how to align your equations, with the & symbol:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\begin{equation} \label{eq:test}
    \begin{aligned} 
        A &= AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\\
        B &= BBBBBBBBBBBBBBBB\\
        C &= CCCCC, D=DDDDDDD\\    
        E &= EEEEE, F=FFFFFFF
    \end{aligned}
\end{equation}

\end{document}
  • 1
    I believe the OP wants the equations centered rather than aligned on, say, the first = symbol. – Mico Aug 11 '15 at 6:55
  • @MarcoG, but this OP doesn't like to have. From its questions follows, that it like to have centered. This is obtained with gathered math environment. In it the use of ampersand & has not sense, so their is not allowed. – Zarko Aug 11 '15 at 6:57
  • @Mico@Zarko of course you're right! I saw the aligned environment and automatically assumed that the OP wanted these equations with the = aligned. So, how should they be centered? – MarcoG Aug 11 '15 at 7:06
  • To center the equations, don't use an aligned environment. Instead, as @Zarko and I have already commented, a gathered environment should be used. – Mico Aug 11 '15 at 7:09
  • @Mico Ok, I'm just not used to center equations :-)! In your opinion, should I delete my answer, or should I keep it to show the OP another possibility (even if it is a quite "basic" answer)? – MarcoG Aug 11 '15 at 7:12

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.