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.

  • 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? – Andriy Drozdyuk Jun 16 '12 at 0:14
  • Also are there cmd-line options. – Andriy Drozdyuk Jun 16 '12 at 0:19
  • 1
    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. – Andriy Drozdyuk 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.)

  • 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'... – Andriy Drozdyuk 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 – Andriy Drozdyuk Jun 13 '12 at 1:57
  • Hellou... anyone there? Why are people upvoting this answer if it does not work??? – Andriy Drozdyuk 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 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.