TeX - LaTeX Asked on July 22, 2021
This MWE
documentclass{article}
usepackage{amsmath}
begin{document}
$$begin{aligned}
Gamma_{11}^1 & =0, qquad Gamma_{12}^1 & =0, qquad Gamma_{22}^1 & =-frac{1}{2}G_u,
GGamma_{11}^2 & =0, qquad GGamma_{12}^2 & =frac{1}{2}G_u, qquad GGamma_{22}^2 & =0.
end{aligned}$$
end{document}
and I can’t understand why is the middle &
not working, I’ve used it in the same way as the first and last &
.
Since it seems to be a common question how to correctly place ampersands in alignment environments in math, maybe it helps to illustrate it like this:
In a lot of alignment environments for math (for example align
, aligned
, alignat
etc.), each ampersand introduces a new column and each double backslash introduces a new row. In each row, every first column is right-aligned and every second column is left-aligned.
documentclass[varwidth]{standalone}
usepackage{amsmath}
begin{document}footnotesize
[begin{aligned}
fbox{onestrut} & fbox{twostrut}
fbox{right-alignedstrut} & fbox{left-alignedstrut}
end{aligned}]
bigskip
[begin{aligned}
fbox{onestrut} & fbox{twostrut} & fbox{threestrut} & fbox{fourstrut} & fbox{fivestrut} & fbox{sixstrut}
fbox{right-alignedstrut} & fbox{left-alignedstrut} & fbox{right-alignedstrut} & fbox{left-alignedstrut} & fbox{right-alignedstrut} & fbox{left-alignedstrut}
end{aligned}]
bigskip
[begin{aligned}
fbox{onestrut} & fbox{twostrut} & fbox{threestrut} & fbox{fourstrut} & fbox{fivestrut} & fbox{sixstrut}
Gamma_{11}^1 & =0, &qquad Gamma_{12}^1 & =0, &qquad Gamma_{22}^1 & =-frac{1}{2}G_u,
GGamma_{11}^2 & =0, & GGamma_{12}^2 & =frac{1}{2}G_u, & GGamma_{22}^2 & =0.
end{aligned}]
end{document}
Correct answer by Jasper Habicht on July 22, 2021
I suggest you switch to an alignedat
environment and place the qquad
directives on the second line. I would also use tfrac
rather than frac
, in order to reduce the visual prominence of the fraction terms.
documentclass{article}
usepackage{amsmath}
begin{document}
[
begin{alignedat}{3}
Gamma_{!11}^1 &=0, & Gamma_{!12}^1 &=0, & Gamma_{!22}^1 &=-tfrac{1}{2}G_u,
GGamma_{!11}^2 &=0,qquad & GGamma_{!12}^2 &=tfrac{1}{2}G_u, qquad & GGamma_{!22}^2 &=0 ,.
end{alignedat}
]
end{document}
Or, use a single alignat*
environment instead of the [ begin{alignedat}{3} ... end{alignedat} ]
combination:
begin{alignat*}{3}
Gamma_{!11}^1 &=0, & Gamma_{!12}^1 &=0, & Gamma_{!22}^1 &=-tfrac{1}{2}G_u,
GGamma_{!11}^2 &=0,qquad & GGamma_{!12}^2 &=tfrac{1}{2}G_u, qquad & GGamma_{!22}^2 &=0 ,.
end{alignat*}
Answered by Mico on July 22, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP