# [Tex/LaTex] Nomenclature and document class in Sharelatex

nomenclaturesharelatex

I've been trying to make a nomenclature for a project in sharelatex.com with book as document class. The nomenclature does not print and there is no warning or error. As part of my troubleshooting I copied the project and fiddled around a bit before eventually noticing that when i changed document class to article the nomenclature showed up (chaning to report did nt make any difference). I then changed the document class back to book and the nomenclature was still there (!).

After that I did the same in the original document, but no luck this time. My question is how does the nomenclature function depend on document class?

Relevant code:

\documentclass[12pt,twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage{nomencl}
\usepackage{etoolbox}
\makenomenclature

\begin{document}

\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{S}{Symbols}{%
\ifstrequal{#1}{T}{Subscripts}{%
\ifstrequal{#1}{Y}{Abbreviations}{}}}%
]}
\nomenclature[S]{$MW$}{Molecular weight [kg/kmol]}
\nomenclature[T]{$1$}{Inlet}
\nomenclature[Y]{CL}{Control line}

\printnomenclature

\end{document}


Your example doesn't produce any output because \nomenclature doesn't display any text and \printnomenclature doesn't do anything if the associated file (which needs to be created by makeindex) doesn't exist.

ShareLaTeX fails and interrupts the complete build process because no PDF file is created on the first instance of pdflatex. If you start to modify the document by adding in some sample text, then the build process can be completed and ShareLaTeX will run makeindex which will create the file needed by \printnomenclature.

If you then modify the document again, removing the inserted sample text, the file required by \printnomenclature is still present so it can be input, which means that the PDF can be created, so ShareLaTeX's build process won't be interrupted. If you clear all the temporary files, including the one needed by \printnomenclature, then the document goes back to being empty again and the build process can't be completed.

The simplest thing to do is just add some text to the document or simply \mbox{} to ensure the PDF contains at least one page:

\documentclass[12pt,twoside]{book}
\usepackage[utf8]{inputenc}
\usepackage{nomencl}
\usepackage{etoolbox}
\makenomenclature

\begin{document}
\renewcommand\nomgroup[1]{%
\item[\bfseries
\ifstrequal{#1}{S}{Symbols}{%
\ifstrequal{#1}{T}{Subscripts}{%
\ifstrequal{#1}{Y}{Abbreviations}{}}}%
]}
\nomenclature[S]{$MW$}{Molecular weight [kg/kmol]}
\nomenclature[T]{$1$}{Inlet}
\nomenclature[Y]{CL}{Control line}

\printnomenclature

\mbox{}
\end{document}


## General Information on ShareLaTeX with nomencl

If you click on the "logs and output files" button (highlighted below next to the "Recompile" button) and the click on the "Other logs & files" drop-down, you'll get the list of associated files created by LaTeX and (in this case) by makeindex.

The files relating to the nomencl package are:

• nlg the log file created by makeindex.
• nlo the file created by \makenomenclature and written to with every instance of \nomenclature.
• nls the typesetting instructions for the nomenclature written by makeindex and input by \printnomenclature. In this example, the file contains the code:

\begin{thenomenclature}

\nomgroup{S}

\item [{$MW$}]\begingroup Molecular weight [kg/kmol]\nomeqref {0}
\nompageref{1}

\nomgroup{T}

\item [{$1$}]\begingroup Inlet\nomeqref {0}\nompageref{1}

\nomgroup{Y}

\item [{CL}]\begingroup Control line\nomeqref {0}\nompageref{1}

\end{thenomenclature}


If you change the document class, \printnomenclature still tries to input the same nls file as before. If that file hasn't been deleted or changed then it will still be input. It may be that the thenomenclature environment behaves slightly differently with a different class (for example, using \section* instead of \chapter*) which will alter the way the nomenclature appears but it's still the same file as before.

If you delete the nls file, then the nomenclature will no longer appear (because \printnomenclature can't find the file).

The document build process is (assuming the main document file is called main.tex):

pdflatex main
makeindex main.nlo -s nomencl.ist -o main.nls
pdflatex main


When you click on ShareLaTeX's "Recompile" button, it will perform all three of these steps (assuming you have the compiler set to pdflatex). If your nomenclature doesn't show then perform the following checks:

1. Check you have \makenomenclature in the preamble.
2. Check you have one or more \nomenclature in the document.
3. Check you have \printnomenclature in the document.
4. Check the nlg file for errors from makeindex
5. Check the nls file exists and contains valid LaTeX code (\begin{thenomenclature} ... \end{thenomenclature} with one or more \item).

You can delete all these auxiliary files using the "clear cached files" button next to the "other logs & files" drop-down list. This pops up a confirmation box:

Once you've deleted these files, click on the "Recompile" button to rebuild the document, and then they should all be created again.