# The “^” sign over the “=” sign [duplicate]

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


• 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=}}.

• 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

\documentclass{article}

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

\DeclareRobustCommand*{\defeq}{\relax\ifmmode\mathrel{\mathpalette\defeqaux\relax}\fi}
\newcommand*{\defeqaux}[2]{\vcenter{\hbox{\mathsurround=0pt $#1\widehat{\mathop=}$}}}

\begin{document}

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

\end{document}


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.

• @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