Latest news 2024-09-23: new blog post "Tales for Our Times: Raising Funds and Awareness for St Martins Housing Trust".

Gallery: Homograph Entries

image of glossary where child entries don\'t have a name and are numbered
This example has homograph glossary entries. This simulates terms that can have multiple meanings. For example, “quarry” can mean a place that’s dug up for stone or other materials (either as a noun indicating the place or a verb indicating the action of digging out the resources), or “quarry” can mean something that’s chased or hunted, or “quarry” can mean an unglazed floor tile or diamond-shaped pane in a lattice window. Although here I’ve used dummy lorum ipsum text instead of real terms.

This example uses the mcoltreenoname style, which supports homograph glossaries but isn’t provided by default, so you have to load the glossary-mcols package in order to use it. I’ve also used the subentrycounter option to automatically number the child definitions. (The numbering is reset at the start of each sub-level 1 list.)

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

 % arara: pdflatex
 % arara: makeglossaries
 % arara: pdflatex
\documentclass{report}

\usepackage[colorlinks]{hyperref}
\usepackage[nopostdot,toc]{glossaries}
\usepackage{glossary-mcols}

\makeglossaries

\loadglsentries{example-glossaries-childnoname}

\begin{document}

\chapter{Sample}

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

\printglossary[style=mcoltreenoname,subentrycounter]

\end{document}

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{sedfeugiat}.

The entries have all been defined in the file example-glossaries-childnoname.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{scelerisque}{name={scelerisque},description={at}}

\newglossaryentry{vestibulum}{parent={scelerisque},description={eu,
nulla}}

\newglossaryentry{utodionisl}{parent={scelerisque},description={facilisis
id}}

\newglossaryentry{molliset}{parent={scelerisque},description={nec,
enim}}

\newglossaryentry{aeneansem}{parent={scelerisque},description={sem
leo}}

Note that the unlike the Hierarchical Entries example here the child entries inherit their name from their parent entry.

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

pdflatex homograph
makeglossaries homograph
pdflatex homograph

(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 (42.97K), source code (408B), sample glossary definitions (2.85K).