When I try to write
\begin{equation}
{\hat{a}_{1}^{\dagger}}^{2}
\end{equation}
I am getting this error
! Double superscript.
l.4 {\hat{a}_{1}^{\dagger}}^
{2}
?
So what is the proper way of writing
When I try to write
\begin{equation}
{\hat{a}_{1}^{\dagger}}^{2}
\end{equation}
I am getting this error
! Double superscript.
l.4 {\hat{a}_{1}^{\dagger}}^
{2}
?
So what is the proper way of writing
\documentclass[11pt]{article}
\begin{document}
\begin{equation}
\hat{a}_{1}^{\dagger 2}
\end{equation}
\end{document}
Possibly \hat{a}_{1}^{\dagger\,2} if you want a little bit more space before between the symbols in the superscript.
This is quite surprising, given that
${a^b}^c$
works and
${\hat{a}^b}^c$
not. Look for a complete analyisis at Double superscript error involving tilde (which is the same problem).
The problem is that there is a doubt between the position of the hat and the exponents.
Is the two a superscript of what? The \hat{a}? The a (and so it should go with the hat, same level)? The whole a_1^\dagger? Depending on the answer the formula will be different...
(Given your way of writing the equation, I suspect you where looking for the first one).
\documentclass[11pt]{article}
\begin{document}
\begin{equation}
\left.\hat{a}_{1}^{\dagger}\right.^{2}
\end{equation}
\begin{equation}
\hat{a}_{1}^{\dagger 2}
\end{equation}
\begin{equation}
\hat{a}_{1}^{\dagger^2}
\end{equation}
\end{document}
PD I will call this quite an "hidden feature" (!) of TeX math... first one I found in 20 years. Although it's known and planned this way, see Hendrik Vogt answer to that question.