I know that there is a typographical difference between using : and \colon in math mode, because : is considered to be a relation. However, I use \colon far more often than :, so I would like to interchange both. Is that possible?

1 Answer 1


\colon and : are defined in fontmath.ltx using:


which makes \colon a punctuation and : a relation symbol, as you said yourself.

You can swap the definitions:


As egreg noted, amsmath has a different definition of \colon, which does not rely on TeX's primitive math spacing. To swap the definitions of : and \colon with amsmath you need to make : a math-active character (I did that using egreg's \DeclareMathActive) and un-define \colon prior to using \DeclareMathSymbol:

% From https://tex.stackexchange.com/a/299805/134574
  \expandafter\edef\csname keep@#1@code\endcsname{\mathchar\the\mathcode`#1 }
  \AtBeginDocument{\mathcode`#1="8000 }}
\newcommand{\std}[1]{\csname keep@#1@code\endcsname}
% amsmath's definition of \colon:
% undefine then redefine \colon:
  • With that I get: LaTeX Error: Command `\colon' already defined. The command for : works though. Is there any way to "remove" commands? Commented Sep 22, 2019 at 13:18
  • 1
    put \let\colon\relax before the definition @red_trumpet Commented Sep 22, 2019 at 13:20
  • 1
    @red_trumpet \let\colon\relax or \let\colon\undefined. Related question
    – schtandard
    Commented Sep 22, 2019 at 13:21
  • Thanks now it works! What's the difference between relax and undefined? Commented Sep 22, 2019 at 13:27
  • @red_trumpet What they said :-) \relax is a "do-nothing", so usually if a command is equal to \relax it is "free to be redefined". \undefined is an undefined command. \SomethingImPrettySureIsNotDefined would've worked too. The error only appears if \colon is defined to be something else though... Commented Sep 22, 2019 at 13:30

You must log in to answer this question.

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