6

This question already has an answer here:

Sometimes the symbol := is used to denote a definition. For example, X:=Y+Z means that X is defined to be Y+Z.

When using LaTeX, can I just use $:=$, or do I need to do something special?

marked as duplicate by Ian Thompson, Paul Gessler, Martin Thoma, Werner, user31729 Aug 1 '14 at 20:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

12

Many do, but then the colon isn't correctly centered. Better to use the package mathtools and \coloneqq. See the mathtools documentation for more information.

5

Unfortunately, with $:=$, the colon is not centred on the math axis. A solution comes from the mathtools package, which defines \vcentcolon and \coloneqq commands; these lead to two different results, as regards the horizontal spacing between the colon and the equality sign:

\documentclass{article}

\usepackage[utf8]{inputenc}

\usepackage{mathtools}

\begin{document}

Let  $ a:  = b $

Let  $ a \vcentcolon  = b $

Let  $ a \coloneqq  b $

\end{document} 

enter image description here

The \coloneq(one q!) symbol exists in mathabx, Mnsymbol and Mdsymbol (at least). It's named \coloneqqin kpfonts and mdsymbol.

-1

Are you trying to get a special single symbol for that or are you fine with a simple "colon equals"? I'm not aware of a special version of that symbol, no, but colon and equals should both work normally inside of mathmode, e.g., $X:=5$ gives the expected result.

There's a lovely website http://detexify.kirelabs.org/classify.html which may help you out in the future for such inquiries.

  • 1
    Try searching for \coloneq in the Comprehensive LaTeX symbol list. – Ian Thompson Aug 1 '14 at 20:17
  • This is more of a comment than an answer. – Werner Aug 1 '14 at 20:34
  • @Werner I'm aware, but I can't comment yet because I don't have enough reputation. – sintax Aug 1 '14 at 22:31
-1

It is not necessary to do anything, LaTeX does it for you.

\documentclass{article}
\begin{document}
Here
\[X:=Y+Z
\]
\end{document}
  • 2
    Yes, it does, but incorrectly; in most fonts, the colon is not vertically centred (it sits on the baseline, like a regular . does). This is of course wrong since the = is vertically centred and this assymetry is seriously ugly. – yo' Aug 1 '14 at 20:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.