5

I'm trying to get a nomenclature running in LaTeX. The problem is that the nomenclature never is printed. I got an example from here:

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{nomencl}
\makenomenclature

\begin{document}

\nomenclature{$c$}{Speed of light in a vacuum inertial frame}
\nomenclature{$h$}{Planck constant}

\printnomenclature
\end{document}

Without printing errors this wouldn't even create a PDF.

I use Ubuntu 15.04, I have almost all texlive-packages installed, I compile using TexStudio and XeLaTex.

What must I do to get the nomenclature running?

2
  • Welcome to TeX.SX! You have no typesetting text in your document!
    – user31729
    Oct 25, 2015 at 11:58
  • I've deleted the xetex tag since this question is not related to xelatex or xetex at all
    – user31729
    Oct 25, 2015 at 12:03

1 Answer 1

4

The nomencl package needs some typeset text in the document -- otherwise it won't write the foo.nlo file (if the document is called foo.tex).

After the foo.nlo exists, it's necessary to use (in terminal or in an editor 'external utilities' command.)

makeindex -s nomencl.ist -o foo.nls foo.nlo

The nomencl.ist is provided by the nomencl package already.

\documentclass{article}
\usepackage[utf8]{inputenc}

\usepackage{nomencl}
\makenomenclature

\begin{document}

\nomenclature{$c$}{Speed of light in a vacuum inertial frame}
\nomenclature{$h$}{Planck constant}

Some text

\printnomenclature
\end{document}

enter image description here

6
  • 2
    I couldn't get it running. If I copy and paste your code into test.tex and then compile it through TexStudio with XeLaTex, the only visible thing in the resulting test.pdf is "Some text". Other then that there is a test.aux, test.log, test.nlo, test.ssynctex.gz.
    – Socrates
    Oct 25, 2015 at 16:38
  • With typeset you mean "Some text", right?
    – Socrates
    Oct 25, 2015 at 16:41
  • @Socrates: Exactly, Some text, that is typesetting. Without it you have an empty document and there will be no nomenclature. By the way, if you use xelatex, what's the purpose of \usepackage{inputenc} then? And it works the way I wrote in my post too (even with xelatex)!
    – user31729
    Oct 25, 2015 at 20:59
  • Let's assume that your main file is foo.tex. If you already have an foo.nls file, it is advisable to delete it, and run the command above makeindex foo.nlo -s nomencl.ist -o foo.nls with your current foo.nlo file. Make a copy of your nls before deleting it. Dec 19, 2019 at 2:04
  • 3
    Because it took me an hour to figure this out for TeXStudio: In Settings --> Build, I defined a user command makenomindex, as follows: makeindex -s nomencl.ist -o %.nls %.nlo, then updated the default Compiler sequence from txs:///pdflatex to txs:///pdflatex | txs:///makenomindex | txs:///pdflatex. I'm not sure if that is the most robust or most elegant way of doing it, but it seems to work. I suspect that there is a better way but I've never before modified the TeXStudio pipeline by hand, so I don't feel qualified to say.
    – Zak
    Jul 6, 2022 at 16:38

Not the answer you're looking for? Browse other questions tagged .