TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I use glosseries with latexmk if I use outdir and auxdir parameters? I keep getting the .gls not found...

Here is my latexmk build script:

latexmk -outdir=out -auxdir=out -g -f -bibtex -dvi- -pvc -pdflatex="xelatex -synctex=0 %O %S" -pdf $1

If I remove the auxdir and outdir param, everything works fine. Any help appreciated.

EDIT: Stop up-voting the answer unless you checked it yourself and it works! Because it does not work for me.

share|improve this question
If you are using Linux, makelatex is a similar program written in Python which handles glossaries properly while keeping aux files in a subdirectory. Let me know if you encounter any problems with it. – ScottKu Jun 15 '12 at 20:47
Wow, that looks amazing. Does it have a continuous mode like latexmk where it watches for changes in source files? – drozzy Jun 16 '12 at 0:14
Also are there cmd-line options. – drozzy Jun 16 '12 at 0:19
makelatex -l will continually loop and rebuild the document whenever the source files change. There are command line options which you can see by running makelatex --help – ScottKu Jun 16 '12 at 16:14
@ScottKu You should really put that into some kind of easy-to-install repository. latexmk already comes with latex live. And I can't find makelatex in arch-linux repos either. Just a suggestion. – drozzy Jun 19 '12 at 17:42

The problem is that the makeglossaries script fails when it is called with a filename with a path component, e.g., makeglossaries out/try. This can be worked around by defining the necessary custom dependency as follows

add_cus_dep('glo', 'gls', 0, 'makeglossaries');
sub makeglossaries {
   my ($base_name, $path) = fileparse( $_[0] );
   pushd $path;
   my $return = system "makeglossaries $base_name";
   return $return;

(Note that pushd and popd are subroutines defined by latexmk that do the same as the corresponding commands in UNIX shells.)

share|improve this answer
Here is the output I am getting: Run number 1 of rule 'cusdep glo gls Main' ------------ For rule 'cusdep glo gls Main', running '&do_cusdep( )' ... Latexmk: In trying to apply custom-dependency rule to make 'Main.gls' from 'Main.glo' the source file has disappeared since the last run Latexmk: applying rule 'pdflatex'... – drozzy Jun 13 '12 at 1:56
And at the end: Latexmk: Missing input file: 'Main.gls' from line 'No file Main.gls.' Collected error summary (may duplicate other messages): cusdep glo gls Main: failed to create output file – drozzy Jun 13 '12 at 1:57
Hellou... anyone there? Why are people upvoting this answer if it does not work??? – drozzy Jun 19 '12 at 17:43
@drozzy: I’ve tested the solution with the current CTAN versions of latexmk and the glossaries package on Debian and it definitely works. Check your versions of latexmk and the glossaries package and provide a working minimal example. Otherwise, it’s difficult to help you. – mhp Jun 20 '12 at 9:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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