Here's a minimal example of what is not working for me:
\documentclass{article}
\newcommand{\foo}[1]{a_#1}
\begin{document}
$\foo{\hat{1}}$
\end{document}
Am I doing something wrong in my command definition, or is something else going wrong here?