Hat over < symbol

math-modespanishsymbols

I want to put a hat over < symbol. I have tried \widehat{<} and \hat{<}, but neither of them are working. How can I do this?

P.S. I am using Overleaf

Edit I am using \usepackage[spanish]{babel}. That seems to be the problem, because if I don't include this package, \widehat{<} adn \hat{<} work smoothly. How can I solve my problem while using the babel package?

Best Answer

I believe this should be reported as a bug in babel-spanish.

Anyway, since typing \widehat{<} is not really good because it will produce wrong spaces, you can use a workaround: define a command before the special action of babel-spanish enters the scene.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[spanish]{babel}

\newcommand{\lesshat}{\mathrel{\widehat{<}}}

\begin{document}

$a<b\lesshat c$

\end{document}

enter image description here

If you want to type \hat{<} or \widehat{<} in the body of the document, you can't unless you load

\usepackage[spanish,es-noquoting]{babel}

but, as I said at the beginning, this would produce wrong spacing because \hat{<} would be considered an ordinary symbol.

Thanks to Dan for pointing out that in a former version of the answer \string was not needed.

Related Question