0

I am writing a doctoral thesis which prints all acronyms called with \gls{} from the glossaries package to an Index made with \makeindex. I used code from a previous question: Acronyms only shown in Index when used twice.

I wish to add subentries in the Index for some of the called acronyms but the acronym entries appear twice:

example1

It seems the entries I index manually in the text with \index{} get printed separately from the acronyms automatically printed every time I use \gls{}.

How can I add index subentries properly inside the ones being called automatically? Without losing the automation I already have while using \gls{}, I would like to generate this :

example2

MWE:

\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)\protect\index{\the\glslongtok\space(\the\glsshorttok)}},%
  firstplural={\the\glslongtok\noexpand\acrpluralsuffix\space(\the\glsshorttok)\protect\index{\the\glslongtok\space(\the\glsshorttok)}},%
  description={\the\glslongtok}%
}

\SetCustomStyle

\newacronym{cd}{CD}{compact disk}
\newacronym{hgh}{HGH}{human growth hormone}


\begin{document}
\noindent
First use of \gls{cd}. That donkey\index{donkey} has a \gls{cd}.
\index{cd@\glsfirst{cd}}

\Gls{hgh} is a protein\index{protein}. \gls{hgh} can be purified by chromatography. 
%\index{hgh@\glsfirst{hgh}}
\index{hgh@\glsfirst{hgh}!purification}
\newpage
Discovery of \gls{hgh}. \index{hgh@\glsfirst{hgh}!discovery}
\printglossaries
\printindex

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.