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'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?

share|improve this question
add comment

3 Answers 3

up vote 6 down vote accepted

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

share|improve this answer
add comment

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

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}
share|improve this answer
    
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. –  Peter Grill Jun 9 '12 at 16:56
    
I forgot tabular, how could I forget tabular ? –  hinafu May 2 '13 at 2:51
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.