2

I'm using \widehat to represent a mapping, so I would like to use it without arguments, for example,

Consider a mapping $\widehat{} : A \to B$, where $\widehat{a} = $...

Now the problem with this is that the spacing without any arguments is terrible, especially when I use it in text (e.g. The mapping $\widehat{}$ above renders terribly).

Is there any way I can make the spacing behave well? I tried doing things like \widehat{~} or \mathop{\widehat{~}} which made it a bit better, but it was still too close together in the text.

2
  • 1
    $\widehat{\hspace{.7em}}$ to check what number to put in (may be .8em or .9em), put brackets around to have a sense of how much width are you giving to the symbol $[\widehat{\hspace{.7em}}]$.
    – Manuel
    Oct 31, 2017 at 9:51
  • 2
    Alternatively, use \widehat{\phantom{X}}, where X is your favourite character.
    – user30471
    Oct 31, 2017 at 10:02

1 Answer 1

4

Check for a blank argument, and if so, use \phantom{x} as the argument.

\documentclass{article}
\usepackage{amssymb}
\let\svwidehat\widehat
\renewcommand\widehat[1]{\ifx\relax#1\relax\svwidehat{\phantom{x}}\else\svwidehat{#1}\fi}
\begin{document}
Consider a mapping $\widehat{} : A \to B$, where $\widehat{a} = $...
\end{document}

enter image description here

You must log in to answer this question.

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