6

I often want to list a number of short equations (like the non-zero components of a tensor) under a single equation number. To do this I use combinations of the amsmath environments equation, gathered and aligned. However, for some reason, the different parts of the gathered environment are not all centered. Consider the example

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation}
  \begin{gathered}
    \begin{aligned}
      q &= r \,, &
      x &= y \,, &
      z &= w \,,
    \end{aligned} \\
    \begin{aligned}
      A a &= B b \,, &
      C c &= D d \,, \\
      a &= b \,, &
      c &= d \,.
    \end{aligned}
  \end{gathered}
\end{equation}

\end{document}

I would expect the first two lines both to be centered, but instead they come out more or less aligned at the right hand side. For a real world example consider

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{equation}
  \begin{gathered}
    \begin{aligned}
      \omega_t{}^{01} = -\omega_t{}^{10} &= \sinh\rho \,, &
      \omega_\phi{}^{12} = -\omega_\phi{}^{21} &= -\cosh \rho \,, &
      \omega_\rho{}^{AB} &= 0 \,,
    \end{aligned} \\
    \begin{aligned}
      \omega_{\varphi_+}{}^{35} = -\omega_{\varphi_+}{}^{53} &= 2\sin\beta_+ \cos\gamma_+ \,, &
      \omega_{\varphi_+}{}^{45} = -\omega_{\varphi_+}{}^{43} &= 2\sin\gamma_+ \,, \\
      \omega_{\varphi_-}{}^{68} = -\omega_{\varphi_-}{}^{86} &= 2\sin\beta_- \cos\gamma_- \,, &
      \omega_{\varphi_-}{}^{78} = -\omega_{\varphi_-}{}^{87} &= 2\sin\gamma_- \,.
    \end{aligned}
  \end{gathered}
\end{equation}

\end{document}

Here the first line is pushed even more to the left. It seems like there is some extra space introduced at the end of the first line, but where does this space come from?

0

3 Answers 3

9

for some reason, a one-line "aligned" is not properly centered. this appears to be a bug, and i am entering it as such in the amsmath bugs list.

this (unwanted) result can be easily demonstrated by two additions to your test file:

(1) replicate the (simple) example with the content of the first aligned duplicated, to give a two-line aligned;

(2) replicate the same example replacing the first aligned element by

  q = r \,, \quad
  x = y \,, \quad
  z = w \,,\\

the modified elements will be centered as expected. i haven't determined the reason that the one-line aligned element is shifted to the left. however, for the purpose of posting the problem to the bugs list, the reason isn't necessary; a demonstration is sufficient.

please consider sending reports of problems with amsmath directly to [email protected] .

1
  • Thank you for confirming that this is a bug, and for reporting it.
    – Olof
    Jan 2, 2011 at 22:23
0

I was googling a bit. I doubt it is a solution on your problem, it is just i little suggestion: Instead of equation + gathered + aligned It is sufficient tu use just gather + aligned. I suppouse that gather is standalone math environment.

\begin{gather}
  \begin{aligned}
    q &= r \,, &
    x &= y \,, &
    z &= w \,,
  \end{aligned} \\
  \begin{aligned}
    A a &= B b \,, &
    C c &= D d \,, \\
    a &= b \,, &
    c &= d \,.
  \end{aligned}
\end{gather}

Or, may I ask why you do not simply use only equation + aligned?

1
  • This will give two equation numbers, but I only wanted a single number for the three lines. equation + aligned doesn't work either. The two aligned environments are just placed side by side.
    – Olof
    Feb 10, 2011 at 7:53
0

the first array isn't really needed here, because it has only one line to be centered and using \, before the comma is not a correct typesetting of math

\documentclass{article}
\usepackage{amsmath}
\begin{document}

\begin{flalign}
  \arraycolsep=1.35pt\def\arraystretch{1.3}
  \begin{array}{c}
    \begin{array}{@{}rl@{\quad}rl@{\quad}rl@{}}
      q &= r \,, &  x &= y \,, & z &= w \,,  
    \end{array}\\
    \begin{array}{@{}rl@{\quad}rl@{}}
      A a &= B b \,, &  C c &= D d \,, \\
      a &= b \,, & c &= d \,.
    \end{array}
  \end{array}
\end{flalign}

\end{document}
1
  • 1
    I'm interested in what is the correct spacing before a comma, but I think it deserves a question on it's own.
    – Olof
    Jan 2, 2011 at 22:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .