# Issue with acronym being only a math mode symbol in glossaries with xindy

I am using glossaries package to create a list of abbreviations. I need to use xindy because otherwise the character \"{o} breaks an acronym by being in the definition (and it sorts them better). However, I also use some acronyms that are just mathmode symbols such as $\alpha$. For some reason, when I have that as the acronym that should be displayed, no glossary displays at all. Taking out the symbol, using a non-mathmode symbol, or adding a normal character to the acronym all make it work just fine. Here is a simple example that does not work for me (using xindy makes no glossary, not using xindy only gives one glossary entry).

\documentclass[]{article}

\usepackage[xindy]{glossaries}

\makeglossaries

\newacronym{test}{$\alpha$}{this is a test word}
\newacronym{test1}{\AA}{\aa \"{o}this is a test word}

\begin{document}

This is an example \gls{test}. and again \gls{test1}.

\printglossary

\end{document}


Using Latexian, the PDF is made with no fatal errors, though the makeglossaries returns this: ERROR: CHAR: index 0 should be less than the length of the string.

I saw other questions that had errors with using xindy with glossaries, but they mostly seemed to deal with foreign language support. Any help would be appreciated.

One thing I just found to work (that I will probably do if I don't get a better answer, but I doesn't explain the error) is adding a non-breaking space after the mathmode symbol: $\alpha$~ though this makes the abbreviation "wider" than it should be.

• Have a look at the Q3 in the Troubleshooting section of the user guide. – Nicola Talbot Jun 15 '14 at 14:03
• @NicolaTalbot Thanks. I completely overlooked that. I posted my own answer below based on your comment. – ThomasH Jun 16 '14 at 13:53

Thanks to a comment by Nicola Talbot, I looked over Q3 in the Troubleshooting section of the user guide as directed. You can simply define a sorting value as an optional argument right after \newacronym to avoid issues with special characters (and even make it sort better).

I fixed the code above and it works great now:

\documentclass[]{article}

\usepackage[xindy]{glossaries}

\makeglossaries

\newacronym[sort=alpha]{test}{{$\alpha$}}{this is a test word}
\newacronym[sort=angstrom]{test1}{\AA}{\aa \"{o}this is a test word}

\begin{document}

This is an example \gls{test}. and again \gls{test1}.

\printglossary

\end{document}


Simple fix that even makes it better sorted.