TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am searching for a wide hat with a right arrow. So far I've found only the regular wide hat (\widehat, shown at the left of the image), or a curved right arrow (\curvearrowright).

Wide had and wide hat with arrow

Is there a way to get something like what I have badly drawn at the right of the image?

share|improve this question
Welcome to TeX.sx!. I have included your image. Soon, you will have enough reputation to do it yourself. – Qrrbrbirlbel Oct 7 '12 at 17:59
Thanks for including the image! – Paul22 Oct 7 '12 at 18:16
up vote 11 down vote accepted

I provide two TikZ solutions.

  1. The first one uses uses an empty node before and after the formula that belongs under the wide hat.
    • Disadvantage: The added vertical height will not be taken into calculation
    • Advantage: Math style (display, text, script, scriptscript) is not effected (other then in the \vphantom.
  2. The second one is a node.
    • Disadvantage: Math style is lost. (Change the first \frac into a \tfrac to realize.)
    • Advantage: Vertical height is known to math mode.

Another disadvantage over \widehat is, that the line width doesn't change over the course of the path.



% Solution 1
\newcommand{\tikzmark}[2][]{\tikz[baseline, inner sep=0, overlay, remember picture] \node[anchor=base] (#2) {\vphantom{#1}};}

    \tikzmark[#1]{widehatarrow\thetikzmark} #1 \tikzmark[#1]{endwidehatarrow\thetikzmark}%
    \tikz[overlay, remember picture] \draw[-to] (widehatarrow\thetikzmark.north)++(.05em,.4ex) -- ($(widehatarrow\thetikzmark.north)!.5!(endwidehatarrow\thetikzmark.north)+(.05em,.8ex)$) -- ($(endwidehatarrow\thetikzmark.north)+(.05em,.4ex)$);%

% Solution 2
\tikz[baseline] {
    \node[inner sep=0, anchor=base] (widehatarrow){$#1$};
    \draw[-to] (widehatarrow.north west)++(.05em,.4ex) -- ($(widehatarrow.north west)!.5!(widehatarrow.north east)+(.05em,.8ex)$) -- ($(widehatarrow.north east)+(.05em,.4ex)$);%

\begin{equation} % Solution 1
\widehatarrow{A, B} \cdot \widehatarrow{x, y} = \widehatarrow{A, y, B, x}

\begin{equation} % Solution 2
\Widehatarrow{A, B} \cdot \Widehatarrow{x, y} = \Widehatarrow{A, y, B, x}

\begin{equation} % Compare both solutions
 \frac{1}{\widehatarrow{A, B} \cdot \Widehatarrow{A, B}} = \frac{1}{\widehatarrow{A, B} \cdot \widehatarrow{A, B}} = \frac{1}{\Widehatarrow{A, B} \cdot \Widehatarrow{A, B}}


MWE compiled

(By egreg) It's possible to overcome the limitations with \Widehatarrow, by using a \vphantom and \mathpalette:

  \tikz[baseline] {
    \node[inner sep=0, anchor=base] (widehatarrow){$#1#2$};
    \draw[-to] (widehatarrow.north west)++(.05em,.4ex)
     -- ($(widehatarrow.north west)!.5!(widehatarrow.north east)+(.05em,.8ex)$)
     -- ($(widehatarrow.north east)+(.05em,.4ex)$);%

Now the height of \Widehatarrow{AB} will be the same as the height of \widehat{AB} and the sizes will be respected, as shown by trying

share|improve this answer
Anyone, who has an idea how to solve the problems (“disadvantage”), is welcome to comment or point me in the right direction. :) – Qrrbrbirlbel Oct 7 '12 at 18:55
Both problems can be solved with some cognoscenti trickery, for \Widehatarrow. I'll add it to your solution. – egreg Oct 7 '12 at 19:11
The first solution is quite buggy with me (see mirari.fr/BJr2 ) (and it compiles differently every time). Anyway, the second (and its modified version) works perfectly. Thanks! – Paul22 Oct 7 '12 at 20:04
@Paul22 Yes, the first one needs two compilations and is superseded by the second one (especially with egreg's addition), anyway. – Qrrbrbirlbel Oct 7 '12 at 20:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.