1

I am using the aligned environment to typeset some mathematical equations. Background was discussed here: Vertical alignment in lists when using multline. The idea is to typeset equations on the same line with text.

Now, I want to align equations by more than one position. aligned gives me too much space around =:

enter image description here

As you can see, there is too much space between AA and =.

Here is my MWE:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

$\begin{aligned}
&AA &&= a\\
&B  &&= b
\end{aligned}$

\end{document}
  • @TeXnician because then it alignes the b` symbol two the right border. Substitute a with aaa and you will see. – Michael Fraiman Apr 30 '17 at 17:13
  • The aligned and alignedat environments are provided by amsmath; mathtools also loads it but it's independent from it. – egreg Apr 30 '17 at 17:55
3

You can use alignedat if you do not want space between each equation

enter image description here

\documentclass{article}
\usepackage{mathtools}

\begin{document}

$\begin{alignedat}{2}
&AA &&= a\\
&B &&=b
\end{alignedat}$

\end{document}

the form with aligned is modelled on setting

a=1 b=2

with some space between each equation, so you have the right hand side of two equations, with space between.

  • Thank you, I wasn't aware of this environment. Guess I should read the mathtools documentation. – Michael Fraiman Apr 30 '17 at 17:20
  • alignedat is described in the amsmath documentation, not mathtools. (mathtools just loads amsmath then adds to it.) – barbara beeton May 19 '17 at 21:23
0

Another possibility is using the array environment:

\documentclass{article}
\usepackage{mathtools}

\begin{document}

$\begin{array}{l@{{}={}}l}
AA & a\\
B  & b
\end{array}$

\end{document}

with the required result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.