% This file is embedded in glossaries-extra-manual.pdf 
% Example 128 Multi-entries: hierarchical with category suffix
% Label: "ex:multientryhiercatsuffix"
% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex
% arara: pdfcrop
\documentclass[12pt]{article}
\pagestyle{empty}
\usepackage[colorlinks]{hyperref}
\usepackage[stylemods=bookindex,style=bookindex]{glossaries-extra}


\makeglossaries


\newcommand{\latinname}[1]{\emph{#1}}
\glssetcategoriesattributes
 {genus,species}{textformat,glossnamefont}{latinname}


\setabbreviationstyle[genus]{long-only-short-only-desc}
\newabbreviation
 [category={genus},description={}]
 {clostridium}{C.}{Clostridium}


\newglossaryentry{botulinum}{name={botulinum},category={species},
 user1={botulism},
 description={},parent={clostridium}}
\newglossaryentry{perfringens}{name={perfringens},category={species},
 user1={gas gangrene},
 description={},parent={clostridium}}
\newglossaryentry{tetani}{name={tetani},category={species},
 user1={tetanus},
 description={},parent={clostridium}}


\mglsdefcategorysuffix{bacteria}{%
\mglsisfirstuse
 {\glsxtrifhasfield{useri}{\mglslastelementlabel}{ (\glscurrentfieldvalue)}{}}%
 {}%
} 

\multiglossaryentry[category=bacteria]{cbot}{clostridium,botulinum}
\multiglossaryentry[category=bacteria]{cperf}{clostridium,perfringens}
\multiglossaryentry[category=bacteria]{ctet}{clostridium,tetani}


\multiglossaryentrysetup{indexothers=false,hyper=allmain} 
\begin{document}
First use: \mgls{cbot}, \mgls{cperf}, \mgls{ctet}.


Next use: \mgls{cbot}, \mgls{cperf}, \mgls{ctet}.
\printglossaries 
\end{document}
