Well, as doncherry already posted there is no option for this in the current version. Find a rough patch against version 4.26 below, or download the patched script directly.
You need to add the following setting to the config file:
$auxdir = 'C:/Users/doncherry/Documents/LaTeX/AUXI_global/'
Make sure that the directory ends with a /
!
This worked fine in my test which actually included TeXLive with the similar -output-directory
option as long I symlinked the PDF file. I couldn't test it with MikTeX under Windows yet, but it should work there as well.
Patch:
--- /usr/local/bin/latexmk 2011-08-12 02:21:46.000000000 +0200
+++ latexmk 2011-10-09 21:46:12.145915149 +0200
@@ -839,6 +839,7 @@
# tex, etc. (If $jobname is non-empty, then
# the --jobname=... option is used on tex.)
+$auxdir = '';
## default flag settings.
$recorder = 0; # Whether to use recorder option on latex/pdflatex
@@ -1281,6 +1282,10 @@
elsif (/^-jobname=(.*)$/) {
$jobname = $1;
}
+ elsif (/^-auxdir="(.*)"$/) {
+ $auxdir = $1;
+ $auxdir .= '/' if ($auxdir !~ /\/$/);
+ }
elsif (/^-l$/) { $landscape_mode = 1; }
elsif (/^-l-$/) { $landscape_mode = 0; }
elsif (/^-latex=(.*)$/) {
@@ -1707,7 +1712,7 @@
# Initialize basic dependency information:
# For use under error conditions:
- @default_includes = ($texfile_name, "$root_filename.aux");
+ @default_includes = ($texfile_name, "$auxdir$root_filename.aux");
$fdb_file = "$root_filename.$fdb_ext";
@@ -1748,7 +1753,7 @@
}
else {
# No fdb file, so do inferior job by parse_logB
- print "$My_name: Examining log file '$root_filename.log' for generated files...\n";
+ print "$My_name: Examining log file '$auxdir$root_filename.log' for generated files...\n";
# Variables set by parse_logB. Can I remove them
local %generated_log = ();
@@ -1840,7 +1845,7 @@
}
$have_fdb = 0;
- if ( (! -e $fdb_file) && (! -e "$root_filename.aux") ) {
+ if ( (! -e $fdb_file) && (! -e "$auxdir$root_filename.aux") ) {
# No aux and no fdb file => set up trivial aux file
# and corresponding fdb_file. Arrange them to provoke one run
# as minimum, but no more if actual aux file is trivial.
@@ -1860,7 +1865,7 @@
rdb_recurseA( [keys %possible_primaries],
sub{ if ( $$Ptest_kind == 1 ) { $$Ptest_kind = 3;} }
);
- if ( -e "$root_filename.log" ) {
+ if ( -e "$auxdir$root_filename.log" ) {
rdb_for_some( [keys %possible_primaries], \&rdb_set_latex_deps );
}
}
@@ -2170,7 +2175,7 @@
# 2. Write a corresponding fdb file
# 3. Provoke a run of (pdf)latex (actually of all primaries).
- local $aux_file = "$root_filename.aux";
+ local $aux_file = "$auxdir$root_filename.aux";
open( aux_file, '>', $aux_file )
or die "Cannot write file '$aux_file'\n";
print aux_file "\\relax \n";
@@ -3150,7 +3155,7 @@
$bad_reference = 0;
$bad_citation = 0;
- my $log_name = "$root_filename.log";
+ my $log_name = "$auxdir$root_filename.log";
my $log_file = new FileHandle;
if ( ! open( $log_file, "<$log_name" ) ) {
return 0;
@@ -4204,7 +4209,7 @@
# $reference_changed, $bad_reference $bad_citation
&parse_logB;
- my $fls_file = "$root_filename.fls";
+ my $fls_file = "$auxdir$root_filename.fls";
if ($recorder && test_gen_file($fls_file) ) {
parse_fls( $fls_file, \%source_fls, \%generated_fls );
foreach (keys %source_fls) {
@@ -5573,7 +5578,7 @@
if (-e $$Pdest) { $missing_dvi_pdf = '';}
######### Analyze results of run:
- if ( ! -e "$root_filename.log" ) {
+ if ( ! -e "$auxdir$root_filename.log" ) {
$failure = 1;
$$Plast_result = 2;
$$Plast_message = $failure_msg = "(Pdf)LaTeX failed to generate a log file";
latexmk
manual?$pdflatex = 'pdflatex --aux-directory="C:\Users\doncherry\Documents\LaTeX\AUXI_global" %O %S';
was my attempt to apply that syntax.-jobname
option for latexmk? The problem seems to be gettinglatexmk
to find the dependencies etc. and-jobname
seems to help in this regard.aux
folder (not the copy). 1) Symlink your global directory to a local directoryaux
. 2) Add$pdflatex = 'pdflatex %O %S;if [ -f aux/%D ]; then cp aux/%D .; fi'
to yourlatexmkrc
file. 3) Runlatexmk -pvc -pdf -jobname=aux/<file> <file>
. If this is acceptable, I will write it up and add some references and comments (about why the absolute path fails).mklink
as the article suggests to link your global directory to you current directory and see if you can use the-jobname
option (the link will be a relative path). I don't think thatlatexmk
supports this out of the box, but perhaps contact the author:[email protected]