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 want to align two sequences:

a_1, b_1, c_1, d_1, e_1 etc.

a_2, b_2, c_2, d_2, e_2 etc.

here's what I wrote

    \begin{align}
    \notag &a_1,\ &b_1,\ &c_1,\ &d_1,\ &e_1\ \mbox{etc.}\\
    \notag &a_2,\ &b_2,\ &c_2,\ &d_2,\ &e_2\ \mbox{etc.}
    \end{align}

but it turns out that the first two columns are perfect, but then there is a large space between the second and third column. How can I solve this? Any help is appreciated.

share|improve this question
1  
There are a couple of good answers here already, but: Those ampersands should be double ampersands. The first one is an alignment point, the second marks the end of the first column, the third is an alignment point, the fourth marks the end of the second column, etc. Using alignat (as in Peter Gill's answer) will suppress all the space inserted between the columns. –  Phil Hirschhorn Jun 9 '12 at 5:02

2 Answers 2

up vote 8 down vote accepted

Your alignment is perhaps better obtained using a structure like array:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
  &a_1,\ &b_1,\ &c_1,\ &d_1,\ &e_1\ \text{etc.}\\
  &a_2,\ &b_2,\ &c_2,\ &d_2,\ &e_2\ \text{etc.}
\end{align*}

\[
  \begin{array}{*{6}{l@{\ }}}
    a_1, & b_1, & c_1, & d_1, & e_1 & \text{etc.} \\[\jot]
    a_2, & b_2, & c_2, & d_2, & e_2 & \text{etc.}
  \end{array}
\]
\end{document}

The array consists of 6 l@{\ } columns - left-aligned, followed by a control-space \. \\[\jot] ensures a sizeable gap between the series, similar to that of align, while \text (provided by amsmath) does some testing to maintain the font size and is therefore superior to an \mbox construct (in general). In this case, it doesn't matter though.

share|improve this answer
    
I think the ampersands in your array example should be double ampersands. In array, the first ampersand is an alignment point, the second marks the end of the first aligned column, the third is again an alignment point, the fourth ends the second column, etc. –  Phil Hirschhorn Jun 9 '12 at 4:58
2  
@PhilHirschhorn: No. In array, & is a column separator. This differs from amsmath's align environments that have an LCR feel to them, and often require double ampersands for proper alignment. –  Werner Jun 9 '12 at 5:06
    
Oops, sorry; That comment was intended to be about your align* example, not about your array example. (I shouldn't write stuff like this so late at night.) –  Phil Hirschhorn Jun 10 '12 at 0:07
    
@PhilHirschhorn: I copied the OP's usage in order to highlight the difference between their align and the proposed array. I understand their usage of alignment & is incorrect. –  Werner Jun 10 '12 at 0:14

You can also use the alignat* environment which allows for multiple align points:

enter image description here

Notes:

  • The alignat*= environment produces as many rl pairs as specified in the first paramater and does not insert additional space that the align environment does, so you need to insert the space that is desired between the alignment points.
  • The leading & is used to ensure that the first column is left aligned. Hence the need for the double && to ensure that the subsequent columns are also left aligned.

Code:

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\begin{alignat*}{6}
    &a_1,\ &&b_1,\ &&c_1,\ &&d_1,\ &&e_1\ &&\text{etc.}\\
    &a_2,\ &&b_2,\ &&c_2,\ &&d_2,\ &&e_2\ &&\text{etc.}
\end{alignat*}
\end{document}
share|improve this answer
    
Shouldn't each of those ampersands be double ampersands? As it stands, the first marks the alignment point, the second ends the first "column", the third is an alignment point, etc. As it's written, you can change the number of columns from 5 to 3 without generating an error message. –  Phil Hirschhorn Jun 9 '12 at 4:54
    
@PhilHirschhorn: Oppss, too much wine with dinner.. Thanks... Have added more detail, so let me know if I it is not clear. –  Peter Grill Jun 9 '12 at 5:38
    
Looks good, and it correctly corrects my correction, since there was, of course, no need to double the first ampersand. –  Phil Hirschhorn Jun 10 '12 at 0:09

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.