Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}
share|improve this question
add comment

4 Answers

up vote 6 down vote accepted

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.

share|improve this answer
    
Out of topic comment: Conventionally, do we have to use separate equations to show the substitution steps? –  I am who I say I am Jan 26 '13 at 9:06
    
@GarbageCollector Yes, I think so. –  mafp Jan 26 '13 at 9:18
add comment

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

share|improve this answer
    
Apparently I have got a similar answer here. –  I am who I say I am Jan 26 '13 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 '13 at 9:09
add comment

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}
share|improve this answer
    
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 '13 at 5:31
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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