I would like to use a hat in exponent for a notation, and I have found no satisfactory way of doing this. If I go for $f^{\hat{\null}}$, the hat is far too high, while $f^\wedge$ gives to big and too acute a hat. I would like to have the regular hat, but placed in exponent just as if it where usually drawn in the center of the line, not on the top. Any idea?

Precision: I seek a symbol that I could use quite like \wedge, in the sense that I should be able to write $f^\solution$ and more importantly $f_x^\solution$ with the hat and the index aligned correctly. A solution that would need to rewrite all my $f^\wedge$ in a slightly different way but would give good alignment without too much twiddling would already be good.

Additional precision: I also have to deal with double anitderivatives, so I need to be able to have the equivalent of $f^{\wedge\wedge}$, with both hats on level. The really best solution would be to extract the symbol used by \hat, without the surrounding command (i.e., the command that puts this symbol on top of the next letter).

  • What about $f\text{\^{}}$ ?
    – tibL
    Jun 4, 2012 at 11:33
  • @tibL: bad idea, this would not give the usual behavior of an exponent; for example, in $f_x\text{\^{}}$ the hat is not above the x. Jun 4, 2012 at 11:50
  • Can you post a picture of what you are trying to achieve. (A doctored one would be just fine. :))
    – Count Zero
    Jun 4, 2012 at 11:53
  • @count Zero: alone, $f\text{\^{}}$ looks good to me, it is the alignment problem that bothers me as soon as there is an index. Jun 4, 2012 at 13:00
  • 1
    this is very like the question more-aesthetic-perhaps-shallower-superscript-check-symbol/52708#52708 although the exponent there was a check, not a hat. Jun 4, 2012 at 14:33

4 Answers 4


You can get a decent result with




In the second case the spacing is perhaps too much; here they are side by side with a symbol after them to show the spacing

enter image description here

  • Of course, if you use that alot, you shall put \newcommand*{\binhat}{\hat{\mkern6mu}} in your preamble, but you probably know that...
    – yo'
    Jun 4, 2012 at 12:43
  • As said in the comment, this kind of solution does not answer my question; when there is an index to f, things are not in the right place. I want a true symbol that I can put in exponent. I should edit my question. Jun 4, 2012 at 12:55
  • In fact, I realized that your answer needs only a bit of twiddling with \raisebox and \scalebox to fulfill all my demands. I guess the ratio between the quickness of your answer and the length of my acceptation is the largest I ever saw on this family of sites. Jul 11, 2012 at 14:13
  • @BenoîtKloeckner Just today I got accepted an answer I gave on May 30, 2011. :) But the interval between question and answer in that case was longer: three hours. :)
    – egreg
    Jul 11, 2012 at 14:18

The following code introcudes \ehat that can be used only in exponents (!). Macro \mathchoice lets you use different code in different level of "exponent". Then we \raisebox the properly-sized hat to move it lower. It can be used as "low exponent" too.

enter image description here


  \hbox{[do not use `ehat` in display style]}%
  \hbox{[do not use `ehat` in text style]}%

e^\ehat h
e^2 h
f^{f^\ehat h} h
e_\ehat h

  • This is in the right direction, but there is some issue with the height. First, I do not get the same result than you, the hat looks higher (even copy-pasting your code in a document containing nothing else); moreover, the height seems not to adapt to the height of the letter, so in particular $s^\ehat$ looks very weird. Jun 5, 2012 at 13:26
  • I guess that then you'll have stuck with the egreg's solution
    – yo'
    Jun 5, 2012 at 15:23
  • May I ask why you have to put it in an exponent? Because it is close to impossible to detect what was before some macro in TeX...
    – yo'
    Jun 5, 2012 at 15:24
  • I do not have to, I want to. It is a notation that I think is clear and makes sense (it is a kind of antiderivative, so I want a notation close to $f'$). Jun 6, 2012 at 13:36
  • I guess that a solution would be to design a hat as a letter in metafont (so that instead of detecting manually what is behind, one would let the exponentiation do the job), but I do not know how to do that. Jun 6, 2012 at 13:37

$f\Hat f\Hat\Hat$


enter image description here


The amsxtra package offers \sphat for a superscript hat, which works in sub- and superscripts, too. However, in the usual \textstyle, I'd say that it has a spacing problem: it protrudes to much to the right. So you'd have to manually add some \, or so. On the plus side, \sphat works together with subscripts.

superscript hat

$f\sphat$, $a_{f\sphat}$ and $f\sphat_x$

There's also \sptilde for a superscript tilde and a few other superscript accents.

  • This is quite close to what I'd like, but I do have some spacing problems , and the hat is two large for my taste. Isn't there any mean to get the character in the usual hat alone (i.e. not the command that puts this character on top of the letter ?) Jul 11, 2012 at 11:54
  • Moreover, I would like to be able to write $f^{\myhat\myhat}$ for a double antiderivative, with both hats on level. Sorry for having such demands... Jul 11, 2012 at 11:56
  • @Benoît: Yes, I mentioned the spacing problem in my answer. I did see in the comments to the other answers that you wanted to be able to write f^{\myhat}, but that's not what amsxtra offers :-( About the mean to get the character in the usual hat alone: That's what egreg offers in his answer! I think tohecz has what you want; try adjusting the -0.75 to your needs. Jul 11, 2012 at 13:25
  • @Henry Vogt: in fact I did not realize that the only problems with egreg's answer, which were the baseline (I would like to have the symbol on level with the baseline, so that I can use it in a superscript) and the size (since I put in a superscript, I prefer it slightly larger), can both be solved using \raisebox and \scalebox. Jul 11, 2012 at 14:11

You must log in to answer this question.

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