LaTeX glossary Nomenclatures

Original: Nomenclatures
Translated by: Xovee
Translation time: July 9, 2021

Term set Nomenclatures

In scientific research papers, the list of abbreviations and symbols is called Nomenclatures. This type of list can be generated by the nomencl package. This article describes how to create Nomenclatures, and how to customize the order and grouping rules of symbols.

Term set entries and index entries are very similar:

\documentclass{article}
\usepackage{nomencl}
\makenomenclature

\begin{document}
\mbox{}
\nomenclature{\(c\)}{Speed of light in a vacuum}
\nomenclature{\(h\)}{Planck constant}

\printnomenclature
\end{document}


Introduce the package in the preamble of the document: \ usepackage{nomencl}. It has three basic commands:

  • \makenomenclature: this command is usually placed after the command that introduces the package.
  • \nomenclature: defines term set entries. It has two parameters: symbol and its corresponding description.
  • \Print nomenclatures: print the term set.

Basic grammar

When introducing the nomencl package, you can pass additional parameters. The following example shows how to add a term set to the catalog and how to change the default language of the term set.

\documentclass{article}
\usepackage[spanish]{babel}
\usepackage[intoc, spanish]{nomencl}
\makenomenclature

\begin{document}
\tableofcontents

\section{Primera Sección}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Etiam lobortisfacilisis sem. Nullam nec mi et neque pharetra sollicitudin. Praesent imperdie...

\nomenclature{\(c\)}{Speed of light in a vacuum}
\nomenclature{\(h\)}{Planck constant}

\printnomenclature
\end{document}


Additional parameters used here include:

  • intoc: include the term set in the catalog
  • spanish: change the language and change the default title Nomenclatures to the title applicable to the corresponding language. Supported languages include croatian, danish, english, french, german, italian, polish, portuguese, russian, spanish, and ukranian.

Other useful features include: you can manually set the title of the glossary and add additional comments.

\documentclass{article}
\usepackage{nomencl}
\makenomenclature

\renewcommand{\nomname}{List of Symbols}

\renewcommand{\nompreamble}{The next list describes several symbols that will be later used within the body of the document}

\begin{document}
\mbox{}

\nomenclature{\(c\)}{Speed of light in a vacuum}
\nomenclature{\(h\)}{Planck constant}

\printnomenclature
\end{document}


command

\renewcommand{\nomname}{List of Symbols}

Changed the default title.

command

\renewcommand{\nompreamble}{The next list...}

Added text between title and symbol table.

grouping

We will now show you how to group symbols. We add a prefix to each symbol, and then use the etoolbox package to compare the prefixes.

\documentclass{article}
\usepackage{amssymb}
\usepackage{nomencl}
\makenomenclature

%% This code creates the groups
% -----------------------------------------
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
  \item[\bfseries
  \ifstrequal{#1}{P}{Physics constants}{%
  \ifstrequal{#1}{N}{Number sets}{%
  \ifstrequal{#1}{O}{Other symbols}{}}}%
]}
% -----------------------------------------

\begin{document}
\mbox{}

\nomenclature[P]{\(c\)}{Speed of light in a vacuum}
\nomenclature[P]{\(h\)}{Planck constant}
\nomenclature[P]{\(G\)}{Gravitational constant}
\nomenclature[N]{\(\mathbb{R}\)}{Real numbers}
\nomenclature[N]{\(\mathbb{C}\)}{Complex numbers}
\nomenclature[N]{\(\mathbb{H}\)}{Quaternions}
\nomenclature[O]{\(V\)}{Constant volume}
\nomenclature[O]{\(\rho\)}{Friction index}

\printnomenclature
\end{document}


In this example, we added some groups. The code is not simple. We used the command \ ifstrequal {} {}. The first two parameters are strings used for comparison. If they are the same, they are added to a group. If they are different, the next nested condition is checked.

Note that each \ nomenclature command has an additional parameter in square brackets: prefix.

If you can't use the etoolbox package, you can use the ifthen package, which provides the conditional command \ ifthenelse {}. Its syntax is a little more complex.

\usepackage{ifthen}
  \renewcommand{\nomgroup}[1]{%
  \item[\bfseries
  \ifthenelse{\equal{#1}{P}}{Physics constants}{%
  \ifthenelse{\equal{#1}{O}}{Other symbols}{%
  \ifthenelse{\equal{#1}{N}}{Number sets}{}}}%
  ]}

The above code will generate the same term set grouping.

Add units to physical constants

You can also use the siunitx package to add units and align the units to the right of the corresponding entry. You need to define the nomunit macro instruction first. Here is an example:

\documentclass{article}
\usepackage{amssymb}
\usepackage{nomencl}
\usepackage{siunitx}
\usepackage{hyperref}
\makenomenclature
\hypersetup{
    colorlinks=true,
    urlcolor=blue,
}
%% This will add the subgroups
%----------------------------------------------
\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
  \item[\bfseries
  \ifstrequal{#1}{A}{Physics Constants}{%
  \ifstrequal{#1}{B}{Number Sets}{%
  \ifstrequal{#1}{C}{Other Symbols}{}}}%
]}
%----------------------------------------------

%% This will add the units
%----------------------------------------------
\newcommand{\nomunit}[1]{%
\renewcommand{\nomentryend}{\hspace*{\fill}#1}}
%----------------------------------------------

\title{Nomenclatures Example}
\author{Overleaf Team}
\date{\today}

\begin{document}
\maketitle

\noindent This is an example to show how the \texttt{nomencl} package works, with units typeset via the \texttt{siunitx} package. \href{https://www.nist.gov/pml/fundamental-physical-constants}{NIST} was referenced to provide the values of physical constants, and their corresponding units---links are provided via the \texttt{hyperref} package:

\nomenclature[A, 02]{\(c\)}{\href{https://physics.nist.gov/cgi-bin/cuu/Value?c}
{Speed of light in a vacuum}
\nomunit{\SI{299792458}{\meter\per\second}}}
\nomenclature[A, 03]{\(h\)}{\href{https://physics.nist.gov/cgi-bin/cuu/Value?h}
{Planck constant}
\nomunit{\SI[group-digits=false]{6.62607015e-34}{\joule\per\hertz}}}
\nomenclature[A, 01]{\(G\)}{\href{https://physics.nist.gov/cgi-bin/cuu/Value?bg}
{Gravitational constant} 
\nomunit{\SI[group-digits=false]{6.67430e-11}{\meter\cubed\per\kilogram\per\second\squared}}}
\nomenclature[B, 03]{\(\mathbb{R}\)}{Real numbers}
\nomenclature[B, 02]{\(\mathbb{C}\)}{Complex numbers}
\nomenclature[B, 01]{\(\mathbb{H}\)}{Quaternions}
\nomenclature[C]{\(V\)}{Constant volume}
\nomenclature[C]{\(\rho\)}{Friction index}

\printnomenclature

\end{document}

Sort entries

The following is the default sort order:

\documentclass{article}
\usepackage{nomencl}

\makenomenclature

\begin{document}
\mbox{}

\nomenclature{\(+a\)}{Operator}
\nomenclature{\(2a\)}{Number}
\nomenclature{\(:a\)}{Punctuation symbol}
\nomenclature{\(Aa\)}{Uppercase letter}
\nomenclature{\(aa\)}{Lowercase letter}
\nomenclature{\(\alpha\)}{Greek character}

\printnomenclature

\end{document}


Note that in the above example, the Greek letter precedes the English letter because of the backslash \ (for example, \ alpha).

Similar to grouping, you can add a prefix to manually sort term set entries:

\documentclass{article}
\usepackage{nomencl}

\makenomenclature

\begin{document}
\mbox{}

\nomenclature[06]{\(+a\)}{Operator}
\nomenclature[03]{\(2a\)}{Number}
\nomenclature[05]{\(:a\)}{Punctuation symbol}
\nomenclature[04]{\(Aa\)}{Uppercase letter}
\nomenclature[01]{\(aa\)}{Lowercase letter}
\nomenclature[02]{\(\alpha\)}{Greek character}

\printnomenclature

\end{document}


The numbers in square brackets represent the order of the corresponding characters. You can also use both grouping and manual sorting:

\documentclass{article}
\usepackage{amssymb}
\usepackage{nomencl}
\makenomenclature

\usepackage{etoolbox}
\renewcommand\nomgroup[1]{%
  \item[\bfseries
  \ifstrequal{#1}{A}{Physics Constants}{%
  \ifstrequal{#1}{B}{Number Sets}{%
  \ifstrequal{#1}{C}{Other Symbols}{}}}%
]}

\begin{document}
\mbox{}

\nomenclature[A, 02]{\(c\)}{Speed of light in a vacuum}
\nomenclature[A, 03]{\(h\)}{Planck constant}
\nomenclature[A, 01]{\(G\)}{Gravitational constant}
\nomenclature[B, 03]{\(\mathbb{R}\)}{Real numbers}
\nomenclature[B, 02]{\(\mathbb{C}\)}{Complex numbers}
\nomenclature[B, 01]{\(\mathbb{H}\)}{Octonions}
\nomenclature[C]{\(V\)}{Constant volume}
\nomenclature[C]{\(\rho\)}{Friction index}

\printnomenclature

\end{document}


Note that the capital letters used for grouping here are different from our previous examples because they are used to sort different groups.

Keywords: Latex

Added by Divided on Sun, 23 Jan 2022 13:10:12 +0200