0

I'm using a setup with latexmk and different folders for source files, build files and my output.

I want to use the nomencl package and thus used the custom rc file as in latexmk and nomencl. However, makeindex cannot be invoked from another directory and thus produces errors. Instead, I'd need to cd into my build directory first and then change back to the source folder.

How do I do this with latexmk?

dba
  • 516

2 Answers2

1

You can try this:

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

Going back to the source folder is automatic, as the cd is local to that system command. I haven't tested it, but to the best of my knowledge it should work.

  • Thanks, that doesn't work though, since $_[0] contains the full path. Based on your answer I found something that works. – dba Jan 05 '17 at 12:51
0

Based on @Piet van Oostrum I found the following:

add_cus_dep( 'nlo', 'nls', 0, 'makenlo2nls' );
sub makenlo2nls {
 my $filename  = basename $_[0];
 system( "cd \"$out_dir\"; makeindex -s nomencl.ist -o \"$filename.nls\"    \"$filename.nlo\"" );
}
dba
  • 516