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

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}

-

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:

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

-
Out of topic comment: Conventionally, do we have to use separate equations to show the substitution steps? –  Donut E. Knot Jan 26 at 9:06
@GarbageCollector Yes, I think so. –  mafp Jan 26 at 9:18

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}


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}


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}


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}


-
Apparently I have got a similar answer here. –  Donut E. Knot Jan 26 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 at 9:09

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:}
\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}
\begin{gathered}
a = b + c\\
\sin^{2}x + \cos^{2}x = 1
\end{gathered}
\end{displaymath}

-
Would be useful to show how one can use the aligned environment in a manner that illustrates something the align* environment can not do. –  Peter Grill Jan 26 at 5:31
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.