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?

  • @Dan \documentclass{article}
    – kubo
    Commented Nov 13, 2021 at 17:21
  • 1
    Welcome to TeX.SE!
    – Mensch
    Commented Nov 13, 2021 at 17:22
  • @kubo Does \documentclass{article}\begin{document}$\hat{<}\widehat{<}$\end{document} not give you what you are looking for?
    – Dan
    Commented Nov 13, 2021 at 17:23
  • @Dan Yes, it does. However, I am using \usepackage[spanish]{babel}. That seems to be the problem. How can I solve it?
    – kubo
    Commented Nov 13, 2021 at 17:32
  • 3
    @kubo The babel package doesn't give me a problem. (Try \documentclass{article}\usepackage[spanish]{babel}\begin{document}$\hat{<}\widehat{<}$\end{document}) What other packages are you using? It could be helpful if you added a minimum working example of your code that generates the issue to your question.
    – Dan
    Commented Nov 13, 2021 at 17:35

2 Answers 2


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.




$a<b\lesshat c$


enter image description here

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


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.

  • 2
    In English, "hatless" means "without a hat", so this command name rather contradicts itself, although unintentionally. Commented Nov 13, 2021 at 22:37
  • @barbarabeeton Right. I'll reverse. I guess that \lesshat will raise less eyebrows.
    – egreg
    Commented Nov 13, 2021 at 22:40
  • Good choice. (By the way, the pedant in me says that should be "fewer eyebrows". But it's not otherwise confusing.) Commented Nov 13, 2021 at 22:45
  • Well if you want to raise eyebrows, one could read \lesshat as Les shat. He might have done so on Pen Island.
    – Don Hosek
    Commented Nov 13, 2021 at 22:56
  • @Dan Yes, that's right, because only < is made active, not >, by babel-spanish.
    – egreg
    Commented Nov 13, 2021 at 23:40

I add my solution with the option \selectlanguage{spanish} that not give no error of compilation.





enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .