5

I use the nomenclature package to create nomenclature sections for my papers. I haven't done a paper in a while with a nomenclature, but today it is not working.

In order to use the nomenclature package, I need to run makeindex and then rerun my LaTeX file. I normally have the following at the very first line of my LaTeX file and everything works fine automatically pretty much.

\immediate\write18{makeindex "paper".nlo -s nomencl.ist -o "paper".nls}

Today it isn't working though. It seems as though \write18 restricted mode is the problem. It's possible something changed with TeX Live since I last wrote a paper with a nomenclature section when I upgrade my operating system at some point.

I can get bibtex to run with \write18. Any reason why makeindex would not work? I thought it should be a safe program.

If I run with --shell-escape, everything works fine, but I don't want to do that because restricted mode was created for a reason. I can also run the makeindex command manually in a bash shell and everything works fine, but I am using kile and don't want to have to run another command all the time.

Simplest example file I can create:

\immediate\write18{makeindex "paper".nlo -s nomencl.ist -o "paper".nls}
\documentclass[11pt]{article}
\usepackage{nomencl}
\makenomenclature
\begin{document}
    \printnomenclature
    some text
    \nomenclature{$symbol$}{description}
\end{document}

Running pdflatex paper.tex produces no nomenclature. Running pdflatex --shell-escape paper.tex produces a nomenclature. When testing, make sure you delete all the extra files in the directory after running with --shell-escape or change the symbol name because you may think the problem is solved when in fact the makeindex command was just run by your last test.

How can I see what commands are allowed in restricted mode? If I run kpsewhich --var-value shell_escape_commands in bash, it returns 'bibtex,bibtex8,kpsewhich,makeindex,mpost,repstopdf,'. So, It seems as if makeindex should work.

I am using pdflatex on Ubuntu 13.04.

  • Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. You might also want to add to your question how you're including the pdfs etc. – Aradnix Aug 29 '14 at 1:54
4

If I run the example, I get

runsystem(makeindex "donom".nlo -s nomencl.ist -o "donom".nls)...quotation error in system command.

in the log file; tested with MacTeX/TeX Live 2014 on Mac OS X and TeX Live/Debian 2013 on a Debian box.

On the other hand, if I change the line into

\immediate\write18{makeindex "\jobname.nlo" -s nomencl.ist -o "\jobname.nls"}

then the command is executed.

Note that using \jobname instead of the actual file name allows for reusing the code. Also, I'd use

\immediate\write18{makeindex -s nomencl.ist -o "\jobname.nls" "\jobname.nlo"}

because this is a more common syntax (however, makeindex accepts options also after the file name).

There is also a different strategy, that is, using arara:

% arara: nomencl
% arara: pdflatex

\documentclass[11pt]{article}
\usepackage{nomencl}
\makenomenclature
\begin{document}
    \printnomenclature
    some text
    \nomenclature{$symbol$}{description}
\end{document}

If you run the command line

arara -v <filename>

you'll achieve the same effect.

0

It looks like the unusual file name quotation (i.e. "paper".nlo and "paper".nls) became an issue for restricted \write18. I don't know why I had used that in the past but it must have been some quirk related to makeindex that required it. That quirk seems to be fixed now. So, if I change to

\immediate\write18{makeindex paper.nlo -s nomencl.ist -o paper.nls}

everything works as expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.