[Tex/LaTex] How to put a \dot accent above a \hat accent in math mode

accentsmath-mode

I use ${\dot \hat E}$ to put a hat and dot on top of an E simultaneously. However, an error occurs.

Best Answer

First, be sure to load the amsmath package, as it provides for better positioning of stacked math accents. Second, write

$\dot{\hat{E}}$ 

A full MWE (minimum working example):

enter image description here

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$\dot{\hat{E}}$ 
\end{document}

Just for comparison, here's the output of \dot{\hat{E}} if the amsmath package is not loaded:

enter image description here