7

amsmath's \dots does a pretty good job at auto-detecting which type of commas to use based on tokens after (and I think before) it. However, what baffles me is why \cong in particular does not work, although it is a relation similar to =, \equiv, \simeq, etc. Could someone explain? Is this just a bug?

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\noindent
\(a = \dots = b\)\\
\(a \cong \dots \cong b\), what?\\
\(a \sim \dots \sim b\)\\
\(a \equiv \dots \equiv b\)\\
\(a \simeq \dots \simeq b\)

\end{document}

enter image description here

1

1 Answer 1

6

Possibly amsmath should also change \cong like it changes \sum and several other kernel commands.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\NewCommandCopy{\cong@}{\cong}
\renewcommand{\cong}{\DOTSB\cong@}
\makeatother

\begin{document}

\(a = \dots = b\)

\(a \cong \dots \cong b\)

\(a \sim \dots \sim b\)

\(a \equiv \dots \equiv b\)

\(a \simeq \dots \simeq b\)

\end{document}

enter image description here

8
  • 2
    So just a bug. Moreover, I would write \AddToHook{cmd/cong/before}{\DOTSB}.
    – Gargantuar
    Feb 4 at 23:19
  • @Gargantuar It wouldn't work, I'm afraid. Try it.
    – egreg
    Feb 4 at 23:55
  • You're right, but why? If such an interface is offered, I'd trust that it should work (although it is documented that this hook only exists in theory, but might not in practice).
    – Gargantuar
    Feb 5 at 0:17
  • 1
    @Gargantuar \dots looks ahead to see whether the first level expansion (if possible) of the next token starts with \DOTSB (or \DOTSI or \DOTSX). But the first level expansion of \cong starts with \protect and the proposed \AddToHook doesn't change it.
    – egreg
    Feb 5 at 0:26
  • 2
    @FrankMittelbach Done.
    – egreg
    Feb 6 at 22:41

You must log in to answer this question.

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