4

How can I exclude the 'main' glossary from the printglossaries macro, since I want to be able to use one format for the main glossary, and a different one for the remaining.

IE I would like to be able to do something like this:

%Print the main glossary
\glossarystyle{altlist}
\printglossary[type=main]

%Print the remaining glossaries
\glossarystyle{list}
\printglossaries

Therefore, in the above, the command \printglossaries should print the remaining glossaries EXCLUDING the main glossary (ie, for example, acronyms, nomenclature, symbols and user defined glossaries)

I also have a 'hidden' glossary, which I use for some internal document nomenclatures, which I don't want printed at all.

At the moment, in the above, the main glossary is duplicated.

1 Answer 1

3

\printglossaries is just defined to iterate over all glossaries using:

\forallglossaries{\@@glo@type}{\printglossary[type=\@@glo@type]}

This command has an optional argument that can be used to specify a subset of glossaries to iterate over, so instead of doing \printglossaries, you could do:

\forallglossaries[foo,bar,baz]{\glotype}{\printglossary[type=\glotype]}

To just print the glossaries whose labels are foo, bar and baz.

Here's a more generic approach:

\documentclass{article}

\usepackage{etoolbox}
\usepackage[acronym,symbols,numbers,index]{glossaries}

\makeglossaries

\newglossaryentry{sample1}{name={sample1},description={}}
\newglossaryentry{sample2}{type={symbols},name={sample2},description={}}
\newglossaryentry{sample3}{type={numbers},name={sample2},description={}}

\newacronym{abc}{ABC}{an example acronym}
\newterm{sample}

\newcommand*{\shownlist}{}
\renewcommand*{\glossarypreamble}{\listxadd\shownlist{\currentglossary}}

\newcommand*{\printremaining}{%
  \renewcommand*{\glossarypreamble}{}%
  \forallglossaries{\glotype}{%
    \xifinlist{\glotype}{\shownlist}{}{\printglossary[type=\glotype]}%
  }%
}

\begin{document}

\glsaddall

\printglossary
\printindex

\printremaining

\end{document}

This produces:

Image of all glossaries

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .