How can I typeset the equality symbol ::= used in the definition of syntactic categories of BNF grammars?

I would like to use it both in typewriter font (using \texttt) and in math mode.

Both \texttt{::=} and $::=$ (or $:\coloneqq$) are ugly.

marked as duplicate by Henri Menke, Troy, Kurt, TeXnician, Stefan Pinnow May 20 '18 at 15:54

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.

  • Have you tried $\operatorname{::=}$ in math mode, it looks a little bit better maybe? – RockyRock May 20 '18 at 11:44
  • Another version is $\Coloneqq$from the package \usepackage{txfonts} as well as others here – RockyRock May 20 '18 at 11:54

Like this?

\documentclass[a4paper, 11pt]{book}



    \[ A \Coloneqq B \]


enter image description here

  • 1
    Thanks! I looked up for that symbol in the Comprehensive LaTeX Symbol List but I wasn't able to find it out. Also detexify didn't help (don't know if it was for my poor drawing skill or if it is not aware of that symbol). – BlackBrain May 24 '18 at 9:10

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