[Tex/LaTex] Left-align math

alignamsmathequations

I'm trying to left-align some math, like here (the center block with the arrows):

enter image description here

I've tried the following:

\begin{flalign*}
(0, (2, q_1), (0, q_1)) \rightarrow (0, (0, q_1), (1, q_2)) \rightarrow (0, (1, q_2), (2, q_2)) \rightarrow \\
(0, (2, q_2), (0, q_2)) \rightarrow (0, (0, q_2), (1, q_3)) \rightarrow (0, (1, q_3), (2, q_3)) \rightarrow \\
\vdots \\
(0, (2, q_i), (0, q_i)) \rightarrow (0, (0, q_i), (1, q_{i + 1})) \rightarrow (0, (1, q_{i + 1}), (2, q_{i + 1})) \rightarrow \\
\vdots
\end{flalign*}

… which leads to this:

enter image description here

What am I doing wrong here?

Best Answer

If you want them left aligned you need to indicate the alignment point be inserting a & at the beginning of the line:

enter image description here

Note:

  • If you want them flush with the margin, you need a trailing & on at least one line as in the MWE below.
  • The showframe package was used to just show the margins.
  • If you want all equations in the document left aligned you can use the [fleqn] class option, and then the length \mathindent can be adjusted to control the amount of the indent.

    \documentclass[fleqn]{article}
    \setlength{\mathindent}{1cm}
    

Code:

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

\begin{document}
\begin{flalign*}
&(0, (2, q_1), (0, q_1)) \rightarrow (0, (0, q_1), (1, q_2)) \rightarrow (0, (1, q_2), (2, q_2)) \rightarrow \\
&(0, (2, q_2), (0, q_2)) \rightarrow (0, (0, q_2), (1, q_3)) \rightarrow (0, (1, q_3), (2, q_3)) \rightarrow \\
&\vdots \\
&(0, (2, q_i), (0, q_i)) \rightarrow (0, (0, q_i), (1, q_{i + 1})) \rightarrow (0, (1, q_{i + 1}), (2, q_{i + 1})) \rightarrow \\
&\vdots &
\end{flalign*}
\end{document}

Without the trailing &, you still get the equations left aligned but with a small indent:

enter image description here