# Can I move the hat symbol vertically upwards?

I'm using mathpazo to format a document and have just become annoyed that a hat appears to be rendering too close to the letter it's decorating. I'd like to move the hat upwards, but am not sure how to go about doing it.

My LaTeX is just \hat{x}_{t+1}, which renders as:

Is there any way to change this?

-

\documentclass{article}
\usepackage{mathpazo}
\usepackage{amsmath}   %% come by habit ;)
\begin{document}
$\hat{x}_{t+1}$
$\hat{\rule{0ex}{1.2ex}\mkern-3mu x}_{t+1}$
\end{document}


-
Fantastic! This also introduced me to \rule{width}{height} as well as \mkernUNITS and mu units, none of which I'd used before. Thanks! – lmjohns3 Apr 29 '14 at 4:50

You could use a \vphantom{} which inserts a vertical height equal to the parameter provided but of zero width. So using \vphantom{f} will make the \hat behave as if the hat needs to be on top of an f:

To have more fine tuned control you can use a scaled parameter via \hat{\vphantom{\scalebox{1.1}{x}} x}:

The \vphantom{} trick is useful in other cases such as with \sqrt{x} \sqrt{y} (as below on the left) which looks odd but is better with a \sqrt{x\vphantom{y}} \sqrt{y} (on the right) where both the top and bottom of the \surd are now aligned:

## Code:

\documentclass{article}
\usepackage{graphicx}
\begin{document}
$\hat{\vphantom{f}x}_{t+1} \hat{f}_{t+1}$
or using \verb|\scalebox{}|
$\hat{x}_{t+1} \hat{\vphantom{\scalebox{1.1}{x}} x}_{t+1} \hat{\vphantom{\scalebox{1.2}{x}} x}_{t+1}$
\end{document}

-
This is also a great answer, with an excellent explanation. Wish I could accept both. – lmjohns3 Apr 29 '14 at 16:11