9

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?

4 Answers 4

14

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

2

I'd add to @PeterGrill's solution that you'd probably want to align the arrows, too. You can do so by adding ampersands, one per column (except the first) and one per alignment point (including the first). For 4 columns you hence end up with 7 ampersands. Similar to the original document, an additional space has been inserted into the rightmost column, while for aesthetic reasons, the dots have been indented.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{lipsum} 

\begin{document}    
\lipsum[75]
%
\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 \qquad\\    %\qquad: space to shift the column leftwards
&(0, (2, q_2), (0, q_2)) 
    &&\rightarrow (0, (0, q_2), (1, q_3)) 
    &&\rightarrow (0, (1, q_3), (2, q_3)) 
    &&\rightarrow\\
&\quad \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\\
&\quad \vdots &&&&&&
\end{flalign*}
%
\lipsum[75]         

\end{document}
1

I'm using array now, which seems to work:

\begin{array}{llllll}
(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 & & & & & \rightarrow\\
(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{array}
2
  • If you want them all the way to the left you need to include \noindent, and also remove the leading column separator with @{}. This still yields incorrect math spacing so you should use something like @{}>{{}} (with the array package), or insert the {} in the equations. Also, it is best to include a complete compilable example with \documentclass and the appropriate packages. Jun 9, 2012 at 16:56
  • I forgot tabular, how could I forget tabular ?
    – hinafu
    May 2, 2013 at 2:51
0

I did something like that :

$
\begin{flalign*}
&\nabla_x 3x = 43yxz & 3\\
& \nabla_x y x
\end{flalign*}
$

You can try it in few seconds if it does what you want. It works pretty smoothly

You must log in to answer this question.

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