[Tex/LaTex] Add all entries from one specific glossary

glossarieslatexmk

I created different glossaries to store different types of informations in my document (in the specific case there are two additional glossary types: greek and nondim other than main and acronyms).

\usepackage[toc,acronyms]{glossaries}
\newglossary[zlg]{greek}{zld}{zln}{Greek Symbols} %Greek Letters
\newglossary[nng]{nondim}{nnd}{nnn}{Non-dimensional Groups} %Non-Dimensional Numbers

With this what I achieve is that I have a list of glossaries used for acronyms that are added using \gls{acronym},
the standard glossary is used, for example, for Latin symbols:

\newglossaryentry{latin:h}{
    name=$h$,
    description={Enthalpy per unit of mass},
    sort=h
}

then I use the other glossaries, as an example, for greek symbols and non-dimensional groups:

\newglossaryentry{symb:Gamma}{
    name=$\gamma$,
    description={Generic property subjected to operators},
    sort=gamma, type=greek
}

\newglossaryentry{ndg:St}{
    name=$St$,
    description={Stokes number $\frac{18\mu_c}{\rho_p d_p^2}\frac{U}{D}$},
    sort=St, type=nondim
}

What I would like to achieve now is to use \glsaddall for specific types, in particular I would like to print all the glossaries from the main, greek and nondim types but not from the acronyms that instead have to show up only if explicitly called wih \glsadd in the text.

This is how I'm actually printing the glossaries in my document:

\printglossary[type=\acronymtype]
\printglossary[type=main,style=long,nonumberlist,nopostdot,title={Latin Symbols}]
\printglossary[type=greek,style=long,nonumberlist,nopostdot]
\printglossary[type=nondim,style=long,nonumberlist,nopostdot]

but if I do not use \glsaddall the glossaries in main, greek and nondim are not showing up (not being explicitly added in the text), if I use \glsaddall I see correctly all the glossaries from all the types, but I see also acronyms that I did not use in the text.

Any suggestion?

Best Answer

\glsaddall has an optional argument, which allows for specification which glossary types should be used:

\glsaddall[types={main,greek,nondim}]

\documentclass{article}



\usepackage[toc,acronyms]{glossaries}

\newglossary[zlg]{greek}{zld}{zln}{Greek Symbols} %Greek Letters
\newglossary[nng]{nondim}{nnd}{nnn}{Non-dimensional Groups} %Non-Dimensional Numbers


\makeglossaries


\newglossaryentry{latin:h}{
    name=$h$,
    description={Enthalpy per unit of mass},
    sort=h
}


\newglossaryentry{symb:Gamma}{
    name=$\gamma$,
    description={Generic property subjected to operators},
    sort=gamma, type=greek
}

\newglossaryentry{ndg:St}{
    name=$St$,
    description={Stokes number $\frac{18\mu_c}{\rho_p d_p^2}\frac{U}{D}$},
    sort=St, type=nondim
}

\newacronym{zdf}{ZDF}{Zweites Deutsches Fernsehen}

\begin{document}


%\glsaddall% Adds any gls - entry, e.g. acronyms
% Select only particular types: 
\glsaddall[types={main,nondim,greek}]


\printglossary[type=\acronymtype]
\printglossary[type=main,style=long,nonumberlist,nopostdot,title={Latin Symbols}]
\printglossary[type=greek,style=long,nonumberlist,nopostdot]
\printglossary[type=nondim,style=long,nonumberlist,nopostdot]


\end{document}

enter image description here

Related Question