[Tex/LaTex] How do magic \dots work in amsmath

amsmathmacros

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

\newcommand{\myto}{\to}
$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.

Best Answer

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

\gdef\coprod{\DOTSB\coprod@\slimits@}

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

\show\mapsto

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