4

The \dots doesn't seem to align properly in my table. Can anyone explain what's going on and how I can resolve this? MWE below.

\documentclass{article}
\begin{document}
\begin{tabular}{c}
    0 \\
    \dots \\
\end{tabular}
\end{document}

This displays like this: (red line added)

Alignment issue

Ulysses
  • 1,933
  • Please always provide a proper minimal example and not a mere fragment of code, a code which we can compile is much more useful. – cfr Dec 16 '15 at 01:40

1 Answers1

7

It is aligned correctly. If you draw boxes around the characters with \fbox{} you can see what is happening:

alignment

latex.ltx defines \dots to be equivalent to \textellipsis in text mode and that command is defined as follows:

\DeclareTextCommandDefault{\textellipsis}{%
   .\kern\fontdimen3\font
   .\kern\fontdimen3\font
   .\kern\fontdimen3\font}

So the additional space on the right is the third kern following the third dot, but there is, of course, no corresponding space on the left. So, as the box around the characters shows, the tabular is aligning the rows centre. It is just that the centre of \dots is not the centre of the middle dot but somewhere between that dot and the third one.

If you wish, you can adjust the spacing either by adding space on the left or adding negative space on the right:

\documentclass{article}
\begin{document}
\begin{tabular}{c}
  \fbox{0}\\
  \fbox{\kern\fontdimen3\font\dots}\\
  \fbox{\dots\kern-\fontdimen3\font}\\
\end{tabular}
\end{document}

centred dots

EDIT

If you wish, yes, you can create a command for this. For example:

\newcommand*\origkernlessdots{\dots\kern-\fontdimen3\font}

and then you can write

\begin{tabular}{c}
  \fbox{0}\\
  \fbox{\kern\fontdimen3\font\dots}\\
  \fbox{\dots\kern-\fontdimen3\font}\\
  \fbox{\origkernlessdots}\\
\end{tabular}

to produce

more kernless dots

But, egreg's suggestion is simpler:

\newcommand*\kernlessdots{\dots\unkern}

and then

\begin{tabular}{c}
  \fbox{0}\\
  \fbox{\kern\fontdimen3\font\dots}\\
  \fbox{\dots\kern-\fontdimen3\font}\\
  \fbox{\origkernlessdots}\\
  \fbox{\kernlessdots}\\
\end{tabular}

shows that \kernlessdots produces the same results as \origkernlessdots with simpler and more transparent code

simpler kernless dots

cfr
  • 198,882
  • Did you try it? – cfr Dec 16 '15 at 02:24
  • I deleted my comment as the issue turned out to be a display problem in my pdf-viewer, and the code itself was fine. – Ulysses Dec 16 '15 at 02:27
  • I've added an example to my answer anyway. Glad it worked out ;). – cfr Dec 16 '15 at 02:28
  • Thanks. Much appreciated. :) Could you clarify what the difference is between \newcommand*\cmd{def} and \newcommand{\cmd}{def}? – Ulysses Dec 16 '15 at 02:31
  • If you define a command so it takes arguments, then if it is started, all the arguments have to be 'short' (no paragraph breaks), otherwise they can be long (paragraph breaks). It is better to use the star if you are sure you don't need long arguments. Here, we don't have any arguments at all so we certainly don't need long ones. Hence the star. – cfr Dec 16 '15 at 02:42
  • You might find my answer helpful. It explains the syntax in more detail. – cfr Dec 16 '15 at 02:43
  • 2
    @cfr You might try \newcommand*\kernlessdots{\dots\unkern} – egreg Dec 16 '15 at 07:59
  • @egreg I like the simplicity of the \unkern command. – Ulysses Dec 17 '15 at 04:09