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 using the \align* environment from the amsmath package. How can I center one of the lines inside the environment?

In the following example, I want to the \vdots to be centered, instead of awkwardly aligned with the b above it.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
& a = (a_1, a_2) \\
& b = (b_1, b_2) \\
& \vdots \\
& z = (z_1, z_2)
\end{align*}
\end{document}
share|improve this question
    
Do you want it centered, or under the equal sign? –  Peter Grill Apr 18 '12 at 22:57
1  
You're misusing align: try a &= (a_1,a_2) \\ and similarly for the other lines; then & \mathrel{\:\vdots} \\ will be aligned under the equals signs. –  egreg Apr 18 '12 at 22:59
1  
or since you don't seem to be aligning anything, perhaps gather: \begin{gather*} a = (a_1, a_2) \ b = (b_1, b_2) \ \vdots \ z = (z_1, z_2) \end{gather*} –  David Carlisle Apr 18 '12 at 23:01
add comment

3 Answers 3

up vote 2 down vote accepted
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
 a &= (a_1, a_2) \\
 b &= (b_1, b_2) \\
 &\phantom{b=\,} \vdots \\
 z &= (z_1, z_2)
\end{align*}
\end{document}

enter image description here

share|improve this answer
add comment

I am sure there are plenty of ways of doing this. One of which would be to use \ooalign:

enter image description here

\documentclass{article}
\usepackage{amsmath}% http://ctan.org/pkg/amsmath
\begin{document}
\begin{align*}
  & a = (a_1, a_2) \\
  & b = (b_1, b_2) \\
  & \vdots \\
  & z = (z_1, z_2)
\end{align*}

\begin{align*}
  a &= (a_1, a_2) \\
  b &= (b_1, b_2) \\
  \makebox[0pt][l]{%
    \vphantom{$\vdots$}% For height
    \ooalign{\phantom{$a=(a_1, a_2)$}\cr\hss$\vdots$\hss}}% Centered \vdots
    \phantom{a}% For placement
      & \\
  z &= (z_1, z_2)
\end{align*}
\end{document}​

See this answer for a quick course on \ooalign.

share|improve this answer
add comment

This question is similar to this question, but to complete this page, I will add a similar answer here.

If you want to center the points unter the equal signs, then you should consider the package mathtools, which provides several corrections for and additions to amsmath.

\usepackage{mathtools}

It also provides a comfortable solution for your problem. You can even choose between a normal (\vdotswithin) and a short (\shortvdotswithin) distance.

\begin{align*}
  a &= b \\
  & \vdotswithin{=} \\
  & = c \\
  \shortvdotswithin{=}
  & = d
\end{align*}

The result convinces.

Example showing vdotswithin and shortvdotswithin

More details can be found in the documentation of the package, section "Centered \vdots", where also the example above is taken from.

share|improve this answer
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.