# Problem with \widehat{=} and $when I´m using \widehat{=} or \hat{=} i get an error. Also the pdf output isn´t formatted as it should be. \textbf{foo:} for example \textit{city} \widehat{=} \textit{attribute} and\texit{new york} \widehat{=} \textit{object}.  It should look like this: • foo: for example cityattribute and new yorkobject. What am I missing? • (1) welcome, (2) \widehat is a math construction so you need math mode, $\widehat{=} $ – daleif Dec 20 '16 at 11:53 ## 3 Answers Use \mathrel{\widehat{=}} to get the correct spacing around the relation symbol. As already noted in the comments, the whole contructions only works in math mode, i.e., either inside a pair of$ signs, or in a mathematical environment like equation.

Since your symbol seems to be used in text mode, I suggest defining a macro, that makes easier inputting the text.

\documentclass{article}

\newcommand{\is}[2]{\textit{#1}$\;\widehat{=}\;$\textit{#2}}

\begin{document}

For example \is{city}{attribute} and
\is{New York}{object}.

\end{document}


Try this (\equalhat):

\documentclass{article}
\usepackage{scalerel,stackengine,amsmath}
\newcommand\equalhat{\mathrel{\stackon[1.5pt]{=}{%
\stretchto{\scalerel*[\widthof{=}]{\wedge}{\rule{1ex}{3ex}}}{0.5ex}}}}

\begin{document}

$\equalhat$

\end{document}