The argument of \index
doesn't get expanded when written to the .idx
file, so makeindex
is trying to sort \glsfirst{cd}
. Since makeindex
doesn't interpret TeX commands, it views this as a string starting with the backslash character, which is why the entry is considered a symbol. Here's a way of automatically indexing subsequent uses of the acronyms that expands the indexed term before writing it to the .idx
file:
\documentclass[11pt]{article}
\usepackage{makeidx}
\makeindex
\usepackage[acronym,toc,shortcuts]{glossaries}
\makeglossaries
\renewcommand*{\CustomAcronymFields}{%
name={\the\glsshorttok},%
symbol={\the\glsshorttok},%
text={\the\glsshorttok\protect\index{\the\glslongtok\space(\the\glsshorttok)}},%
plural={\the\glsshorttok\noexpand\acrpluralsuffix\protect\index{\the\glslongtok\space(\the\glsshorttok)}},%
first={\the\glslongtok\space(\the\glsshorttok)},%
firstplural={\the\glslongtok\noexpand\acrpluralsuffix\space(\the\glsshorttok)},%
description={\the\glslongtok}%
}
\SetCustomStyle
\newacronym{cd}{CD}{compact disk}
\begin{document}
\noindent
First\index{first} use of \gls{cd}\\
subsequent\index{subsequent} use of \gls{cd}.
\printglossaries
\printindex
\end{document}
Assuming I have the makeindex
headings flag set (via headings_flag 1
in a .ist
file) I get the following index:

If you only want to index some subsequent entries rather than all of them, here's another approach that saves the index command with expanded argument in the user1
field:
\documentclass[11pt]{article}
\usepackage{makeidx}
\makeindex
\usepackage[acronym,toc,shortcuts]{glossaries}
\makeglossaries
\renewcommand*{\CustomAcronymFields}{%
name={\the\glsshorttok},%
symbol={\the\glsshorttok},%
text={\the\glsshorttok},%
plural={\the\glsshorttok\noexpand\acrpluralsuffix},%
first={\the\glslongtok\space(\the\glsshorttok)},%
firstplural={\the\glslongtok\noexpand\acrpluralsuffix\space(\the\glsshorttok)},%
description={\the\glslongtok},%
user1={\protect\index{\the\glslongtok\space(\the\glsshorttok)}}%
}
\SetCustomStyle
\newacronym{cd}{CD}{compact disk}
\begin{document}
\noindent
First\index{first} use of \gls{cd}\\
subsequent\index{subsequent} use of \gls{cd}.
\newpage
Another use of \gls{cd}\glsuseri{cd}.
\printglossaries
\printindex
\end{document}
The index now looks like:

\index
after running\gls
. You should get aAcronyms
chapter with all your\gls
entries and anIndex
chapter with "fist" and "subsequent. Is that what you want?\index{compact@\glsfirst{cd}}
. Haven't tried it. Maybe with space after@
or curly brackets around the\glsfirst{cd}
. Give it a try.\let\oldgls\gls \renewcommand*{\gls}[1]{\oldgls{#1}\index{#1@\glsfirst{#1}}}