How do magic \dots work in amsmath?

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

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?


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}}
\begin{equation*}
 a \pshow{\dots} b=0;
\end{equation*}

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@

where

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

and

> \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?

Tags:

Macros

Amsmath