3

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}

enter image description here

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

enter image description here

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.

5
  • \mathop{:} centers the colon, so \mathrel{\mathop{:}}\equiv for instance would work.
    – Manuel
    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
    – LaRiFaRi
    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).
    – Manuel
    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.
    – LaRiFaRi
    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.
    – Manuel
    Aug 24, 2015 at 14:25

1 Answer 1

8

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}

enter image description here


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}

enter image description here

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.

5
  • 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).
    – egreg
    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)?
    – LaRiFaRi
    Aug 24, 2015 at 10:22
  • 3
    \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.
    – egreg
    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!
    – LaRiFaRi
    Aug 25, 2015 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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