Equations – How to Align Equations at Multiple Equal Signs on Each Line

alignequations

I was wondering how I can align the three equations with respect to both equal signs of each line:

\documentclass{article}
\usepackage{amsmath,siunitx}
\begin{document}
    \begin{align*}
        e_x&=|x_{true}-x_{est}|&=3.2 \text{ mm,} \\
        e_y&=|y_{true}-y_{est}|&=4.3 \text{ mm,} \\
        e_\theta&=|\theta_{true}-\theta_{est}|&=\ang{0.3}.
    \end{align*}
\end{document}

enter image description here

Thanks for any solution.

Best Answer

I suggest you switch from an {align*} to an {alignat*}{2} environment. I further suggest you employ the \qty macro of the siunitx package to typeset quantities and their associated scientific units.

enter image description here

\documentclass{article}
\usepackage{amsmath,siunitx}
\begin{document}
  \begin{alignat*}{2}
    e_x       &=|x_{\mathrm{true}}-x_{\mathrm{est}}|   &&=\qty{3.2}{\milli\meter}, \\
    e_y       &=|y_{\mathrm{true}}-y_{\mathrm{est}}|   &&=\qty{4.3}{\milli\meter}, \\
    e_{\theta}&=|\theta_{\mathrm{true}}-\theta_{\mathrm{est}}|&&=\ang{0.3}.
    \end{alignat*}
\end{document}