I'm trying to implement the nomencl package in my Master's thesis, but I'm experiencing serious trouble when it comes to make latexmk/makeindex create or update the nls file. I ended up creating the nls file manually from terminal (according to the nomencl documentation), but it won't update. I'm using TeX Live and Sublime Text 2 with LaTeXTools.

So, according to quite wide web I'm not the only one having troubles making nomencl and latexmk/makeindex communicate properly. According to one thread, I tried to add the following code to a latexmkrc file:

# for nomenclature
add_cus_dep("nlo", "nls", 0, "nlo2nls");
sub nlo2nls {
    system("makeindex $_[0].nlo -s nomencl.ist -o $_[0].nls -t $_[0].nlg");

I found no less than 8 latexmkrc files on my Mac, none of them located according to the latexmk documentation, and with no response to print('Hello, world!'); added to any of the files. I also tried to make a latexmkrc file in /opt/local/share/latexmk/LatexmK (and /opt/local/share/latexmk, just in case). Neither responds to

Hello, world!

My question is: how do I get the nls file to be created and updated automatically?

  • 1
    As @texenthusiast writes in his answer, a good place to put a configuration like this is in a file named .latexmkrc in your home directory. But I think you may have misunderstood the documentation for the names of the system-wide configuration files. These are files named LatexMk in one of the directories /opt/local/share/latexmk/ /usr/local/share/latexmk/ /usr/local/lib/latexmk/ (There are some backwards compatibility reasons for the naming.) Commented Mar 30, 2013 at 14:07
  • Thanks for the clarification. I obviously misunderstood!
    – Holene
    Commented Mar 30, 2013 at 14:23

2 Answers 2


Just in case you want latexmk, the first step is to verify your current version with latexmk -v at the command line/terminal; current version is 4.35, dated 11 Nov 2012. Otherwise update your TeXlive distribution or update to the latest via latexmk at ctan.

Add the custom dependency commands depending on your requirements in a .latexmkrc file in your home directory using Terminal (Linux). For your nomencl example see examplerc scripts at ctan

  gedit $HOME/.latexmkrc 

with the following contents

 # Custom dependency and function for nomencl package 
 add_cus_dep( 'nlo', 'nls', 0, 'makenlo2nls' );
 sub makenlo2nls {
 system( "makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"" );

Then it should work with latexmk, it worked for me at least.

  • Awesome! This solved my problem. My version of latexmk was up to date, but the gedit code obviously created a .latexmkrc file that latexmk was able to find. Thanks! =)
    – Holene
    Commented Mar 30, 2013 at 14:21
  • this also helped me! i was already using latexmk, so i just added this above my existing .latexmkrc contents (which were as follows) $pdflatex = "xelatex %O %S"; $pdf_mode = 1; $dvi_mode = $postscript_mode = 0;
    – Michael
    Commented Jun 23, 2018 at 18:27

If you can, I suggest you to try arara.


  1. It has a great manual written for humans ;-)
  2. You can use directives from within the document, meaning that you can compile different documents in different ways. In other words, the directives are document specific.
  3. Comiplation is easy and one step: arara yourfile
  4. The documentation tells you about integrating arara to get a one click toolbar button in many editors. Hence you can run arara from within your editor.
  5. It comes shipped with texlive.
  6. ....
  7. ......

Here is a sample file (say myfile.tex):

% arara: pdflatex
% arara: nomencl
% arara: pdflatex
% arara: pdflatex
% !arara: indent: { overwrite: false, output: outputfile.tex, trace: true }




\chapter{Structural Analysis} \label{sec:Structural Analysis}
\section{Sectional Properties} \label{sec:Sectional Properties}

The cross-sectional area is defined as
\begin{equation} \label{eqn:Cross-sectional area}
    A = \int_{S} \, dS
\nomenclature{$A$}{cross-sectional area, m$^{2}$}
\nomenclature{$S$}{arbitrary surface}

\chapter{Structural Analysis} \label{sec:Structural Analysis2}
\section{Sectional Properties} \label{sec:Sectional Properties2}
The cross-sectional area is defined as
\begin{equation} \label{eqn:Cross-sectional area2}
    A = \int_{S} \, dS
\nomenclature{$A2$}{cross-sectional area, m$^{2}$}
\nomenclature{$S2$}{arbitrary surface}


Compile this with arara myfile. For further details, consult the documentation.

  • Thanks for the answer. Though this is not the kind of solution I was looking for. That was supplied by @texenthusiast =)
    – Holene
    Commented Mar 30, 2013 at 14:24
  • 2
    @Holene No problem. I just wanted to make you aware of arara :-).
    – user11232
    Commented Mar 30, 2013 at 15:57
  • This helped me plentiful - thx. ;)
    – cis
    Commented May 5, 2014 at 10:36

You must log in to answer this question.

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