# How to horizontal/vertical combine two math symbols?

This is an absolutely minor/cosmetic problem. I can e.g. use stackrel so combine two math-symbols vertically. This is nice for \stackrel{!}{=}. But how to do this horizontally? I want to combine (only once, no newcommand necessary) the colon and an equivalence sign. I found the option \mathrel{: \equiv} which allows different versions like:

:\equiv  \quad \mathrel{: \equiv} \quad \mathrel{: \!\! \equiv} \quad \mathrel{: \!\! \!\! \!\! \equiv}


So I can shift the horizontal position. But like to achieve that the colon is centered regarding the vertical position. Like the blue version:

Again: if I use stackrel is combines two symbols vertically and centered! If I use mathrel is combines two symbols horizontally but not centered somehow.

I am eager to see your solutions.

• \mathop{:} centers the colon, so \mathrel{\mathop{:}}\equiv for instance would work. Aug 24, 2015 at 10:15
• @Manuel I do not see any difference to :\equiv. Could you elaborate a bit more on your suggestion, please! Why should \mathop centre something? This would be wrong IMO Aug 24, 2015 at 10:33
• @LaRiFaRi That's the way \mathop works, if there's a single atom inside it then it vertically centers the content (good because of, e.g., \sum or \int). Aug 24, 2015 at 13:00
• @Manuel But I can not see an effect in this example. Please write an answer showing this effect. Would be interesting as it is much shorter than mine. Thanks. Aug 24, 2015 at 14:17
• @LaRiFaRi I don't know what happens, but just look at the defintion of \vcentcolon which, if I'm not mistaken, does exactly this. The thing is that \mathrel{\mathop:}\equiv works while \mathrel{\mathop{:}}\equiv doesn't. No idea. Aug 24, 2015 at 14:25

Completely new update:

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}
\AtBeginDocument{\providecommand*\colonequiv{\vcentcolon\mspace{-1.2mu}\equiv}}

\begin{document}
$A\colonequiv B$
%$A\coloneqq B$ % for prove of consistency
%$A\coloneq B$
\end{document}


Old version (I believe, misunderstood):

Super hacky, but it works:

% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}
\usepackage{calc}

\begin{document}
$A\mathrel{\mathmakebox[\widthof{\equiv}]{\mathclap{:}\mathclap{\equiv}}}B$
\end{document}


If you want it to be centred vertically as well, you may want to do \mathclap{\raisebox{.34pt}{:}} instead. Both symbols do have the same height (speaking of their surrounding boxes) but they are designed on different height levels. Therefore I do not see a solution for "soft coded" centring.

You did not want a command for this, but as it is so long, I would clearly advise to code one if this is used more than once.

• I've never understood why mathtools defines \coloneqq as \mathrel{\vcentcolon\mkern{-1.2mu}=} where \vcentcolon\mspace{-1.2mu}= suffices (\vcentcolon is already a relation atom). Aug 24, 2015 at 10:16
• @egreg Strange indeed. I thought, \vcentcolon isn't (due to that implementation) but it clearly is. I will report that. Some reason for your using \mspace (which I have never seen before)? Aug 24, 2015 at 10:22
• \mspace is added by amsmath for consistency with \hspace. It does \mskip, but in case there's no stretch or shrink component this is basically the same as \mkern. Aug 24, 2015 at 10:22
• I was looking for the 'Completely new update'. Thank you
– Mac
Aug 25, 2015 at 11:42
• @Mac Glad to hear that. You are welcome! Aug 25, 2015 at 11:42