Looking at your code for the \defeq
command, I noticed an asymmetry w.r.t. the scope of the \mathrel
instruction. The following commands avoid this asymmetry in the spacing around the symbols:
\newcommand{\defeq}{\mathrel{:\mkern-0.25mu=}}
\newcommand{\eqdef}{\mathrel{=\mkern-0.25mu:}}
where I've made use of the \mkern
("math-kern") command to tighten up the space (by a very small amount) between the two constituent symbols. The value of the mkern instruction was determined by the eyeball method.
A downside of this approach is that the colon isn't centered vertically relative to the equals sign. This could be fixed by fiddling some more, but I think you're better off using a predefined macro. One actually almost has an embarrassment of riches for the "colon-equals" symbol:
- packages
mathabx
, MnSymbol
, and mtpro2
: \coloneq
- packages
txfonts
, pxfonts
, and mathtools
: \coloneqq
- package
colonequals
: \colonequals
(what else?!)
Note that the mtpro2
package (short for "MathTime Pro 2") is available in a "lite" version (free) as well as a "professional" (not free) version. The mtpro2
and txfonts
will use a Times-Roman font style, and pxfonts
will use a Palatino-type font; this may or may not be acceptable to you, depending on what text font you're using. The version from the \mathabx
package has the interesting feature that the length of its "equal" symbol is shorter than normal, and the resulting width of its \coloneq
command is the same as that of the normal equals sign.
For a predefined version of the reverse symbol, i.e., "equals-colon", you could use the \eqcolon
command of the mtpro2
package (may be easiest if you already have that package) or the \equalscolon
command of the colonequals
package. In addition, you can always rotate your preferred form of the colon-equals symbol by 180 degrees to generate the reverse symbol using, say, the \rotatebox
command of the graphicx
package. Just remember that you need to tell TeX about the "type" of the new symbol, which should be "mathrel". The following MWE explains how to achieve this effect.
\documentclass{article}
\usepackage{MnSymbol, graphicx}
\newcommand{\eqcolon}{\mathrel{\rotatebox[units=360]{180}{\ensuremath{\coloneq}}}}
\begin{document}
$a \coloneq b$ and $c \eqcolon d$.
\end{document}
Happy TeXing!