2

\begin{align} A && B \end{align} and \[\begin{aligned} A && B \end{aligned}\] result in different alignments.

align seems to use all available space to split two columns, but aligned seems to use only the minimum possible amount of space.

enter image description here

What is the reason for this disparity, and can one tell aligned to use the whole space?

MWE:

\documentclass{article}
\usepackage{amsmath}
\usepackage[paperwidth=10cm,paperheight=5cm,margin=1cm,showframe]{geometry}
\pagestyle{empty}

\begin{document}

\begin{align*}
    Ax = b, && x = A^{-1}b
\end{align*}

\[
    \begin{aligned}
    Ax = b, && x = A^{-1}b
    \end{aligned}  
\]

\end{document}
3
  • 6
    align is a display construct that always takes the full width of the text block and displays a full equation. aligned sets a vertically aligned subterm at its natural width to take part in a larger equation usually with other terms to its left or right, so isn't what you describe the expected behaviour? Nov 11 '18 at 10:01
  • 4
    Welcome to TeX.SE. The difference in widths is there by design. Excerpting from section 3.7 of the user guide of the amsmath package: "Like equation, the multi-equation environments gather, align, and alignat are designed to produce a structure whose width is the full line width. ... But variants gathered, aligned, and alignedat are provided whose total width is the actual width of the contents; thus they can be used as a component in a containing expression." (The user guide goes on to provide examples of "compontents in a containing expression".)
    – Mico
    Nov 11 '18 at 10:03
  • It makes sense. Is there an option to have -ed variants expand in the horizontal space available?
    – Winks
    Nov 11 '18 at 13:08
2

align is a display construct that always takes the full width of the text block and displays a full equation. aligned sets a vertically aligned subterm at its natural width to take part in a larger equation usually with other terms to its left or right, so like most box constructs, the content is set to its natural width.

0

I think it's clearer if we add a three column align:

\documentclass{article}
\usepackage{amsmath}
\usepackage{showframe}

\begin{document}

\begin{align*}
Ax &= b, & x &= A^{-1}b
\end{align*}

\begin{align*}
Ax &= b, & x &= A^{-1}b & y &= Cz
\end{align*}

\[
\begin{aligned}
Ax &= b, & x &= A^{-1}b
\end{aligned}
\]

\end{document}

enter image description here

As you can see, the blank space is uniformly distributed between columns and margins: align measures the column widths, sums them up and sets the space between columns. The equation number will be set in the space at the right or left margin; if you try

\begin{align}
Ax &= b, & x &= A^{-1}b & y &= Cz
\end{align}
\begin{align*}
Ax &= b, & x &= A^{-1}b & y &= Cz
\end{align*}

you'll see that the columns are aligned to each other. However, there is a parameter telling align that if the distance from the rightmost (or leftmost column with leqno) is less than this amount, the columns will be shifted and the spacing reduced.

The aligned environment is a subsidiary one that can be used in any display (or also inline) math environment. Thus it has no notion of line width to be set in. Its columns don't participate in the alignment of outer environments; if the contents of aligned is too big, TeX has no way for reducing it, because aligned produces a box that's then inserted where requested.

By the way, the standard separation between columns in aligned is \minalignsep (a parameter also used by align), whose default value is 10pt.

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.