12

Consider the following example:

\documentclass{article}

\usepackage{mathtools}

\begin{document}

\begin{alignat*}{6}
                       1 &&                           2 &&                    \ldots &&                           r &&                    \ldots &&                     m & \\
                   m + 1 &&                       m + 2 &&                    \ldots &&                       m + r &&                    \ldots &&                    2m & \\
                  2m + 1 &&                      2m + 2 &&                    \ldots &&                      2m + r &&                    \ldots &&                    3m & \\
  \vdotswithin{(n-1)m+1} &&      \vdotswithin{(n-1)m+2} &&      \vdotswithin{\ldots} &&      \vdotswithin{(n-1)m+r} &&      \vdotswithin{\ldots} &&      \vdotswithin{nm} & \\
            (n - 1)m + 1 &&\quad           (n - 1)m + 2 &&\quad               \ldots &&\quad           (n - 1)m + r &&\quad               \ldots &&\quad               nm &
\end{alignat*}

\end{document}

output

As can be seen, the vertical dots are not perfectly centered relative to the longest entry in each column; they are a little to the left of the center. How do I fix this?

4
  • Isn't this a horizontal-alignment question instead of a vertical one?
    – masu
    Nov 14, 2013 at 1:05
  • 1
    @masu Is it? (I'm tired [2AM here] and can't think properly right now, so you might be right.) Feel free to change the tags and text in the question accordingly. Nov 14, 2013 at 1:14
  • Did you measure it? The rightmost seems to be fine. I'll go further: the others look fine for me too except the $\ldots$ ones. (Yep. It's 2:22. So I'll be cautious too... I think it can be both. :) )
    – masu
    Nov 14, 2013 at 1:22
  • 1
    @masu I haven't but it just looks non-centered. No matter what, the \ldots ones are wrong, as you pointed out. (I need some sleep; I'll check in again in approx. 6 hours) Nov 14, 2013 at 1:25

1 Answer 1

11

The \ldots is defined as \mathinner which adds surrounding space. When used in this context the extra space after is removed. Inside \vdotswithin it is treated as {}\ldots{} which ensure that the surrounding spaces are preserved.

\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{alignat*}{6}
                       1 &&                           2 &&                {}\ldots{} &&                           r &&                {}\ldots{}&&                     m & \\
                   m + 1 &&                       m + 2 &&                {}\ldots{} &&                       m + r &&                {}\ldots{}&&                    2m & \\
                  2m + 1 &&                      2m + 2 &&                {}\ldots{} &&                      2m + r &&                {}\ldots{}&&                    3m & \\
  \vdotswithin{(n-1)m+1} &&      \vdotswithin{(n-1)m+2} &&     \vdotswithin{\ldots}  &&      \vdotswithin{(n-1)m+r} &&     \vdotswithin{\ldots} &&      \vdotswithin{nm} & \\
            (n - 1)m + 1 &&\quad           (n - 1)m + 2 &&\quad           {}\ldots{} &&\quad           (n - 1)m + r &&\quad           {}\ldots{} &&\quad               nm &
\end{alignat*}
\end{document}

enter image description here

0

You must log in to answer this question.

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