Introduction to Nomenclature in LaTeX
In academic writing—especially in engineering, physics, and mathematics—it is common to use dozens of symbols, abbreviations, and variables. A Nomenclature is a specialized list that defines these terms in one central location, usually at the beginning or end of a document.
While you could manually create a list using a table or a description environment, LaTeX provides a powerful package called nomencl that automates this process. It handles the alphabetization, formatting, and cross-referencing for you, ensuring that your list of symbols remains consistent even as your document grows.
Setting Up the Nomenclature Package
To get started, you need to load the nomencl package in your preamble (the area before \begin{document}). There are two essential commands you must include to initialize the system.
The Basic Configuration
In your preamble, add the following:
\usepackage{nomencl}
\makenomenclature\usepackage{nomencl}: Loads the necessary tools to create the list.\makenomenclature: Tells LaTeX to start collecting symbols as it processes your document.
Displaying the List
To actually display the list in your document, you use the \printnomenclature command where you want the list to appear (commonly after the Table of Contents).
\begin{document}
\maketitle
\tableofcontents
\printnomenclature
\section{Introduction}
...
\end{document}Adding Entries to Your List
Once the setup is complete, you define symbols using the \nomenclature command anywhere in your document body. It is often best practice to define a symbol the very first time you use it in the text.
Syntax
The command follows this structure:
\nomenclature{symbol}{description}
Example: Basic Symbols
Here is how you would use it within a paragraph:
\section{Physics Basics}
The formula for force is $F = ma$, where $F$ is the force
\nomenclature{$F$}{Force applied to an object}
measured in Newtons, $m$ is the mass
\nomenclature{$m$}{Mass of the object}
and $a$ is the acceleration.
\nomenclature{$a$}{Acceleration}When you compile this, LaTeX will gather these definitions and place them in an alphabetized list under the heading "Nomenclature."
Note: The
\nomenclaturecommand does not print anything in the location where you type it. It silently sends the information to the list generator.
Compiling the Document
This is the step where most beginners encounter issues. Creating a nomenclature list requires a "middle-man" tool called makeindex.
If you are using an online editor like Typevia, this happens automatically. However, if you are working locally (using TeXshop, TeXstudio, or VS Code), a standard PDFLaTeX build will not show the list immediately.
To generate the list manually via the command line, you would run:
pdflatex yourfile.texmakeindex yourfile.nlo -s nomencl.ist -o yourfile.nlspdflatex yourfile.tex
Most modern LaTeX IDEs allow you to configure a "User Command" or "Build Tool" to handle this automatically.
Customizing Groups and Formatting
By default, LaTeX puts all symbols in a single list sorted alphabetically. However, complex documents often require symbols to be grouped (e.g., Roman Symbols, Greek Symbols, and Superscripts).
Organizing with Prefixes
The \nomenclature command accepts an optional argument for sorting:
\nomenclature[prefix]{symbol}{description}
LaTeX sorts the list based on this prefix. We can use this to group items.
Example: Grouping Symbols
To create groups, we redefine the \nomgroup command in the preamble.
\usepackage{nomencl}
\makenomenclature
% Customizing the group headings
\usepackage{ifthen}
\renewcommand{\nomgroup}[1]{%
\item[\bfseries
\ifstrequal{#1}{R}{Roman Symbols}{%
\ifstrequal{#1}{G}{Greek Symbols}{%
\ifstrequal{#1}{A}{Acronyms}{}}}
]}
\begin{document}
\nomenclature[R]{$d$}{Distance}
\nomenclature[G]{$\alpha$}{Angular acceleration}
\nomenclature[A]{NASA}{National Aeronautics and Space Administration}
\printnomenclature
\end{document}In this example:
[R]sorts the item under "Roman Symbols".[G]sorts the item under "Greek Symbols".[A]sorts the item under "Acronyms".
Changing the Title
If you want the heading to say "List of Symbols" instead of "Nomenclature," use the following command in your preamble:
\renewcommand{\nomname}{List of Symbols}Advanced Formatting: Adding Units
A common requirement in scientific papers is to include a column for units (like kg, m/s, etc.). While nomencl doesn't have a "units" column by default, we can trick the description field into formatting them nicely.
Example: Units Alignment
A clean way to do this is to use the \hfill command inside the description:
\nomenclature{$v$}{Velocity \hfill (m/s)}
\nomenclature{$E$}{Energy \hfill (J)}For even more precise alignment, many users define a custom command in the preamble:
\newcommand{\nomunit}[1]{%
\renewcommand{\nomentryend}{\hspace*{\fill}#1}%
}
% Usage in the document:
\nomenclature{$P$}{Pressure \nomunit{Pa}}Best Practices and Common Pitfalls
To keep your LaTeX project clean and professional, follow these tips:
- Define at First Use: Place the
\nomenclaturecommand immediately after the first time you use a symbol in your text. This ensures you don't forget to define anything. - Consistency in Math Mode: Always wrap symbols in dollar signs
$ $inside the command if they are mathematical variables.\nomenclature{v}{velocity}and\nomenclature{$v$}{velocity}will sort differently! - Use Prefixes for Symbols: LaTeX sorts by ASCII value. This means Greek letters (like
\alpha) might not sort where you expect them. Using prefixes like\nomenclature[g-alpha]{$\alpha$}{...}helps you control the order precisely. - Watch out for Special Characters: If your symbol involves a quote (
") or an at-symbol (@), you may need to "escape" it becausemakeindextreats those as special instructions.
Warning: If you add a nomenclature entry and it doesn't appear after compiling, try deleting the temporary files (like
.nlo,.nls, and.aux) and performing a clean "Build All" or "Recompile."
