I search a way to align an equation with multiple columns where the following criteria should be met:
The equation tag should be in the last line
The equal signs should be centered and aligned
Using alignat
gives me the right numbering but I have been unable to center
the last equal sign in the second row as it is overset
with a reference.
Using array
inside an equation
I can get the alignment correct (although with more space between the columns) but the numbering is now centered and not at the end.
\documentclass{book}
\usepackage{amsmath}
\renewcommand\theequation{\thesection.\arabic{equation}}
\begin{document}
\chapter{}
\section{Section}
\subsection{subsection}
\begin{equation}
1 + 1 = 2
\label{eq:1}
\end{equation}
\begin{alignat}{3}
E =& n^\mu n^\nu T_{\mu\nu} &&=&& \rho \notag \\
T =& T^\mu_\mu = -\rho + p_r + 2 p_\perp
&&\overset{(\ref{eq:1})}{=}&& 2 (p_\perp -\rho) \notag \\
S =& T+E &&=&& 2 p_\perp - \rho \notag \\
p^\mu =& - \gamma^{\mu \alpha} n^\beta T_{\alpha \beta} &&=&& 0 \quad .
\end{alignat}
\begin{equation}
\begin{array}{cclcl}
E &=& n^\mu n^\nu T_{\mu\nu} &=& \rho \\
T &=& T^\mu_\mu = -\rho + p_r + 2 p_\perp
&\overset{(\ref{eq:1})}{=}& 2 (p_\perp -\rho) \\
S &=& T+E &= & 2 p_\perp - \rho \\
p^\mu &=& - \gamma^{\mu \alpha} n^\beta T_{\alpha \beta} &= & 0 \quad .
\end{array}
\end{equation}
\end{document}