[Tex/LaTex] Typesetting the “define equals” symbol


I'd like to typeset two compound symbols for making definitions. The following

  • \newcommand{\defeq}{\mathrel{\mathop:}=}
  • \newcommand{\eqdef}{\mathrel{\mathop=}:}

are suggested by the CTAN symbol list in the footnote on page 35. (Well, the first is suggested, and I made up the second.) Is there a better way to do this, short of including txfonts? Basically, it always looks like \defeq has more space on the left than on the right, and conversely for \eqdef.

EDIT – Most of the answers are taking about packages that fix the vertical placement of the colon. Ok, that is great and I'm interested to hear it. But let me restate my question. I want to fix the apparent difference in space on the left and right sides of \defeq. To see what I mean, look at typeset equation $a \defeq b$ in Stefan's answer. The $a$ and the $b$ are equal distances from the center. But because the colon is a lighter symbol _it_looks_ the $a$ is further away. Does that make sense?

Best Answer

I recommend using a vertically centered colon which matches the equal sign better, such as \vcentcolon from the mathtools package. You can also change it generally to vertical by \mathtoolsset{centercolon}.

Compare standard :=

def equal

to the vertically centered:

def equal

So your definition could become


with tighter spacing. And since both symbols are already relation symbols, as egreg said, we even could omit \mathrel.

And you could do that even easier by mathtools provided commands:

$a\coloneqq b \qquad b\eqqcolon a$
Related Question