I want to provide a symbol in math mode with a character above – like \tilde{...}
or \hat{...}
. I'm using that symbol sometimes with subscript indices as well as with superscript indices. The idea with the character above came that they do not interfere optically with the indices.
My first solution with \overset{\omega}{\phi}
did not work, because the vertical alignment of a superscript includes the whole construction while it should only regard the lower, big character. After some internet search I found the accent package as a solution with \accentset{\omega}{\phi}
, which indeed delivers the correct alignment. But when I want to pack it inside a glossaryentry from the glossaries package,
\newglossaryentry{foo} {
name={\ensuremath{\accentset{\omega}{\phi}}},
description={foo}
}
it can't compile – "Undefined control sequence" error.
How can I make both packages compatible or how do I simulate the behaviour of the \accentset
command?
Here are both behaviours shown, with "2" as index:
Here is a minimal not working example
\documentclass{scrartcl}
\usepackage{amsmath}
\usepackage{accents}
\usepackage{glossaries}
\newglossaryentry{foo} {
name={\ensuremath{\accentset{\omega}{\phi}}},
description={foo}
}
\makeglossaries
\begin{document}
$\overset{\omega}{\phi}^2$ wrong alignment \\
$\accentset{\omega}{\phi}^2$ correct alignment \\
$\gls{foo}$ not possible
\end{document}