Icon for parent category 'Writing'

Special Pages II

Continuing on last chapter, here are the two other quite important special pages. The main purpose of LaTeX was to easily write clear and beautiful (scientific) papers or lasting documents for global consumption. These special pages help achieve that goal, even if they sometimes feel unnecessary or like a pain to write.

Glossary

A glossary is a list with terms and their definitions. These terms could be known by the reader, but they are usually field-specific and it’s best to clarify exactly what you mean with them somewhere. On top of that, it keeps track of a list of page numbers where the terms occur, just like the index.

First, include the glossaries package. Then create enw entries with …

1\newglossaryentry{label} {
2    name=name,
3    description={description} 
4}

The name and description are what’s actually displayed in the glossary. The label is used to find all occurrences throughout the document.

This is very precise. You don’t want to type the label with a capital letter in one place, and all lowercase somewhere else, as that would show up as two different entries for the glossary.

Therefore, the glossary package also adds commands to help you transform labels to make them consistent.

CommandDescription
gls{label}Prints the label all lowercase
Gls{label}Prints the label with a capital starting letter
glspl{label}Prints the label all lowercase, in plural form
Glspl{label}Prints the label with capital letter, in plural form

Just like the index, the glossary is resource intensive and needs some extra steps to activate fully.

  • To make the glossary as it’s compiling, use the \makeglossary command at the top.
  • To print it, use \printglossary.
 1\usepackage{glossaries}
 2\makeglossary
 3
 4\newglossaryentry{arithm} {
 5    name=arithmetic,
 6    description={Doing computations with numbers}
 7}
 8
 9\newglossaryentry{add} {
10    name=addition,
11    description={Adding numbers together}
12}
13
14\begin{document}
15    \Gls{arithm} is a fascinating subject. We'll talk mostly about \Glspl{add}, subtraction, multiplication, and division. Have fun!
16
17    \printglossary
18\end{document}
Code above > output below
Code above > output below

Acronyms

On top of a glossary of terms, you can also include the expanded form of acronyms.

To create a new acronym entry, use:

1\newacronym{label}{acronym}{full form}

Within the text, you can use these three commands:

CommandDescription
acrlong{label}Prints full form only
acrfull{label}Prints full form (acronym)
acrshort{label}Prints acronym only

To print it, use \printglossary[type=\acronymtype].

 1\usepackage[acronym]{glossaries}
 2\makeglossary
 3
 4\newacronym{www}{WWW}{World Wide Web}
 5
 6\begin{document} 
 7    The \acrlong{www} is a great place. For example, on the \acrfull{www} you can learn all about the \LaTeX{} language!
 8
 9    \printglossary[type=\acronymtype]
10\end{document}
Code above > output below
Code above > output below

Nomenclature

A nomenclature declares definitions for names or notations. It seems exactly the same as a glossary, but there are two important differences:

  • It only explains names you invented or assigned yourself
  • It doesn’t count the pages on which they occur.
Example

The term speed of light fits the glossary. The symbol c could be explained in the nomenclature to mean the speed of light in your document.

First, include the nomencl package. Add entries using

1\nomenclature{name or notation}{explanation}

Don’t forget the remaining two-step-process for these special pages:

  • At the top of the document, use \makenomenclature to make it
  • Later use \printnomenclature to print it on the page.
1\usepackage{nomencl}
2\makenomenclature
3
4\begin{document}
5    \nomenclature{$c$}{Speed of Light}
6    \nomenclature{$e$}{Euler's Number} The speed of light is a very important concept in modern physics.
7
8    \printnomenclature
9\end{document}
Code above > output below
Code above > output below
Continue with this course
Support me and this website!

Want to support me?

Buy one of my projects. You get something nice, I get something nice.

Donate through a popular platform using the link below.

Simply giving feedback or spreading the word is also worth a lot.