2
$\begingroup$

Previously, I used $:=$ when defining notation. Until I discovered the preferred $\coloneqq$ or $\colonequals$ command.

This command doesn't work on math.stackexchange. I presume because MathJax doesn't support it.

What would be a good alternative for use on the math.stackexchange website?

$\endgroup$
  • $\begingroup$ If you can find a Unicode character which looks like that, you could use it. But I only find ≔ which looks like this in Math Mode $:=$. (I am not sure whether it is any improvement compared to $\colon=$ $\colon=$.) You could also have this command or some similar commands are defined in the packages they come with. If the same syntax works in MathJax, you could perhaps create your own macro. (Although you would have to add it at the beginning of every post where you want to use it.) $\endgroup$ – Martin Sleziak Jan 14 '17 at 11:04
  • $\begingroup$ I have seen that answer; it covers LaTeX, not MathJax. Point being: it doesn't work on the math.stackexchange website. $\endgroup$ – Mussé Redi Jan 14 '17 at 11:10
  • $\begingroup$ I have linked to that answer because it mentions which packages those commands come from and also some other possible definitions. So if you want to try to define your own macro to use on this site, knowing how the \coloneq macro (and some other similar macros) are defined might be helpful. (Of course, it is possible - or even likely - that the same macro will not work in MathJax.) $\endgroup$ – Martin Sleziak Jan 14 '17 at 11:15
  • $\begingroup$ Hmm, ok. In the best case scenario, this feature could be included in the next version of MathJax right? So that it can be used with a single command, as oppose to having to define the same macro instance when you need it in a post. So it would be constructive to make a feature request to the MathJax developers? $\endgroup$ – Mussé Redi Jan 14 '17 at 11:21
  • $\begingroup$ BTW is \coloneq a typo and you meant \coloneqq from mathtools package? $\endgroup$ – Martin Sleziak Jan 16 '17 at 4:22
  • $\begingroup$ Yes, indeed, I meant \coloneqq from the mathtools package. I've added an edit. $\endgroup$ – Mussé Redi Jan 16 '17 at 7:42
6
$\begingroup$

This is somewhere half-way between an answer and a long comment, but since I did not want to continue a long discussion with many comments, I have decided to post this as an answer.

I hope that somebody with better knowledge of MathJax, LaTeX (and perhaps Unicode), will post a better answer.


One possibility I can think of is using Unicode.

If you can find a Unicode character which looks like that, you could use it. But I only find ≔ which looks like this in Math Mode $≔$. (I am not sure whether it is any improvement compared to $\colon=$ $\colon=$ or $:=$ $:=$.)


Other possibility is to look how it is done in LaTeX and test whether you can make some similar macro in MathJax. (Notice that in MathJax you can use \newcommand.) Of course, not every macro which works in LaTeX will also work in MathJax and another obvious disadvantage is that you would have to add the macro to every post where you want to use it.

Anyway this TeX.SE post mentions several ways how this symbol could by typeset in LaTeX: How to typeset $:=$ correctly?

Since you explicitly mentioned \coloneq I checked how this is defined in mathtools package:

\def\vcentcolon{\mathrel{\mathop\ordinarycolon}}
\providecommand\ordinarycolon{:}
...
\providecommand*\coloneqq{\vcentcolon\mathrel{\mkern-1.2mu}=}

My attempt to replicate this in MathJax looks as follows:
$\newcommand{\ordinarycolon}{:}\newcommand{\vcentcolon}{\mathrel{\mathop\ordinarycolon}}\newcommand{\coloneqqa}{\vcentcolon\mathrel{\mkern-1.2mu}=}$ Unless I am mistaken, this could be simplified to this:
\newcommand{\coloneqqb}{\mathrel{\mathop:}\mathrel{\mkern-1.2mu}=}

Perhaps a reasonable thing to try is also to simply include the "naive solutions" into \mathrel.
\newcommand{\coloneqqc}{\mathrel{:=}}
\newcommand{\coloneqqd}{\mathrel{\colon=}}
\newcommand{\coloneqqe}{\mathrel{≔}}

And this is Davide Cervone's suggestions from a comment:
\newcommand{\coloneqqf}{\mathrel{\vcenter{:}}=}

When I test this, I get the following: $\newcommand{\ordinarycolon}{:}\newcommand{\vcentcolon}{\mathrel{\mathop\ordinarycolon}}\newcommand{\coloneqqa}{\vcentcolon\mathrel{\mkern-1.2mu}=} \newcommand{\coloneqqb}{\mathrel{\mathop:}\mathrel{\mkern-1.2mu}=} \newcommand{\coloneqqc}{\mathrel{:=}} \newcommand{\coloneqqd}{\mathrel{\colon=}} \newcommand{\coloneqqe}{\mathrel{≔}} \newcommand{\coloneqqf}{\mathrel{\vcenter{:}}=} $ $$ \begin{array}{|l|c|} \hline \text{:=} & a:=b \\\hline \text{\colon=} & a\colon=b \\\hline \text{unicode} & a≔b\\\hline \text{\coloneqqa} & a\coloneqqa b\\\hline \text{\coloneqqb} & a\coloneqqb b\\\hline \text{\coloneqqc} & a\coloneqqc b\\\hline \text{\coloneqqd} & a\coloneqqd b\\\hline \text{\coloneqqe} & a\coloneqqe b\\\hline \text{\coloneqqf} & a\coloneqqf b\\\hline \end{array} $$

I am sure there are many other possibilities worth trying if you want to try this way (by creating your own macro).

$\endgroup$
  • $\begingroup$ I would say that \coloneq still looks notably better then the solutions provided here. How would we go about adjusting the vertical height of the equal sign downwards, for a fraction, in either \coloneqqa, \coloneqqb or \coloneqqc? $\endgroup$ – Mussé Redi Jan 14 '17 at 11:57
  • $\begingroup$ @MusséRedi I do not know how something like that can be done in LaTeX (and, by extension, I do not know about a solution in MathJax). You can try to wait whether somebody more qualified answers or you can try by yourself to find some LaTeX solution and then whether it works in MathJax. $\endgroup$ – Martin Sleziak Jan 14 '17 at 12:06
  • $\begingroup$ Would you call this case, development material for the next version of MathJax? I mean, even if a macro solution is found, this would be beneficial to be part of the core, wouldn't it: \coloneq can be said to me "missing" in MathJax, or wouldn't you phrase it like that? $\endgroup$ – Mussé Redi Jan 14 '17 at 12:10
  • $\begingroup$ @MusséRedi That is probably more of a question for MathJax developers. (And some of them visit this meta occasionally, so there is some chance that you will get some response from one of them.) $\endgroup$ – Martin Sleziak Jan 14 '17 at 12:11
  • 1
    $\begingroup$ Perhaps \mathrel{\vcenter{:}}= is what you are looking for. $\endgroup$ – Davide Cervone Jan 15 '17 at 22:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .