35

I am confused in choosing one of the following approaches.

\documentclass{article}
\usepackage{siunitx}
%\sisetup{detect-all}
\usepackage{amsmath}
\parindent=0pt\relax
\begin{document}
The following calculation is a trivial example
\[
\begin{aligned}
q       &=CV                                \\
        &=\num{3e-20x1000}  \\
        &=\num{3e-17}
\end{aligned}
\]
The following calculation is a trivial example
\begin{align*}
q       &=CV                                \\
        &=\num{3e-20x1000}  \\
        &=\num{3e-17}
\end{align*}

\end{document}

What is the difference between aligned in displayed mode and starred align?

Edit:

If there is a difference and we have to show the substitution steps above or algebraic operation steps below, which one we have to use based on the internationally adopted convention?

\documentclass{article}
\usepackage{amsmath}

\begin{document}
The following calculation is a trivial example
\[
\begin{aligned}
a(x+b)^2 - ab^2 &= a(x^2 + 2bx + b^2) - ab^2\\
                                &= ax^2 + 2abx + ab^2 - ab^2\\
                                &= ax^2 + 2abx
\end{aligned}
\]

The following calculation is a trivial example
\begin{align*}
a(x+b)^2 - ab^2 &= a(x^2 + 2bx + b^2) - ab^2\\
                                &= ax^2 + 2abx + ab^2 - ab^2\\
                                &= ax^2 + 2abx
\end{align*}

\end{document}

5 Answers 5

20

Your first version is essentially a single equation (that contains several lines of aligned equations, but that is secondary). Your second version consists of several equations. This alters the spacing above and below that:

\documentclass{article}
\usepackage{amsmath}
\parindent=0pt\relax
\begin{document}
The following calculation is a trivial example
\hrule
\[
\begin{aligned}
q       &=CV                                \\
        &=3e-20x1000  \\
        &=3e-17
\end{aligned}
\]
\hrule

\bigskip

\hrule
\begin{align*}
q       &=CV                                \\
        &=3e-20x1000  \\
        &=3e-17
\end{align*}
\hrule
\end{document}

yields: display math versus align

Usually you want the larger spacing around a block of several equations. Your second version is also conceptually clearer.

3
  • Out of topic comment: Conventionally, do we have to use separate equations to show the substitution steps? Jan 26, 2013 at 9:06
  • @GarbageCollector Yes, I think so.
    – mafp
    Jan 26, 2013 at 9:18
  • If I describe the steps in an algebraic solution, should these steps be a different equation each one (and not aligned), i.e. we don't use neither align nor aligned?
    – ChrisG
    Apr 5, 2018 at 11:21
15

This is in addition to the already existing answers.

One particular case where aligned environment is preferred over align* is when using \parbox inside a tabular package when colortbl package is loaded. This causes a bug which was patched by Stephan Lehmke in my question colortbl and amsmath conflict. In the same post, egreg mentioned in comment to Peter Grill's answer that you can use positioning options like t and b in aligned which you cannot do in align*.

In tabular, you can do the following with aligned

\documentclass[preview,border=5]{standalone}
%\documentclass{article}
\usepackage{siunitx}
%\sisetup{detect-all}
\usepackage{amsmath}
\parindent=0pt\relax
\begin{document}
\begin{tabular}[t]{p{0.5\linewidth}l}
The following calculation is a trivial example
    & $
        \begin{aligned}[t]
        q       &=CV                                \\
                &=\num{3e-20x1000}  \\
                &=\num{3e-17}
        \end{aligned}
      $\end{tabular}
\end{document}

enter image description here

as against the following with align*

\documentclass[preview,border=5]{standalone}
%\documentclass{article}
\usepackage{siunitx}
%\sisetup{detect-all}
\usepackage{amsmath}
\parindent=0pt\relax
\begin{document}
\begin{tabular}[t]{p{0.5\linewidth}l}
The following calculation is a trivial example
    & \parbox[t]{0.4\linewidth}{%
        \begin{align*}
        q       &=CV                                \\
                &=\num{3e-20x1000}  \\
                &=\num{3e-17}
        \end{align*}}
\end{tabular}
\end{document}

enter image description here

When in list environments, with aligned you can do

\documentclass{article}
\usepackage{siunitx}
%\sisetup{detect-all}
\usepackage{amsmath}
\parindent=0pt\relax
\begin{document}
The following calculation is a trivial example
\begin{enumerate}
\item 
    \(
      \begin{aligned}
q       &=CV                                \\
        &=\num{3e-20x1000}  \\
        &=\num{3e-17}
      \end{aligned}
    \)

\item 
    \(
      \begin{aligned}[t]
    q       &=CV                                \\
            &=\num{3e-20x1000}  \\
            &=\num{3e-17}
      \end{aligned}
    \)

\item 
    \(
      \begin{aligned}[b]
    q       &=CV                                \\
            &=\num{3e-20x1000}  \\
            &=\num{3e-17}
      \end{aligned}
    \)
\end{enumerate}

\end{document}

enter image description here

as against

\documentclass{article}
\usepackage{siunitx}
%\sisetup{detect-all}
\usepackage{amsmath}
\parindent=0pt\relax
\begin{document}

The following calculation is a trivial example
\begin{enumerate}
\item 
    \begin{align*}
    q       &=CV                                \\
            &=\num{3e-20x1000}  \\
            &=\num{3e-17}
    \end{align*}
\end{enumerate}

\end{document}

enter image description here

2
  • Apparently I have got a similar answer here. Jan 26, 2013 at 9:02
  • You are right. I learned this feature from egreg's comment in my linked post. I put this in my edit.
    – hpesoj626
    Jan 26, 2013 at 9:09
8

As you've noticed, the aligned environment is meant to be part of a larger displayed math environment (which is why you put it in between \[ and \]), while the align* environment is a freestanding displayed math environment. For the use you made of them in your example, they're essentially equivalent. The aligned environment can be used in many other situations, though, in which align* wouldn't work at all.

For example:

\begin{displaymath}
  \text{A simple example:}
  \qquad
  \begin{aligned}
  q       &=CV                \\
          &=\num{3e-20x1000}  \\
          &=\num{3e-17}
  \end{aligned}
\end{displaymath}

or

\begin{displaymath}
  \begin{aligned}
  q       &=CV                                \\
          &=\num{3e-20x1000}  \\
          &=\num{3e-17}
  \end{aligned}
  \qquad\text{and}\qquad
  \begin{gathered}
    a = b + c\\
    \sin^{2}x + \cos^{2}x = 1
  \end{gathered}
\end{displaymath}
1
  • Would be useful to show how one can use the aligned environment in a manner that illustrates something the align* environment can not do. Jan 26, 2013 at 5:31
6

"What is the difference between aligned in displayed mode and starred align?"

I'm adding this as the other answers seem not to have mentioned it (from the amsmath package users guide):

Whereas align produces a structure whose width is the full line width, aligned gives a width that is the actual width of the contents, thus it can be used as a component in a containing expression, e.g. for putting the entire alignment in a parenthesis.

E.g.

\begin{equation*}
\left.\begin{aligned}
B’&=-\partial\times E,\\
E’&=\partial\times B - 4\pi j,
\end{aligned}
\right\}
\qquad \text{Maxwell’s equations}
\end{equation*}

enter image description here

3

it makes no sense to compare aligned and align*. The first one is used if you want one equation number for several lines. This is the reason why aligned is used as part of align or a similar environment.

You must log in to answer this question.

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