Exchange meaning of : and \colon
You should just need
\DeclareMathSymbol{:}{\mathpunct}{operators}{"3A}
to define :
to be like \colon
. the original definitions are:
\DeclareMathSymbol{:}{\mathrel}{operators}{"3A}
\DeclareMathSymbol{\colon}{\mathpunct}{operators}{"3A}
I guess it's easier to type \colon
:)
\documentclass{article}
\usepackage[fleqn]{amsmath}
\usepackage{braket}
\usepackage{dsfont}
\usepackage{etoolbox}
\edef\latexordinarycolon{\mathchar\the\mathcode`: } % keep the ordinary :
\usepackage{mathtools}
\let\amsmathcolon\colon % keep amsmath's \colon
\patchcmd\amsmathcolon{:}{\latexordinarycolon}{}{} % avoid the mention of : in it
\mathtoolsset{centercolon}
\makeatletter
\begingroup
\catcode`:=\active \global\let\mathtools@colon=: % : is math active with mathtools "centercolon"
\gdef:{\@ifnextchar={\mathtools@colon\mkern-1.2mu}\amsmathcolon} % if : is followed by = ...
\endgroup
\let\colon\latexordinarycolon % Now \colon is a relation symbol
%%% Now we redefine = so that =: works
\edef\latexequal{\mathchar\the\mathcode`= }
\begingroup
\catcode`==\active
\gdef={\latexequal\@ifnextchar:{\afterassignment\mathtools@colon\let\next}{}}
\endgroup
\AtBeginDocument{\mathcode`=="8000 }
\begin{document}
Here is an example:
\begin{gather*}
f: x \mapsto x^2\\
g\colon \mathds R_+ \ni x \mapsto x^x \in \mathds R\\
A := \Set{ x \in \mathds R_+ | g(x) < x }\\
a:=b=:c=d
\end{gather*}
\end{document}
As one can see, there's no hope of typing =:
and get the same as \eqqcolon
.