2

I have this sample (reduced from the document I started with):

\documentclass[11pt]{amsart}
\begin{document}
And then the first several terms of $v$ are
\begin{align*}
v_0, \\
{\lambda v_0 + B}, \\
{\lambda^2 v_0 + 2 \lambda B + \lambda A}, \\
{\lambda^3 v_0 + 3 \lambda^2 B + 3 \lambda^2 A}, \\
{\lambda^4 v_0 + 4 \lambda^3 B + 6 \lambda^3 A}, \\
{\lambda^5 v_0 + 5 \lambda^4 B + 10 \lambda^4 A}, \\
\ldots
\end{align*}
\end{document}

This runs through LaTeX without error, but does the wrong thing; it aligns all the commas instead of aligning to the left. I don't want that. I want these terms lined up so that they have a common left edge.

When I try to say "align to the left" by replacing the fourth line with \begin[l]{align*}, I get an error that I don't know how to interpret:

! Misplaced \cr.
\math@cr@@@ ->\cr 

l.12 \end{align*}

The question on this site What does Misplaced \cr in latex error mean seems like it ought to help, but I can't interpret what the answer means for my example.

7
  • 2
    You put no &, so all your lines are considered to be on the left side of the alignment (hence right-aligned), and there's an implicit & at the end of each line. Simply put one at the beginning of each line.
    – Bernard
    Jul 8, 2017 at 12:10
  • 1
    But why do I get an error once I add an [l] and not without it? Jul 8, 2017 at 12:12
  • 1
    Where do you put [l]? As an optional argument of align?
    – Bernard
    Jul 8, 2017 at 12:14
  • 1
    I think so? As I said in my question, I replace \begin{align*} with \begin[l]{align*}. Jul 8, 2017 at 12:25
  • 2
    It can't work. There's no such syntax. The alignment points are marked with &. See my other comment under berkus'answer.
    – Bernard
    Jul 8, 2017 at 12:27

1 Answer 1

4

You may place your equations in an array environment with left alignment:

    \documentclass[11pt]{amsart}
    \begin{document}
    And then the first several terms of $v$ are
    \[
      \begin{array}{l}
                  v_0, \\
        \lambda   v_0 + B, \\
        \lambda^2 v_0 + 2 \lambda   B +    \lambda   A, \\
        \lambda^3 v_0 + 3 \lambda^2 B + 3  \lambda^2 A, \\
        \lambda^4 v_0 + 4 \lambda^3 B + 6  \lambda^3 A, \\
        \lambda^5 v_0 + 5 \lambda^4 B + 10 \lambda^4 A, \\
      \end{array}
    \]
    \end{document}

Edit No 1:

Or you can use an align* environment, with alignment markers at the beginning of each line:

    \documentclass[11pt]{amsart}
    \begin{document}
    And then the first several terms of $v$ are
    \begin{align*}
      &          v_0, \\
      &\lambda   v_0 + B, \\
      &\lambda^2 v_0 + 2 \lambda   B +    \lambda   A, \\
      &\lambda^3 v_0 + 3 \lambda^2 B + 3  \lambda^2 A, \\
      &\lambda^4 v_0 + 4 \lambda^3 B + 6  \lambda^3 A, \\
      &\lambda^5 v_0 + 5 \lambda^4 B + 10 \lambda^4 A, \\
    \end{align*}
    \end{document}

enter image description here

Edit No 2:

The equations are aligned at &. To demonstrate:

\documentclass[11pt]{amsart}
\begin{document}
And then the first several terms of $v$ are
  \begin{align*}
    &v_0,                                             & \textrm{Aligns here}\\
    &{\lambda v_0 + B},                               & \textrm{Aligns here}\\
    &{\lambda^2 v_0 + 2 \lambda B + \lambda A},       & \text{Aligns}\\
    &{\lambda^3 v_0 + 3 \lambda^2 B + 3 \lambda^2 A}, & \text{Aligns here long}\\
    &{\lambda^4 v_0 + 4 \lambda^3 B + 6 \lambda^3 A}, & \text{Ali}\\
    &{\lambda^5 v_0 + 5 \lambda^4 B + 10 \lambda^4 A},& \text{Aligns here very long}
  \end{align*}
\end{document}

enter image description here

Edit No 3:

& here has two purposes: setup the columns and setup the point where the equations will all be aligned. To demonstrate it, we should use equations with = sign, which are actually align is mainly used for. (see here) :

\documentclass[11pt]{amsart}
\begin{document}
And then the first several terms of $v$ are
  \begin{align*}
          x&=y     &    w&=z              &  a&=b+c\\
         2x&=-y    &   3w&=\frac{1}{2}z   &  a&=b\\
    -4 + 5x&=2+y   &  w+2&=-1+w           & ab&=cb
  \end{align*}
\end{document}

1st, 3rd and 5th & determines the location of =, and the others determine the number of columns. This is how align environment is setup.

enter image description here

10
  • 1
    Why would this be needed? Why can't I just put [l] on the align*? Jul 8, 2017 at 12:13
  • 3
    align* has no optional argument. aligned has, but it is for the vertical placement ([t]or [b]).
    – Bernard
    Jul 8, 2017 at 12:23
  • Experts please correct me if I am wrong: align* works like/as a LaTeX table. & defines the columns and `\\` defines new row.
    – berkus
    Jul 8, 2017 at 12:32
  • Then, and this may be a stupid question, why does adding an optional argument not either do nothing or give an error even vaguely related to the optional argument? In fact, it seems that align* does have an optional argument, but it means "throw an uninformative error at the end of the environment". Jul 8, 2017 at 12:36
  • 1
    @DanielMartin It has not, any [] argument should output brackets in your document. But only if you use the typical environment optional argument syntax \begin{align*}[]. Any other syntax is not accepted either (\begin[]{align*} throws an error, because \begin does not have optional arguments).
    – TeXnician
    Jul 8, 2017 at 12:37

You must log in to answer this question.

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