# [Tex/LaTex] How to redefine \hat{H} as \hat{\cal H}

accentsmath-modesymbols

I would like to redefine \hat{H} as \hat{\cal H} only for this particular letter (for Hamiltonian symbol in physics). Thank you very much.

Well I guess that there are two ways of proceeding here:

• Use the "find and replace" tool of your editor to replace all the matches of \hat{H} by \hat{\mathcal{H}} or

• a bit more appealing... in the preamble of the document define a new command, say \newcommand*{\hham}{\hat{\mathcal{H}}}. Then use the "find and replace" tool of your editor to replace all the matches of \hat{H} by \hham

A MWE would be

\documentclass{article}
\usepackage{amsmath}
\newcommand*{\hham}{\hat{\mathcal{H}}}

\begin{document}

The relation,
$\hham\psi_n = E_n\psi_n$
is valid for every  eigenstate $\psi_n$ of the Hamiltonian $\hham$.
\end{document}


Cheers!