Gallery: Hierarchical Entries

If you have a small screen, you may prefer to switch on the small image setting.

image of hierarchical glossary with each level indented slightly more than the previous

This example has hierarchical glossary entries. Unlike the Homograph Entries example, here the child entries don’t inherit their name from their parent. This example uses the tree style, which is one of the predefined styles that supports hierarchical glossaries.

The initial comment lines below are arara directives. You can remove them if you don’t use arara.

% arara: pdflatex
% arara: makeglossaries
% arara: pdflatex






\forglsentries{\thislabel}{\gls{\thislabel}. }



This document loads the hyperref package, which creates hyperlinks from the entries in the document (referenced using commands like \gls) to their definition in the glossary. These hyperlinks are displayed in red text. I’ve used \forglsentries for this example to iterate over all the defined entries. In practice, you would typically just use commands like \gls{label} in the text. For example:

Here is a reference to the term \gls{sedmattis}.

The entries have all been defined in the file example-glossaries-parent.tex, which you should find installed in the same location as the glossaries package (or in a sub-directory called test-entries). The entry definitions look like this:

\newglossaryentry{sedmattis}{name={sed mattis},description={erat sit


\newglossaryentry{elitaugue}{parent={sedmattis},name={elit augue},
description={egestas diam}}


If you don’t use arara, you need to run the following commands:

pdflatex hierarchical
makeglossaries hierarchical
pdflatex hierarchical

(See Incorporating makeglossaries or makeglossaries-lite or bib2gls into the document build.)

I’ve used the nopostdot option to remove the terminating full stop that is placed by default after the description. The entries all have a “1” after the description. This is the page number on which the entry was referenced. In this sample document all the entries were referenced on page 1. If you don’t want these numbers you can use the nonumberlist option.

Download: PDF (40.26K), source code (346B), sample glossary definitions (1.86K).