I want to have the "^" sign over the "=" sign.

I have tried \newcommand{\defeq}{\overset{^}{=}}, \newcommand{\defeq}{\stackrel{\text{^}}{=}}, \newcommand{\defeq}{\overset{\^}{=}} and different combinations of these, but none have worked yet. Also, I would like my command only to work in math mode (in the {$$}, \begin{equation}, and such environments). I do not want it to work in textmode, so the output of \defeq , {$\defeq$} should be , ^= (but the ^ over the =).

  • Yes @campa. However, that post did not include how to make the command exclusively work in math mode. So it is not entirely a duplicate. – Vebjorn Oct 29 '19 at 12:58
  • Sorry, I misunderstood that last sentence (close vote retracted). But why would you want that? – campa Oct 29 '19 at 13:26

You can try \newcommand{\defeq}{\mathrel{\hat=}}.

|improve this answer|||||
  • Right! I've edited my answer. Thank you. – José Carlos Santos Oct 29 '19 at 12:52
  • \newcommand{\defeq}{\hat{=}} works fine. (I use the packages mathtools and amssymb (amsmath is included in mathtools). Thank you. – Vebjorn Oct 29 '19 at 12:55
  • But you did not explain how to only make it work in math mode. – Vebjorn Oct 29 '19 at 17:04

To be completely honest, I find the request that a math symbol gives nothing in text mode somewhat strange, but here's a way


\usepackage{amsmath} % necessary for correct scaling of \widehat

\newcommand*{\defeqaux}[2]{\vcenter{\hbox{\mathsurround=0pt $#1\widehat{\mathop=}$}}}


In text mode \defeq, in math $\defeq$


enter image description here

The symbol itself is shamelessly taken from my own answer to What is the correspondence symbol with a hat or wedge over equals?, where you can find other possibilities.

|improve this answer|||||
  • Why do you have * in \DeclareRobustCommand and \newcommand and what does aux in \newcommand do? – Vebjorn Oct 29 '19 at 16:59
  • 1
    @Vebjorn The * just indicates that they are not \long commands. It's not really necessary in this case but it doesn't hurt either. \defeq calls a helper macro \defeqaux which is needed to handle different math styles. For details please refer to The mysteries of \mathpalette. – campa Oct 29 '19 at 17:22

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