How can I change the align
environment (or create a new environment based on align
) so that the alignment in the columns of the equation is not rlrlrl…
but rrcll
while at the same time keeping the position of the equation number at the end of the line?
I came up with the code below which does the alignment-part the way I want it. But the equation number moves a variable space towards the equation. The space depends on the length of the equation.
The idea of how to define the new environment I got from the second answer to this question.
\documentclass{article}
\usepackage{amsmath,environ}
\makeatletter
\NewEnviron{gleichungssystem}
{\def\align@preamble{%
&\hfil
\strut@
\setboxz@h{\@lign$\m@th\displaystyle{####}$}%
\ifmeasuring@\savefieldlength@\fi
\set@field
\tabskip2\tabcolsep
&\hfil
\strut@
\setboxz@h{\@lign$\m@th\displaystyle{####}$}%
\ifmeasuring@\savefieldlength@\fi
\set@field
\tabskip\tabcolsep
&\hfil
\strut@
\setboxz@h{\@lign$\m@th\displaystyle{####}$}%
\ifmeasuring@\savefieldlength@\fi
\set@field
\hfil
\tabskip\tabcolsep
&\setboxz@h{\@lign$\m@th\displaystyle{####}$}%
\ifmeasuring@\savefieldlength@\fi
\set@field
\hfil
\tabskip5\tabcolsep
&\setboxz@h{\@lign$\m@th\displaystyle{####}$}%
\ifmeasuring@\savefieldlength@\fi
\set@field
\hfil
\tabskip\alignsep@
}%
\begin{align}\BODY\end{align}}
\makeatother
\begin{document}
\begin{gleichungssystem}
&0 &= &\dot{x}(0) & \\
\stackrel{xxx}{\Leftrightarrow} &0 & = & c_1 i \omega_0 \cdot e^{i \omega_0 0} - c_2 i \omega_0 \cdot e^{-i \omega_0 0} &\left| e^{0} = 1 \right. \\
\Leftrightarrow &0 &= &i \omega_0 c_1 - i \omega_0 c_2 &\left| \cdot \frac{1}{i\omega_0} \right. \\
\Leftrightarrow &0 &= &c_1 - c_2 &\left| + c_2 \right. \\
\Leftrightarrow &c_2 &= &c_1 & \label{umformung_randbed-frei-unged1_bsp1-2}
\end{gleichungssystem}
\begin{gleichungssystem}
&0 &= &\dot{x}(0) & \\
\stackrel{xxx}{\Leftrightarrow} &0 & = & c_1 i \omega_0 \cdot e^{i \omega_0 0} - c_2 i \omega_0 \cdot e^{-i \omega_0 0} &
\end{gleichungssystem}
\begin{equation}
a + b = c
\end{equation}
\end{document}