The amsmath package redefines the \dots command so that it "guesses" the correct height of the dots with respect to its context. For example

$x, \dots, y$

will produce three lowered dots, aligned with the commas. While

$x \to \dots \to y$

uses centered dots that align with the arrows. However, if I define my own macros, amsmath can no longer guess and it always uses the lowered dots. For example

$x \myto \dots \myto y$

uses the wrong dots. How can I tell amsmath that I want centered and not lowered dots?

Btw., I know about \cdots but what I want is \dots to still be able to guess the correct ones automatically.

3 Answers 3


Looking at amsmath.sty, I see lots of lines like:


I would guess that the \DOTSB controls what kind of dots go before (or after?) this symbol. Doing


shows that that has the magic \DOTSB. So if defining your own macro, I would experiment with adding \DOTSB, \DOTSI, \DOTSX (those appear to be the options) before or after them. (Please report back on what happens!). I would guess that \dots "knows" about certain commands, but has to be told about any extra. \to seems to come in under the "known" commands, but, for example, it has to be told about \mapsto:

> \mapsto=\long macro:
->\DOTSB \mapstochar \rightarrow .
l.3 \show\mapsto
  • If this is possible, I didn't know about it. (Sorry, no time to check myself right now.) Very interesting! Commented Jul 30, 2010 at 16:10
  • 3
    Just a quick note before going to sleep: it works! If I use \newcommand{\myto}{\DOTSB\to} then \myto will produce the correct alignment! Thanks, tomorrow I'll try and check what the other options do. Commented Jul 30, 2010 at 22:31

This doesn't do what you're asking for, but in best semantic fashion, amsmath also defines

  • \dotsc for “dots with commas”

  • \dotsb for “dots with binary operators/relations”

  • \dotsm for “multiplication dots”

  • \dotsi for “dots with integrals”

  • \dotso for “other dots” (none of the above)

(Quoted from the Short Math Guide for LaTeX, page 15.) Each of these specifies the height. I didn't find the behavior of \dots you described documented. Can you point out where it is?

  • 1
    Thanks, I already knew about these, but I'm actually trying to define a macro that will add \dots between some some relations/operators which are provided by the user. So I, as a package write, don't know in advance which of the semantic commands should be used. However, as the example in the question shows, amsmath somehow knows! Commented Jul 30, 2010 at 22:27

OK, so since I asked the debugging question, I ventured out and tried to debug!

Using just \show didn't work, producing the following in the log file:

> \dots=macro:
->\protect \dots  .
l.7 \show\dots

so I googled for the show command and found this page and so I did the following

\def\pshow#1{{\let\protect\show #1}}
 a \pshow{\dots} b=0;

which resulted in:

> \dots =\long macro:
->\ifmmode \@xp \mdots@ \else \@xp \textellipsis \fi .
\dots ->\protect \dots

Looking deeper to examine \mdots@ is possible (using \makeatletter and \makeatother) but is quite horrific:

 > \mdots@=macro:
->\FN@ \mdots@@ .
l.11 \show\mdots@


> \FN@=macro:
->\futurelet \@let@token .


> \mdots@@=macro:
->\gdef \thedots@ {\dotso@ }\ifx \@let@token \boldsymbol \gdef \thedots@ \boldsymbol {\boldsymboldots@ }\else \ifx ,\@let@token \gdef \thedots@ {\dotsc }\else \ifx \not \@let@token \gdef \thedots@ {\dotsb@ }\else \keybin@ \ifgtest@ \gdef \thedots@ {\dotsb@ }\else \xdef \meaning@ {\meaning \@let@token ..........}\xdef \meaning@@ {\meaning@ }\@xp \math@ \meaning@ \math@ \ifgtest@ \@xp \mathch@ \meaning@ \mathch@ \ifgtest@ \@xp \getmathch@ \meaning@ \getmathch@ \fi \else \@xp \macro@ \meaning@@ \macro@ \ifgtest@ \@xp \not@ \meaning@ \not@ \ifgtest@ \gdef \thedots@ {\dotsb@ }\else \@xp \DOTS@ \meaning@ \DOTS@ \ifgtest@ \ifcase     number \DOTSCASE@ \gdef \thedots@ {\dotsb@ }\or \gdef \thedots@ {\dotsi }\else \fi \else \@xp \math@ \meaning@ \math@ \ifgtest@ \@xp \mathbin@ \meaning@ \mathbin@ \ifgtest@ \gdef \thedots@ {\dotsb@ }\else \@xp \mathrel@ \meaning@ \mathrel@ \ifgtest@ \gdef \thedots@ {\dotsb@ }\fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \thedots@ . 

At this point, I give up....anyone care to continue this dissection?

  • 1
    The quick'n'easy answer is that it looks at the next token in the input stream and bases its decision on that. If it's something vertically raised such as a plus sign or an arrow, it uses \cdots, otherwise it uses \ldots. Commented Jul 30, 2010 at 16:10
  • Using \show is an extremely inefficient way to debug. Using latexdef is better (although I don't know if it was available 13 years ago), but it still loses the comments and line breaks in the source code, the best would be to download the source code and read it. In summary I believe it checks for a few common tokens (, or \boldsymbol or \not), then apply \meaning on the right-following token (assigned to \meaning@ string), and check the string for \mathchar prefix, or initial strings \DOTSC etc. The commands \DOTSC themselves do nothing (assigned to \relax).
    – user202729
    Commented Jun 2, 2023 at 14:14

You must log in to answer this question.

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