4

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.

1 Answer 1

7

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}
3
  • 2
    Maybe even \qty{3.2}{\milli\meter}. Commented Mar 27, 2023 at 19:34
  • 2
    @JasperHabicht = Excellent idea. :-) Done.
    – Mico
    Commented Mar 27, 2023 at 19:36
  • 1
    Thank you @Mico and JasperHabicht.
    – AEW
    Commented Mar 27, 2023 at 19:45

You must log in to answer this question.

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