summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-08-13 22:39:23 +0000
committerKarl Berry <karl@freefriends.org>2012-08-13 22:39:23 +0000
commitdd8cdebd361b58d83e12316d2f533932bfea8ae9 (patch)
tree11a978aa1fb1f695e65f5dc061ec47bfd2b7ebf9
parent76059477a647c6a71185af77492f38133e92280a (diff)
latexmk (13aug12)
git-svn-id: svn://tug.org/texlive/trunk@27392 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/latexmk/latexmk.pl565
-rw-r--r--Master/texmf-dist/doc/support/latexmk/CHANGES22
-rw-r--r--Master/texmf-dist/doc/support/latexmk/INSTALL2
-rw-r--r--Master/texmf-dist/doc/support/latexmk/README7
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/README13
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/asymptote_latexmkrc2
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/glossary_latexmkrc12
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/mpost_latexmkrc6
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/pdflatexmkrc84
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/sagetex_latexmkrc4
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc57
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/xelatex_latexmkrc3
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.pdfbin117848 -> 123867 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.txt1832
-rwxr-xr-xMaster/texmf-dist/scripts/latexmk/latexmk.pl565
-rw-r--r--Master/texmf/doc/man/man1/latexmk.1176
-rw-r--r--Master/texmf/doc/man/man1/latexmk.man1.pdfbin128939 -> 134537 bytes
17 files changed, 1948 insertions, 1402 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl b/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
index dfcea37feaf..0455c015067 100755
--- a/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
+++ b/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
@@ -1,5 +1,8 @@
#!/usr/bin/env perl
+# N.B. !!!!!!!!!!! See 17 July 2012 comments !!!!!!!!!!!!!!!!!!
+
+
# On a UNIX-like system, the above enables latexmk to run independently
# of the location of the perl executable. This line relies on the
# existence of the program /usr/bin/env
@@ -10,7 +13,6 @@
# with the path of the perl executable adjusted for your system.
-
use warnings;
# Delete #??!! when working
@@ -109,8 +111,8 @@ use warnings;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.31';
-$version_details = "$My_name, John Collins, 30 March 2012";
+$version_num = '4.33b';
+$version_details = "$My_name, John Collins, 12 Aug. 2012";
use Config;
use File::Copy;
@@ -180,36 +182,71 @@ else {
## Modification log from 9 Dec 2011 onwards in detail
##
## 12 Jan 2012 STILL NEED TO DOCUMENT some items below
-## 29, 30 Mar 2012, John Collins Optimize file checking, and # calcs of MD5
-## 24 Jan 2012, John Collins Remove unneeded call to traceback
-## 23 Jan 2012, John Collins Remove initial ./ from ./foo entries in .fls file
-## 16 Jan 2012, John Collins Make aux and/or out directories if it/they
-## don't exist
-## 14 Jan 2012, John Collins Correct bug in parse_quotes
-## 12 Jan 2012, John Collins $success_cmd, $compiling_cmd, $failure_cmd
-## allow actions (e.g., to set window title)
-## after successful compilation, before
-## compilation, and after failure, in -pvc mode
-## Thanks to Aasmud Ervik (12 Jan 2012)
-## 2 Jan 2012, John Collins Add MikTeX-specific options to pass-through list
-## Remove redundancy of subroutines rdb_ext_cmd and rdb_ext_cmd1
-## In rdb_one_file, give &$file_act null argument list
-## 30 Dec 2011 STILL NEED TO DOCUMENT next items
-## 30 Dec 2011, John Collins Add nostart to possible keywords in commands
-## Insert start before command called from view
-## 24 Dec 2011, John Collins Add -xelatex option
-## Change OS-X defaults for viewers.
-## 21 Dec 2011, John Collins Add options reproducing options of (pdf)latex
-## 21 Dec 2011, John Collins Add -latexoption=... option
-## 20 Dec 2011, John Collins Command specification string can start
-## with "include routine" to invoke a Perl
-## subroutine instead of an external cmd.
-## 19 Dec 2011, John Collins Recorder option is now on by default.
-## 13 Dec 2011, John Collins Add -M -MP and -MF options, like gcc.
-## 9 Dec 2011, John Collins Use OS-dependent search path separator when
-## when manipulating TEXINPUTS, etc.
-## Correct treatment of current directory
-## when modifying TEXINPUTS, etc
+## 12 Aug 2012 John Collins V. 4.33b
+## Improve text displayed by -showextraoptions
+## 8 Aug 2012 John Collins V. 4.33a
+## Fix problem that with Cygwin,
+## latexmk runs very slowly, because
+## subroutine good_cwd() runs the
+## program cygpath on every
+## invocation. Solution: cach cwd.
+## 6 Aug 2012 John Collins Version number to 4.33
+## 4 Aug 2012 John Collins Further fixes of filename treatment:
+## normalize_filename routine to remove
+## string for current directory, and
+## convert '\' directory separator to '/'
+## (Note MiKTeX uses BOTH, see e.g., its
+## log file, so MSWin systems are NOT
+## guaranteed to be consistent. But latexmk
+## needs to treat filenames differing by
+## change of directory separator as equivalent.
+## Warning: SOME MWWin programs, e.g., current
+## cmd.exe (as tested yesterday on PSU computer
+## in library) do not accept '/' as directory
+## separator, so it may be worth allowing conversion
+## to '\' in executed files.)
+## Also improve running when $silent is on:
+## don't print warnings about undefined references
+## and citations, but simply display a summary, whose
+## criterion for being shown had to be fixed.
+## 3 Aug 2012 John Collins Fix finding of files in aux-dir
+## 1 Aug 2012 John Collins Handle aliasing of cwd in output file
+## to avoid unnecessary warnings about
+## actual o/p file .ne. expected with MiKTeX
+## Clean up subroutine names:
+## parse_logB to parse_log
+## make_preview_continuousB to make_preview_continuous
+## rdb_find_new_filesB to rdb_find_new_files
+## rdb_set_dependentsA to rdb_set_dependents
+## rdb_makeB to rdb_make
+## rdb_makeB1 to rdb_make1
+## rdb_one_depA to rdb_one_dep
+## rdb_recurseA to rdb_recurse
+## rdb_update_filesA to rdb_update_files
+## 28, 29, 30 Jul 2012 John Collins Try better file-name normalization in reading fls file.
+## 18 Jul 2012 John Collins Change ver. to 4.32d.
+## Merge changes from 29 June 2012:
+## Add $dvipdf_silent_switch
+## 17 Jul 2012 John Collins Try better fix for error/rerun and retest issue.
+## Now rdb_primary_run doesn't have so many complications
+## rdb_makeB's PASS loop is simpler
+## rdb_submakeB is unneeded.
+## See the lines starting #??
+## See comments nearby
+## Compare w/ v. 4.32a
+## V. 4.32b
+## 17 Jul 2012 John Collins Fix problem that after finding error in a run
+## of (pdf)latex, latexmk didn't check for
+## changed files before giving up.
+## To do that, I reverted some changes in
+## rdb_primary_run to pre v. 4.31
+## Remove unused code
+## v. 4.32a
+## 8 May 2012 John Collins Possibility to substitute backslashes for
+## forward slashes in file and directory
+## names in executed command line,
+## for MSWin
+## 5 May 2012 John Collins Comment on ctrl/C handling in WAIT loop
##
## 1998-2010, John Collins. Many improvements and fixes.
## See CHANGE-log.txt for full list, and CHANGES for summary
@@ -542,6 +579,12 @@ $makeindex_silent_switch = '-q';
## Command to convert dvi file to pdf file directly:
$dvipdf = 'dvipdf %O %S %D';
+# N.B. Standard dvipdf runs dvips and gs with their silent switch, so for
+# standard dvipdf $dvipdf_silent_switch is unneeded, but innocuous.
+# But dvipdfmx can be used instead, and it has a silent switch (-q).
+# So implementing $dvipdf_silent_switch is useful.
+
+$dvipdf_silent_switch = '-q';
## Command to convert dvi file to ps file:
$dvips = 'dvips %O -o %D %S';
@@ -576,6 +619,10 @@ $print_type = 'ps'; # When printing, print the postscript file.
## Current tex's treat extensions like UNIX teTeX:
$extension_treatment = 'unix';
+## Substitute backslashes in file and directory names for
+## MSWin command line
+$MSWin_back_slash = 1;
+
$dvi_update_signal = undef;
$ps_update_signal = undef;
$pdf_update_signal = undef;
@@ -1046,8 +1093,11 @@ $dependents_list = 0; # Whether to display list(s) of dependencies
$dependents_phony = 0; # Whether list(s) of dependencies includes phony targets
# (as with 'gcc -MP').
$deps_file = '-'; # File for dependency list output. Default stdout.
-$rules_list = 0; # Whether to display list(s) of dependencies
-@dir_stack = (); # Stack of pushed directories.
+$rules_list = 0; # Whether to display list(s) of dependencies
+@dir_stack = (); # Stack of pushed directories, each of form of
+ # pointer to array [ cwd, good_cwd ], where
+ # good_cwd differs from cwd by being converted
+ # to native MSWin path when cygwin is used.
$cleanup_mode = 0; # No cleanup of nonessential LaTex-related files.
# $cleanup_mode = 0: no cleanup
# $cleanup_mode = 1: full cleanup
@@ -1097,6 +1147,10 @@ $reference_changed = 0;
$bad_reference = 0;
$bad_citation = 0;
+# Cache of expensive-to-compute state variables, e.g., cwd in form
+# fixed to deal with cygwin issues.
+%cache = ();
+&cache_good_cwd;
# Set search paths for includes.
# Set them early so that they can be overridden
@@ -1229,7 +1283,7 @@ if (!$BIBINPUTS) { $BIBINPUTS = '.'; }
%primaries = (); # Hash of rules for primary part of make. Keys are
# currently 'latex', 'pdflatex' or both. Value is
# currently irrelevant. Use hash for ease of lookup
- # Make remove this later, if use makeB
+ # Make remove this later, if use rdb_makeB
# Hashes, whose keys give names of particular kinds of rule. We use
# hashes for ease of lookup.
@@ -1530,10 +1584,17 @@ while ($_ = $ARGV[0])
elsif (/^-rules$/ ) { $rules_list = 1; }
elsif (/^-norules$/ || /^-rules-$/ ) { $rules_list = 0; }
elsif (/^-showextraoptions$/) {
- print "List of extra latex and pdflatex options recognized by $my_name:\n",
+ print "List of extra latex and pdflatex options recognized by $my_name.\n",
"These are passed as is to (pdf)latex. They may not be recognized by\n",
"particular versions of (pdf)latex. This list is a combination of those\n",
- "for TeXLive and MikTeX.\n\n";
+ "for TeXLive and MikTeX.\n",
+ "\n",
+ "Note that in addition to the options in this list, there are several\n",
+ "options known to the (pdf)latex programs that are also recognized by\n",
+ "latexmk and trigger special behavior by latexmk. Since these options\n",
+ "appear in the main list given by running 'latexmk --help', they do not\n",
+ "appear in the following list\n",
+ "\n";
foreach $option ( sort( keys %allowed_latex_options, keys %allowed_latex_options_with_arg ) ) {
if (exists $allowed_latex_options{$option} ) { print " $allowed_latex_options{$option}\n"; }
if (exists $allowed_latex_options_with_arg{$option} ) { print " $allowed_latex_options_with_arg{$option}\n"; }
@@ -1642,6 +1703,11 @@ if ( ($out_dir ne '') && ($aux_dir eq '') ){
$aux_dir = $out_dir;
}
+foreach ($out_dir, $aux_dir) {
+ # Remove aliases to cwd:
+ $_ = normalize_filename( $_ );
+ if ($_ eq '.' ) { $_ = ''; }
+}
# Versions terminating in directory/path separator
$out_dir1 = $out_dir;
$aux_dir1 = $aux_dir;
@@ -1794,6 +1860,7 @@ if ( $silent ) {
add_option( "$biber_silent_switch", \$biber );
add_option( "$bibtex_silent_switch", \$bibtex );
add_option( "$makeindex_silent_switch", \$makeindex );
+ add_option( "$dvipdf_silent_switch", \$dvipdf );
add_option( "$dvips_silent_switch", \$dvips );
}
@@ -2031,10 +2098,10 @@ foreach $filename ( @file_list )
);
}
else {
- # No fdb file, so do inferior job by parse_logB
+ # No fdb file, so do inferior job by parse_log
print "$My_name: Examining log file '$log_name' for generated files...\n";
- # Variables set by parse_logB. Can I remove them
+ # Variables set by parse_log. Can I remove them
local %generated_log = ();
local %dependents = (); # Maps files to status. Not used here.
local @bbl_files = (); # Not used here.
@@ -2043,7 +2110,7 @@ foreach $filename ( @file_list )
# Maps output file created and read by (pdf)latex
# to source file of conversion.
local $primary_out = ''; # Actual output file (dvi or pdf). Not used here.
- &parse_logB;
+ &parse_log;
%other_generated = %generated_log;
}
@@ -2097,7 +2164,7 @@ foreach $filename ( @file_list )
if ($cleanup_only) { next FILE; }
-#??? The following are not needed if use makeB.
+#??? The following are not needed if use rdb_make.
# ?? They may be set too early?
# Arrays and hashes for picking out accessible rules.
# Distinguish rules for making files and others
@@ -2140,7 +2207,7 @@ foreach $filename ( @file_list )
# previous run. So use filetime criterion for make
# instead of change from previous run, until we have
# done our own make.
- rdb_recurseA( [keys %possible_primaries],
+ rdb_recurse( [keys %possible_primaries],
sub{ if ( $$Ptest_kind == 1 ) { $$Ptest_kind = 3;} }
);
if ( -e $log_name ) {
@@ -2158,7 +2225,7 @@ foreach $filename ( @file_list )
if ($go_mode) {
# Force everything to be remade.
- rdb_recurseA( [keys %requested_filerules], sub{$$Pout_of_date=1;} );
+ rdb_recurse( [keys %requested_filerules], sub{$$Pout_of_date=1;} );
}
@@ -2170,7 +2237,7 @@ foreach $filename ( @file_list )
#************************************************************
if ( $preview_continuous_mode ) {
- &make_preview_continuousB;
+ &make_preview_continuous;
# Will probably exit by ctrl/C and never arrive here.
next FILE;
}
@@ -2191,7 +2258,7 @@ foreach $filename ( @file_list )
#Initialize failure flags now.
$failure = 0;
$failure_msg = '';
- $failure = rdb_makeB( keys %requested_filerules );
+ $failure = rdb_make( keys %requested_filerules );
if ($failure > 0) { next FILE; }
rdb_for_some( [keys %one_time], \&rdb_run1 );
} # end FILE
@@ -2718,7 +2785,7 @@ sub find_basename
#************************************************************
-sub make_preview_continuousB {
+sub make_preview_continuous {
local @changed = ();
local @disappeared = ();
local @no_dest = (); # Non-existent destination files
@@ -2726,7 +2793,6 @@ sub make_preview_continuousB {
local @rules_to_apply = ();
local $failure = 0;
- local $runs = 0;
local %rules_applied = ();
local $updated = 0;
@@ -2796,7 +2862,7 @@ CHANGE:
if ($compiling_cmd) {
Run_subst( $compiling_cmd );
}
- $failure = rdb_makeB( @targets );
+ $failure = rdb_make( @targets );
## warn "=========Viewer PID = $$Pviewer_process; updated=$updated\n";
@@ -2878,6 +2944,10 @@ CHANGE:
print "\n=== Watching for updated files. Use ctrl/C to stop ...\n";
}
$waiting = 1; if ($diagnostics) { warn "WAITING\n"; }
+# During waiting for file changes, handle ctrl/C and ctrl/break here, rather than letting
+# system handle them by terminating script (and any script that calls it). This allows,
+# for example, the clean up code in the following command line to work:
+# latexmk -pvc foo; cleanup;
&catch_break;
$have_break = 0;
WAIT: while (1) {
@@ -2894,7 +2964,7 @@ CHANGE:
$processing_time1 = processing_time();
# Does this do this job????
local $new_files = 0;
- rdb_for_some( [keys %current_primaries], sub{ $new_files += &rdb_find_new_filesB } );
+ rdb_for_some( [keys %current_primaries], sub{ $new_files += &rdb_find_new_files } );
if ($new_files > 0) {
warn "$My_name: New file(s) found.\n";
last WAIT;
@@ -2908,7 +2978,7 @@ CHANGE:
}
$waiting = 0; if ($diagnostics) { warn "NOT WAITING\n"; }
} #end infinite_loop CHANGE:
-} #END sub make_preview_continuousB
+} #END sub make_preview_continuous
#************************************************************
@@ -3488,40 +3558,25 @@ sub check_bibtex_log {
#**************************************************
-sub force_directory {
- # Usage, force_directory( dir, filename )
- # If filename contains no path component, return concatenation
- # of dir and filename,
- # else return filename
+sub normalize_force_directory {
+ # Usage, normalize_force_directory( dir, filename )
+ # Perform the following operations:
+ # Clean filename
+ # If filename contains no path component, insert dir in front
+ # Normalize filename
+ # Return result
my $default_dir = $_[0];
- my $filename = $_[1];
+ my $filename = clean_filename( $_[1] );
my ($base_name, $path ) = fileparse( $filename );
- if ( $path ne '' ) { $filename = "$default_dir$filename"; }
- return $filename;
-}
-
-# ------------------------------
-
-sub clean_file_name {
- # Convert quoted filename as found in log file to filename without quotes
- # Allows arbitrarily embedded double-quoted substrings, includes the
- # cases
- # 1. `"string".ext', which arises e.g., from \jobname.bbl:
- # when the base filename contains spaces, \jobname has quotes.
- # and from \includegraphics with basename specified.
- # Also deals with filenames written by asymptote.sty
- # 2. Or "string.ext" from \includegraphcs with basename and ext specified.
- # and from MiKTeX logfile for input files with spaces.
- # Doubled quotes (e.g., A""B) don't get converted.
- # Neither do unmatched quotes.
- my $filename = $_[0];
- while ( $filename =~ s/^([^\"]*)\"([^\"]+)\"(.*)$/$1$2$3/ ) {}
- return $filename;
-}
+ if ( $base_name eq $filename ) {
+ $filename = "$default_dir$filename";
+ }
+ return normalize_filename( $filename );
+} #END normalize force_directory
# ------------------------------
-sub parse_logB {
+sub parse_log {
# Scan log file for: dependent files
# reference_changed, bad_reference, bad_citation
# Return value: 1 if success, 0 if no log file.
@@ -3660,8 +3715,9 @@ LINE:
# First line OK
next LINE;
} else {
- warn "$My_name: Error on first line of '$log_name'. ".
- "This is apparently not a TeX log file.\n";
+ warn "$My_name: Error on first line of '$log_name'.\n".
+ "This is apparently not a TeX log file. ",
+ "The first line is:\n$_\n";
$failure = 1;
$failure_msg = "Log file '$log_name' appears to have wrong format.";
return 0;
@@ -3674,7 +3730,7 @@ LINE:
if ( ($block_type eq 'conversion')
&& /^\($current_pkg\)\s+Output file: <([^>]+)>/ )
{
- $delegated_output = $1;
+ $delegated_output = normalize_clean_filename($1);
}
next LINE;
}
@@ -3688,20 +3744,20 @@ LINE:
}
# Check for changed references, bad references and bad citations:
if (/Rerun to get/) {
- warn "$My_name: References changed.\n";
+ warn "$My_name: References changed.\n" if ! $silent;
$reference_changed = 1;
}
if (/LaTeX Warning: (Reference[^\001]*undefined)./) {
- warn "$My_name: $1 \n";
- $bad_reference = 1;
+ warn "$My_name: $1 \n" unless $silent;
+ $bad_reference++;
}
if (/LaTeX Warning: (Citation[^\001]*undefined)./) {
- warn "$My_name: $1 \n";
- $bad_citation = 1;
+ warn "$My_name: $1 \n" unless $silent;
+ $bad_citation++;
}
if (/Package natbib Warning: (Citation[^\001]*undefined)./) {
- warn "$My_name: $1 \n";
- $bad_citation = 1;
+ warn "$My_name: $1 \n" unless $silent;
+ $bad_citation++;
}
if ( /^Document Class: / ) {
# Class sign-on line
@@ -3717,7 +3773,7 @@ LINE:
next LINE;
}
if ( /^Output written on\s+(.*)\s+\(\d+\s+page/ ) {
- $primary_out = clean_file_name($1);
+ $primary_out = normalize_clean_filename($1);
warn "$My_name: Log file says output to '$primary_out'\n"
unless $silent;
next LINE;
@@ -3734,15 +3790,15 @@ LINE:
# When (pdf)latex is run with an -output-directory
# or an -aux_directory, the file name does not contain
# the output path; fix this, after removing quotes:
- $generated_log{ force_directory( $aux_dir1, clean_file_name($1) )} = 1;
+ $generated_log{normalize_force_directory( $aux_dir1, $1 )} = 1;
next LINE;
}
# Test for conversion produced by package:
if ( /^Package (\S+) Info: Source file: <([^>]+)>/ ) {
# Info. produced by epstopdf (and possibly others)
# about file conversion
- $current_pkg = clean_file_name($1);
- $delegated_source = clean_file_name($2);
+ $current_pkg = normalize_clean_filename($1);
+ $delegated_source = normalize_clean_filename($2);
$block_type = 'conversion';
next LINE;
}
@@ -3774,7 +3830,7 @@ LINE:
# When (pdf)latex is run with an -output-directory
# or an -aux_directory, the file name does not contain
# the output path; fix this, after removing quotes:
- $idx_file = force_directory( $aux_dir1, clean_file_name($idx_file) );
+ $idx_file = normalize_force_directory( $aux_dir1, $idx_file );
my ($idx_base, $idx_path, $idx_ext) = fileparseA( $idx_file );
$idx_base = $idx_path.$idx_base;
$idx_file = $idx_base.$idx_ext;
@@ -3801,7 +3857,7 @@ LINE:
# When (pdf)latex is run with an -output-directory
# or an -aux_directory, the file name does not contain
# the output path; fix this, after removing quotes:
- my $bbl_file = force_directory( $aux_dir1, clean_file_name($1) );
+ my $bbl_file = normalize_force_directory( $aux_dir1, $1 );
warn "$My_name: Non-existent bbl file '$bbl_file'\n $_\n";
$dependents{$bbl_file} = 0;
push @bbl_files, $bbl_file;
@@ -3809,27 +3865,28 @@ LINE:
}
foreach my $pattern (@file_not_found) {
if ( /$pattern/ ) {
- my $file = clean_file_name($1);
- my ($base, $path) = fileparse( $file );
+ my $file = clean_filename($1);
warn "$My_name: Missing input file: '$file' from line\n '$_'\n"
unless $silent;
- $dependents{$file} = 0;
- if ( $aux_dir && ( ($path eq './') || ($path eq '') ) ) {
- # This allows for the possibility that latex generated
+ $dependents{normalize_filename($file)} = 0;
+ my $file1 = $file;
+ if ( $aux_dir ) {
+ # Allow for the possibility that latex generated
# a file in $aux_dir, from which the missing file can
# be created by a cusdep (or other) rule that puts
# the result in $out_dir. If the announced missing file
# has no path, then it would be effectively a missing
# file in $aux_dir, with a path. So give this alternate
# location.
- $dependents{$aux_dir1.$file} = 0;
+ my $file1 = normalize_force_directory( $aux_dir1, $file );
+ $dependents{$file1} = 0;
}
next LINE;
}
}
if ( /^File: (.+) Graphic file \(type / ) {
# First line of message from includegraphics/x
- $dependents{clean_file_name($1)} = 1;
+ $dependents{normalize_clean_filename($1)} = 1;
next LINE;
}
# Now test for generic lines to ignore, only after special cases!
@@ -3958,6 +4015,7 @@ LINE:
}
INCLUDE_NAME:
foreach my $include_name (@new_includes) {
+ $include_name = normalize_filename( $include_name );
my ($base, $path, $ext) = fileparseB( $include_name );
if ( ($path eq './') || ($path eq '.\\') ) {
$include_name = $base.$ext;
@@ -4145,7 +4203,7 @@ CANDIDATE_PAIR:
}
}
return 1;
-} #END parse_logB
+} #END parse_log
#************************************************************
@@ -4153,21 +4211,28 @@ sub parse_fls {
my ($fls_name, $Pinputs, $Poutputs ) = @_;
%$Pinputs = %$Poutputs = ();
my $fls_file = new FileHandle;
+ # Make a note of current working directory
+ # I'll update it from the fls file later
+ # Currently I don't use this, but it would be useful to use
+ # this when testing prefix for cwd in a filename, by
+ # giving (pdf)latex's best view of the cwd. Note that the
+ # value given by the cwd() function may be mangled, e.g., by cygwin
+ # compared with native MSWin32.
+ my $cwd = good_cwd();
if ( ! open ($fls_file, "<$fls_name") ) {
return 1;
}
foreach $_ ( <$fls_file> ) {
- if (/^\s*INPUT\s+(.*)\s+$/) {
- my $file = $1;
- # Take precautions against aliasing of ./foo and foo:
- $file =~ s(^\./)();
- $$Pinputs{$file} = 1;
+ if (/^\s*PWD\s+(.*)\s+$/) {
+ $cwd = $1;
+ }
+ elsif (/^\s*INPUT\s+(.*)\s+$/) {
+ # Take precautions against aliasing of foo, ./foo and other possibilities for cwd.
+ $$Pinputs{ normalize_filename( $1 )} = 1;
}
elsif (/^\s*OUTPUT\s+(.*)\s+$/) {
- my $file = $1;
- # Take precautions against aliasing of ./foo and foo:
- $file =~ s(^\./)();
- $$Poutputs{$file} = 1;
+ # Take precautions against aliasing of foo, ./foo and other possibilities for cwd.
+ $$Poutputs{ normalize_filename( $1 )} = 1;
}
}
close( $fls_file );
@@ -4176,6 +4241,68 @@ sub parse_fls {
#************************************************************
+sub clean_filename {
+ # Convert quoted filename as found in log file to filename without quotes
+ # Allows arbitrarily embedded double-quoted substrings, includes the
+ # cases
+ # 1. `"string".ext', which arises e.g., from \jobname.bbl:
+ # when the base filename contains spaces, \jobname has quotes.
+ # and from \includegraphics with basename specified.
+ # Also deals with filenames written by asymptote.sty
+ # 2. Or "string.ext" from \includegraphcs with basename and ext specified.
+ # and from MiKTeX logfile for input files with spaces.
+ # Doubled quotes (e.g., A""B) don't get converted.
+ # Neither do unmatched quotes.
+ my $filename = $_[0];
+ while ( $filename =~ s/^([^\"]*)\"([^\"]+)\"(.*)$/$1$2$3/ ) {}
+ return $filename;
+}
+
+# ------------------------------
+
+sub normalize_filename {
+ # Remove various forms for cwd at start of filename.
+ # Convert to have directory separator = '/' only
+ my $file = $_[0];
+ my $file1 = $file; # Saved original value
+ my $cwd = good_cwd();
+ # Normalize files to use / to separate directory components:
+ # (Note both / and \ are allowed under MSWin.)
+ $cwd =~ s(\\)(/)g;
+ $file =~ s(\\)(/)g;
+
+ # Remove current directory string:
+ $file =~ s(^\./)();
+ $file =~ s(^$cwd/)();
+
+ return $file;
+}
+
+# ------------------------------
+
+sub normalize_clean_filename {
+ # Remove quotes around filename --- see clean_filename --- as from log file.
+ # Then remove any string for cwd, and convert to use '/' for directory separator,
+ # (and any other standardization) done by normalize_filename.
+ return normalize_filename( clean_filename( $_[0] ));
+}
+
+#************************************************************
+
+sub OS_preferred_filename {
+ # Usage: OS_preferred_filename(name)
+ # Returns filename with directory separator '/' converted
+ # to preferred conventions for current OS.
+ # Currently implemented: only '\' for MSWin32
+ my $file = $_[0];
+ if ( $^O eq 'MSWin32' ) {
+ $file =~ s(/)(\\)g;
+ }
+ return $file;
+}
+
+#************************************************************
+
sub parse_aux {
#Usage: parse_aux( $aux_file, \@new_bib_files, \@new_aux_files, \@new_bst_files )
# Parse aux_file (recursively) for bib files, and bst files.
@@ -4570,7 +4697,7 @@ LINE:
}
undef $in_handle;
# Set cus dependencies.
- &rdb_set_dependentsA( keys %rule_db );
+ &rdb_set_dependents( keys %rule_db );
#?? Check from_rules exist.
@@ -4673,7 +4800,7 @@ sub rdb_set_latex_deps {
# The following are also returned, but are global, to be used by caller
# $reference_changed, $bad_reference $bad_citation
- &parse_logB;
+ &parse_log;
my $fls_file = "$aux_dir1$root_filename.fls";
if ($recorder && test_gen_file($fls_file) ) {
parse_fls( $fls_file, \%source_fls, \%generated_fls );
@@ -4681,6 +4808,7 @@ sub rdb_set_latex_deps {
$dependents{$_} = 4;
}
foreach (keys %generated_fls) {
+ $_ = normalize_filename($_);
rdb_add_generated( $_ );
if ( exists($dependents{$_}) ) {
$dependents{$_} = 6;
@@ -4696,7 +4824,7 @@ sub rdb_set_latex_deps {
# missing input file might be correctable by a run of some
# other program whose running is provoked AFTER a run of
# (pdf)latex, we'll set a diagnostic and leave it to the
- # rdb_makeB to handle after all circular dependencies are
+ # rdb_make to handle after all circular dependencies are
# resolved.
# 2. The output file might be of a different kind than expected
# (i.e., dvi instead of pdf, or vv). This could
@@ -4722,7 +4850,7 @@ sub rdb_set_latex_deps {
rdb_create_rule( $from_rule, 'external', $makeindex, '', 1,
$idx_file, $ind_file, $ind_base, 1, 0, 0 );
print " ===Source file '$ind_file' for '$rule'\n"
- if ($diagnostics > -1);
+ if ($diagnostics);
rdb_ensure_file( $rule, $ind_file, $from_rule );
}
# Make sure the .ind file is treated as a detected source file;
@@ -4842,7 +4970,7 @@ NEW_SOURCE:
}
}
- my @more_sources = &rdb_set_dependentsA( $rule );
+ my @more_sources = &rdb_set_dependents( $rule );
my $num_new = $#more_sources + 1;
foreach (@more_sources) {
$dependents{$_} = 4;
@@ -4894,8 +5022,8 @@ sub test_gen_file {
#************************************************************
-sub rdb_find_new_filesB {
- # Call: rdb_find_new_filesB
+sub rdb_find_new_files {
+ # Call: rdb_find_new_files
# Assumes rule context for primary rule.
# Deal with files which were missing and for which a method
# of finding them has become available:
@@ -4987,30 +5115,30 @@ MISSING_FILE:
}
}
return $found;
-} # END rdb_find_new_filesB
+} # END rdb_find_new_files
#************************************************************
-sub rdb_set_dependentsA {
- # Call rdb_set_dependentsA( rules ...)
+sub rdb_set_dependents {
+ # Call rdb_set_dependents( rules ...)
# Returns array (sorted), of new source files.
local @new_sources = ();
local @deletions = ();
# Shouldn't recurse. The definite rules to be examined are given.
- rdb_for_some( [@_], 0, \&rdb_one_depA );
-# OLD rdb_recurseA( [@_], 0, \&rdb_one_depA );
+ rdb_for_some( [@_], 0, \&rdb_one_dep );
+# OLD rdb_recurse( [@_], 0, \&rdb_one_dep );
foreach (@deletions) {
my ($rule, $file) = @$_;
rdb_remove_files( $rule, $file );
}
&rdb_make_links;
return uniqs( @new_sources );
-} #END rdb_set_dependentsA
+} #END rdb_set_dependents
#************************************************************
-sub rdb_one_depA {
+sub rdb_one_dep {
# Helper for finding dependencies. One case, $rule and $file given
# Assume file (and rule) context for DESTINATION file.
@@ -5019,7 +5147,7 @@ sub rdb_one_depA {
if ( (! exists $possible_primaries{$rule}) && ($rule !~ /^cusdep/) ) {
return;
}
-#print "=============ONE_DEPA: '$rule' '$file'\n";
+#print "=============ONE_DEP: '$rule' '$file'\n";
local $new_dest = $file;
my ($base_name, $path, $toext) = fileparseA( $new_dest );
$base_name = $path.$base_name;
@@ -5141,7 +5269,7 @@ DEP:
}
}
}
-} #END rdb_one_depA
+} #END rdb_one_dep
#************************************************************
@@ -5247,7 +5375,7 @@ sub rdb_accessible {
# Call: rdb_accessible( rule, ...)
# Returns array of rules accessible from the given rules
local @accessible = ();
- rdb_recurseA( [@_], sub{ push @accessible, $rule; } );
+ rdb_recurse( [@_], sub{ push @accessible, $rule; } );
return @accessible;
} #END rdb_accessible
@@ -5255,8 +5383,8 @@ sub rdb_accessible {
#************************************************************
#************************************************************
-sub rdb_makeB {
- # Call: rdb_makeB( target, ... )
+sub rdb_make {
+ # Call: rdb_make( target, ... )
# Makes the targets and prerequisites.
# Leaves one-time rules to last.
# Does appropriate repeated makes to resolve dependency loops
@@ -5416,7 +5544,7 @@ sub rdb_makeB {
local $failure = 0; # General accumulated error flag
local $missing_dvi_pdf = ''; # Did primary run fail to make its output file?
local $runs = 0;
- local $too_many_runs = 0;
+ local $too_many_passes = 0;
local %rules_applied = ();
my $retry_msg = 0; # Did I earlier say I was going to attempt
# another pass after a failure?
@@ -5437,25 +5565,14 @@ sub rdb_makeB {
if ($diagnostics) {
print "MakeB: doing pre_primary and primary...\n";
}
- rdb_for_some( [@pre_primary, $primary], \&rdb_makeB1 );
- if ( ($runs > 0) && ! $too_many_runs ) {
- $retry_msg = 0;
- if ( $failure && $newrule_nofile ) {
- $retry_msg = 1;
- print "$My_name: Error on run, but found possibility to ",
- "make new source files\n";
- next PASS;
- }
- elsif ( $force_mode || (! $failure) ) {
- next PASS;
- }
+ rdb_for_some( [@pre_primary, $primary], \&rdb_make1 );
+ if ( ($runs > 0) && ! $too_many_passes ) {
+ next PASS;
}
- elsif ($runs == 0) {
+ if ($runs == 0) {
# $failure not set on this pass, so use value from previous pass:
$failure = $previous_failure;
- if ($retry_msg) {
- print "But in fact no new files made\n";
- }
+ if ($failure && !$force_mode ) { last PASS; }
}
if ( $missing_dvi_pdf ) {
# No output from primary, after completing circular dependence
@@ -5463,19 +5580,13 @@ sub rdb_makeB {
$failure = 1;
last PASS;
}
- if ($failure && !$force_mode ) { last PASS; }
if ($diagnostics) {
print "MakeB: doing post_primary...\n";
}
- rdb_for_some( [@post_primary], \&rdb_makeB1 );
- if ($failure) { last PASS; }
- if ($runs > 0) {
- # If something was run, repeat the loop to test for any changes
- # that entail further processing.
- next PASS;
- }
- # Get here if nothing was run.
- last PASS;
+ rdb_for_some( [@post_primary], \&rdb_make1 );
+ if ($runs == 0) {
+ last PASS;
+ }
}
continue {
# Re-evaluate rule classification and accessibility,
@@ -5487,18 +5598,11 @@ sub rdb_makeB {
&rdb_make_links;
}
}
- rdb_for_some( [@one_time], \&rdb_makeB1 );
+ rdb_for_some( [@one_time], \&rdb_make1 );
rdb_write( $fdb_name );
- if (! $silent) {
- # Diagnose of the runs
- if ( $#{keys %rules_applied } > -1 ) {
- print "$My_name: $runs runs. Rules applied:\n";
- foreach (sort keys %rules_applied) {
- print " '$_'\n";
- }
- }
- elsif ($failure && $force_mode) {
+ if (! $silent) {
+ if ($failure && $force_mode) {
print "$My_name: Errors, in force_mode: so I tried finishing targets\n";
}
elsif ($failure) {
@@ -5511,7 +5615,7 @@ sub rdb_makeB {
}
}
return $failure;
-} #END rdb_makeB
+} #END rdb_make
#-------------------
@@ -5556,9 +5660,9 @@ sub rdb_show_rule_errors {
#-------------------
-sub rdb_makeB1 {
- # Call: rdb_makeB1
- # Helper routine for rdb_makeB.
+sub rdb_make1 {
+ # Call: rdb_make1
+ # Helper routine for rdb_make.
# Carries out make at level of given rule (all data available).
# Assumes contexts for recursion, make, and rule, and
# assumes that source files for the rule are to be considered
@@ -5672,7 +5776,7 @@ sub rdb_makeB1 {
"without getting stable files\n";
warn " Use the -f option to force complete processing.\n"
if (! $force_mode);
- $too_many_runs = 1;
+ $too_many_passes = 1;
# Treat rule as completed, else in -pvc mode get infinite reruns:
$$Pout_of_date = 0;
$failure = 1;
@@ -5723,7 +5827,7 @@ sub rdb_makeB1 {
# For a primary rule, i.e., (pdf)latex, not to produce the
# expected output file may not be an error condition.
# Diagnostics were handled in parsing the log file.
- # Special action in main loop in rdb_makeB
+ # Special action in main loop in rdb_make
$missing_dvi_pdf = $$Pdest;
}
elsif ($return == -2) {
@@ -5743,20 +5847,20 @@ sub rdb_makeB1 {
# !!?? $failure_msg = $$Plast_message;
}
-} #END rdb_makeB1
+} #END rdb_make1
#************************************************************
-sub rdb_submakeB {
- # Call: rdb_submakeB
- # Makes all the source files for a given rule.
- # Assumes contexts for recursion, for make, and rule.
- %visited = %visited_at_rule_start;
- local $failure = 0; # Error flag
- my @v = keys %visited;
- rdb_do_files( sub{ rdb_recurse_rule( $$Pfrom_rule, 0,0,0, \&rdb_makeB1 ) } );
- return $failure;
-} #END rdb_submakeB
+#??sub rdb_submake {
+#?? # Call: rdb_submake
+#?? # Makes all the source files for a given rule.
+#?? # Assumes contexts for recursion, for make, and rule.
+#?? %visited = %visited_at_rule_start;
+#?? local $failure = 0; # Error flag
+#?? my @v = keys %visited;
+#?? rdb_do_files( sub{ rdb_recurse_rule( $$Pfrom_rule, 0,0,0, \&rdb_make1 ) } );
+#?? return $failure;
+#??} #END rdb_submake
#************************************************************
@@ -5783,7 +5887,7 @@ sub rdb_classify_rules {
@post_primary = ();
@one_time = ();
- rdb_recurseA( \@requested_targets, \&rdb_classify1, 0,0, \&rdb_classify2 );
+ rdb_recurse( \@requested_targets, \&rdb_classify1, 0,0, \&rdb_classify2 );
# Reverse, as tendency is to find last rules first.
@pre_primary = reverse @pre_primary;
@@ -5878,7 +5982,7 @@ sub rdb_run1 {
# Source file data, by definition, correspond to the file state just
# before the latest run, and the run_time to the time just before the run:
- &rdb_update_filesA;
+ &rdb_update_files;
$$Prun_time = time;
$$Pchanged = 0; # No special changes in files
$$Plast_result = 0;
@@ -6019,7 +6123,7 @@ sub rdb_dummy_run1 {
# Source file data, by definition, correspond to the file state just before
# the latest run, and the run_time to the time just before the run:
- &rdb_update_filesA;
+ &rdb_update_files;
$$Prun_time = time;
$$Pchanged = 0; # No special changes in files
$$Plast_result = 0;
@@ -6085,6 +6189,11 @@ sub Run_subst {
'%Z' => $q.$out_dir1.$q,
'%%' => '%' # To allow literal %B, %R, etc, by %%B.
);
+ if ( ($^O eq "MSWin32" ) && $MSWin_back_slash ) {
+ foreach ( '%R', '%B', '%T', '%S', '%D', '%Y', '%Z' ) {
+ $subst{$_} =~ s(/)(\\)g;
+ }
+ }
my @tokens = split /(%.)/, $ext_cmd;
foreach (@tokens) {
@@ -6169,14 +6278,33 @@ sub rdb_primary_run {
# up-to-date:
rdb_do_files( sub { if ($$Pcorrect_after_primary) {&rdb_update1;} } );
+#?? # There may be new source files, and the run may have caused
+#?? # circular-dependency files to be changed. And the regular
+#?? # source files may have been updated during a lengthy run of
+#?? # latex. So redo the makes for sources of the current rule:
+#?? my $submake_return = &rdb_submake;
+#?? &rdb_clear_change_record;
+#?? &rdb_flag_changes_here(0);
+#?? if ($$Pout_of_date && !$silent) {
+#?? &rdb_diagnose_changes( "Rule '$rule': " );
+#?? }
+
$updated = 1; # Flag that some dependent file has been remade
+#?? # Fix the state of the files as of now: this will solve the
+#?? # problem of latex and pdflatex interfering with each other,
+#?? # at the expense of some non-optimality
+#?? #?? Check this is correct:
+#?? &rdb_update_files;
+
if ( $diagnostics ) {
print "$My_name: Rules after run: \n";
rdb_show();
}
$return = $return_latex;
+
+# ???? Is the following needed?
if ($return_latex && $$Pout_of_date_user) {
print "Error in (pdf)LaTeX, but change of user file(s), ",
"so ignore error & provoke rerun\n"
@@ -6187,12 +6315,12 @@ sub rdb_primary_run {
# Summarize issues that may have escaped notice:
my @warnings = ();
if ($bad_reference) {
- push @warnings, "Latex could not resolve all references";
+ push @warnings, "Latex failed to resolve $bad_reference reference(s)";
}
if ($bad_citation) {
- push @warnings, "Latex could not resolve all citations";
+ push @warnings, "Latex failed to resolve $bad_citation citation(s)";
}
- if ($#warnings > 0) {
+ if ($#warnings > -1) {
show_array( "$My_name: Summary of warnings:", @warnings );
}
return $return;
@@ -6296,7 +6424,7 @@ sub rdb_file_change1 {
sub rdb_new_changes {
&rdb_clear_change_record;
- rdb_recurseA( [@_], sub{ &rdb_flag_changes_here(1); } );
+ rdb_recurse( [@_], sub{ &rdb_flag_changes_here(1); } );
return ($#changed >= 0) || ($#no_dest >= 0) || ($#rules_to_apply >= 0);
} #END rdb_new_changes
@@ -6416,8 +6544,8 @@ sub rdb_diagnose_changes {
#************************************************************
-sub rdb_recurseA {
- # Call: rdb_recurseA( rule | [ rules],
+sub rdb_recurse {
+ # Call: rdb_recurse( rule | [ rules],
# \&rule_act1, \&file_act1, \&file_act2,
# \&rule_act2 )
# The actions are pointers to subroutines, and may be null (0, or
@@ -6451,7 +6579,7 @@ sub rdb_recurseA {
foreach $rule ( @heads ) { rdb_recurse_rule( $rule, @_ ); }
-} #END rdb_recurseA
+} #END rdb_recurse
#************************************************************
@@ -6533,7 +6661,7 @@ sub rdb_recurse_rule {
$depth++;
# We may need to repeat actions on dependent rules, without being
# blocked by the test on visited files. So save %visited:
- local %visited_at_rule_start = %visited;
+ # NOT CURRENTLY USED!! local %visited_at_rule_start = %visited;
# At end, the last value set for %visited wins.
rdb_one_rule( $rule, $rule_act1, \&rdb_recurse_file, $rule_act2 );
$depth--;
@@ -6797,8 +6925,8 @@ sub rdb_update_gen_files {
#************************************************************
-sub rdb_update_filesA {
- # Call: rdb_update_filesA
+sub rdb_update_files {
+ # Call: rdb_update_files
# Assumes rule context. Update source files of rule to current state.
rdb_do_files( \&rdb_update1 );
}
@@ -6897,7 +7025,7 @@ sub show_array {
# Then print rest of @_, one item per line preceeded by some space
warn "$_[0]\n";
shift;
- if ($#_ >= 0) { foreach (@_){ warn " '$_'\n";} }
+ if ($#_ >= 0) { foreach (@_){ warn " $_\n";} }
else { warn " NONE\n"; }
}
@@ -7131,6 +7259,7 @@ sub get_checksum_md5 {
my $md5 = Digest::MD5->new;
my $ignore_pattern = '';
+#&traceback;
#warn "======= GETTING MD5: $source\n";
if ( $source eq "" ) {
# STDIN:
@@ -7620,7 +7749,7 @@ sub Run {
# string is then to be obeyed by the system, and any necessary
# detaching (as of a previewer) is done by the executed command(s).
# internal: The following command string, of the form 'routine arguments'
-# specifies a called to the named Perl subroutine.
+# specifies a call to the named Perl subroutine.
# NONE: This does not run anything, but causes an error message to be
# printed. This is provided to allow program names defined in the
# configuration to flag themselves as unimplemented.
@@ -7797,10 +7926,11 @@ sub find_process_id {
#============================================
-sub good_cwd {
- # Return cwd, but under cygwin, convert to MSWin path
- # so that result can be used for input to MSWin programs
- # as well as cygwin programs
+sub cache_good_cwd {
+ # Set cached value of cwd to current cwd.
+ # Under cygwin, the cwd is converted to a native MSWin path so
+ # that the result can be used for input to MSWin programs as well
+ # as cygwin programs.
my $cwd = cwd();
if ( $^O eq "cygwin" ) {
my $cmd = "cygpath -w \"$cwd\"";
@@ -7818,22 +7948,37 @@ sub good_cwd {
" 'Win_cwd'\n";
}
}
- return $cwd;
-}
+ $cache{cwd} = $cwd;
+} # END cache_good_cwd
+
+#============================================
+
+sub good_cwd {
+ # Return cwd, but under cygwin, convert to MSWin path.
+ # Use cached result
+ return $cache{cwd};
+} # END good_cwd
#============================================
# Directory stack routines
sub pushd {
- push @dir_stack, cwd();
- if ( $#_ > -1) { chdir $_[0]; }
+ push @dir_stack, [cwd(), $cache{cwd}];
+ if ( $#_ > -1) {
+ chdir $_[0];
+ &cache_good_cwd;
+ }
}
#************************************************************
sub popd {
- if ($#dir_stack > -1 ) { chdir pop @dir_stack; }
+ if ($#dir_stack > -1 ) {
+ my $Parr = pop @dir_stack;
+ chdir $$Parr[0];
+ $cache{cwd} = $$Parr[1];
+ }
}
#************************************************************
diff --git a/Master/texmf-dist/doc/support/latexmk/CHANGES b/Master/texmf-dist/doc/support/latexmk/CHANGES
index a10034a4616..1ed417667a9 100644
--- a/Master/texmf-dist/doc/support/latexmk/CHANGES
+++ b/Master/texmf-dist/doc/support/latexmk/CHANGES
@@ -355,3 +355,25 @@ From v. 4.30a to 4.31
Documentation improvements.
Minor bug corrections.
+From v. 4.31 to 4.33a
+ Improve operation under MSWindows: substitute "\" for "/" for
+ directory separator in command lines, deal consistently with
+ directory separator, which can be both "\" and "/".
+ Correct some bugs that interfered with use of auxiliary directory
+ and output directory for files generated by (pdf)latex,
+ especially with MiKTeX.
+ Fix problems caused because in the log and fls files MiKTeX writes
+ absolute path for many filenames at and below current directory,
+ and is inconsistent in its use of "/" vs. "\" as directory
+ separator.
+ Add $dvipdf_silent_switch configuration variable.
+ Improve handling of errors in (pdf)latex; previously latexmk would
+ give up processing in some situations continuing is correct.
+ Documentation corrections/improvements.
+ Reduce number of warnings in silent operation.
+ Cure slowness of v. 4.33 under Cygwin.
+
+From v. 4.33a to 4.33b
+ Documentation improvements.
+ Improve text displayed by using -showextraoptions option.
+
diff --git a/Master/texmf-dist/doc/support/latexmk/INSTALL b/Master/texmf-dist/doc/support/latexmk/INSTALL
index 57590715fa6..5dbd3f37d4d 100644
--- a/Master/texmf-dist/doc/support/latexmk/INSTALL
+++ b/Master/texmf-dist/doc/support/latexmk/INSTALL
@@ -1,6 +1,6 @@
INSTALLING latexmk
==================
- (Version 4.31, 30 March 2012)
+ (Version 4.33b, 12 August 2012)
John Collins
Physics Department
diff --git a/Master/texmf-dist/doc/support/latexmk/README b/Master/texmf-dist/doc/support/latexmk/README
index f019652da8d..86efd99d724 100644
--- a/Master/texmf-dist/doc/support/latexmk/README
+++ b/Master/texmf-dist/doc/support/latexmk/README
@@ -1,5 +1,5 @@
-Latexmk, version 4.31, 30 March 2012
-------------------------------------
+Latexmk, version 4.33b, 12 August 2012
+--------------------------------------
Latexmk completely automates the process of generating a LaTeX
document. Essentially, it is a highly specialized cousin of the
@@ -92,8 +92,7 @@ NOTES:-
John Collins
---------------------------- "latexmk -h" ----------------------------
-===========I am /usr/local/lib/latexmk/LatexMk
-Latexmk 4.31: Automatic LaTeX document generation routine
+Latexmk 4.33b: Automatic LaTeX document generation routine
Usage: latexmk [latexmk_options] [filename ...]
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/README b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/README
index 3d67f54d6c0..816526efd8a 100644
--- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/README
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/README
@@ -20,3 +20,16 @@ NOTES:
examples. (The file Latexmk321jTeXShop.zip is the one you want.)
It shows how to use glossaries, epstopdf, pdftricks and pst-pdf.
+4. I have generally arranged for filenames to be quoted on command
+ lines, e.g.,
+
+ system( "makeindex -o \"$_[0].lnd\" \"$_[0].ldx\"" );
+
+ In many cases the quotes may be omitted, as in
+
+ system( "makeindex -o $_[0].lnd $_[0].ldx" );
+
+ But it is preferable to leave the quotes in, since they provide
+ safety against special characters in filenames. The double quotes
+ appear not to cause problems in all situations that I have tried.
+
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/asymptote_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/asymptote_latexmkrc
index 77a0078c9d2..53e2aa4a786 100644
--- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/asymptote_latexmkrc
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/asymptote_latexmkrc
@@ -21,7 +21,7 @@
# The following lines are taken from the documentation for V. 2.03 of
# asymptote:
-sub asy {return system("asy '$_[0]'");}
+sub asy {return system("asy \"$_[0]\"");}
add_cus_dep("asy","eps",0,"asy");
add_cus_dep("asy","pdf",0,"asy");
add_cus_dep("asy","tex",0,"asy");
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/glossary_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/glossary_latexmkrc
index be9f8d7343d..f43b345abd1 100644
--- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/glossary_latexmkrc
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/glossary_latexmkrc
@@ -10,18 +10,18 @@
# 1. For glossaries using glossary package
-add_cus_dep('glo', 'gls', 0, 'makeglo2gls');
+add_cus_dep( 'glo', 'gls', 0, 'makeglo2gls' );
sub makeglo2gls {
- system("makeindex -s '$_[0]'.ist -t '$_[0]'.glg -o '$_[0]'.gls '$_[0]'.glo");
+ system("makeindex -s \"$_[0].ist\" -t \"$_[0].glg\" -o \"$_[0].gls\" \"$_[0].glo\"" );
}
# 2. For acronyms using glossary package:
-add_cus_dep('acr', 'acn', 0, 'makeacr2acn');
+add_cus_dep( 'acr', 'acn', 0, 'makeacr2acn' );
sub makeacr2acn {
- system("makeindex -s '$_[0]'.ist -t '$_[0]'.alg -o '$_[0]'.acn '$_[0]'.acr");
+ system( "makeindex -s \"$_[0].ist\" -t \"$_[0].alg\" -o \"$_[0].acn\" \"$_[0].acr\"" );
}
@@ -31,8 +31,8 @@ sub makeacr2acn {
# 4. If you use the glossaries package and have the makeglossaries
# script installed, then you can do something simpler:
- add_cus_dep('glo', 'gls', 0, 'makeglossaries');
+ add_cus_dep( 'glo', 'gls', 0, 'makeglossaries' );
sub makeglossaries {
- system("makeglossaries $_[0]");
+ system( "makeglossaries \"$_[0]\"" );
}
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/mpost_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/mpost_latexmkrc
index d77cdc41c13..5bcfeb0fdfd 100644
--- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/mpost_latexmkrc
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/mpost_latexmkrc
@@ -8,17 +8,17 @@
# ($out_dir) is set, mpost doesn't put its output in the correct
# place.
-add_cus_dep('mp', '1', 0, 'mpost');
+add_cus_dep( 'mp', '1', 0, 'mpost' );
sub mpost {
my $file = $_[0];
my ($name, $path) = fileparse( $file );
- my $return = system "mpost $file";
+ my $return = system "mpost \"$file\"";
# Fix the problem that mpost puts its output and log files
# in the current directory, not in the auxiliary directory
# (which is often the same as the output directory):
- if ( ($path ne '') && ($path ne '.\') ) {
+ if ( ($path ne '') && ($path ne '.\\') && ($path ne './') ) {
foreach ( "$name.1", "$name.log" ) { move $_, $aux_dir; }
}
return $return;
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pdflatexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pdflatexmkrc
index df5dfd5d81e..6f43e982ec6 100644
--- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pdflatexmkrc
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pdflatexmkrc
@@ -6,72 +6,72 @@ $pdflatex = 'pdflatex --shell-escape %O %S';
# Custom dependency for glossary/glossaries package
# if you make custom glossaries you may have to add items to the @cus_dep_list and corresponding sub-routines
-add_cus_dep('glo', 'gls', 0, 'makeglo2gls');
- sub makeglo2gls {
- system("makeindex -s $_[0].ist -t $_[0].glg -o $_[0].gls $_[0].glo");
- }
+add_cus_dep( 'glo', 'gls', 0, 'makeglo2gls' );
+sub makeglo2gls {
+ system( "makeindex -s \"$_[0].ist\" -t \"$_[0].glg\" -o \"$_[0].gls\" \"$_[0].glo\"" );
+}
# The glossaries package, with the [acronym] option, produces a .acn file when processed with (xe/pdf)latex and
# then makeindex to process the .acn into .acr and finally runs of (xe/pdf)latex to read in the .acr file. Unfortunately
# the glossary package does just the reverse; i.e. (xe/pdf)latex processing produces a .acr files and makeindex then
# is used to convert the .acr file to a .acn file which is then ... . This dependency assumes the glossaries package.
-add_cus_dep('acn', 'acr', 0, 'makeacn2acr');
- sub makeacn2acr {
- system("makeindex -s $_[0].ist -t $_[0].alg -o $_[0].acr $_[0].acn");
- }
+add_cus_dep( 'acn', 'acr', 0, 'makeacn2acr' );
+sub makeacn2acr {
+ system( "makeindex -s \"$_[0].ist\" -t \"$_[0].alg\" -o \"$_[0].acr\" \"$_[0].acn\"" );
+}
# for glossary package (Sigh...) --- they can co-exist!
-add_cus_dep('acr', 'acn', 0, 'makeacr2acn');
- sub makeacr2acn {
- system("makeindex -s $_[0].ist -t $_[0].alg -o $_[0].acn $_[0].acr");
- }
+add_cus_dep( 'acr', 'acn', 0, 'makeacr2acn' );
+sub makeacr2acn {
+ system( "makeindex -s \"$_[0].ist\" -t \"$_[0].alg\" -o \"$_[0].acn\" \"$_[0].acr\"" );
+}
# example of an added custom glossary type that is used in some of the glossary/glossaries example files:
# this is for the new glossary type command \newglossary[nlg]{notation}{not}{ntn}{Notation} from the glossaries package
# NOTE: the glossary package uses a very different command: the <in-ext> and <out-ext>
# are reversed in the calling sequence :-(
-add_cus_dep('ntn', 'not', 0, 'makentn2not');
- sub makentn2not {
- system("makeindex -s $_[0].ist -t $_[0].nlg -o $_[0].not $_[0].ntn");
- }
+add_cus_dep( 'ntn', 'not', 0, 'makentn2not' );
+sub makentn2not {
+ system("makeindex -s \"$_[0].ist\" -t \"$_[0].nlg\" -o \"$_[0].not\" \"$_[0].ntn\"" );
+}
# for the glossary package (Sigh...) --- they can co-exist!
-add_cus_dep('not', 'ntn', 0, 'makenot2ntn');
- sub makenot2ntn {
- system("makeindex -s $_[0].ist -t $_[0].nlg -o $_[0].ntn $_[0].not");
- }
+add_cus_dep( 'not', 'ntn', 0, 'makenot2ntn' );
+sub makenot2ntn {
+ system("makeindex -s \"$_[0].ist\" -t \"$_[0].nlg\" -o \"$_[0].ntn\" \"$_[0].not\"" );
+}
# dependencies for custom indexes using the index package
# examples for sample.tex for index package:
- add_cus_dep('adx', 'and', 0, 'makeadx2and');
- sub makeadx2and {
- system("makeindex -o $_[0].and $_[0].adx");
- }
- add_cus_dep('ndx', 'nnd', 0, 'makendx2nnd');
- sub makendx2nnd {
- system("makeindex -o $_[0].nnd $_[0].ndx");
- }
- add_cus_dep('ldx', 'lnd', 0, 'makeldx2lnd');
- sub makeldx2lnd {
- system("makeindex -o $_[0].lnd $_[0].ldx");
- }
+ add_cus_dep( 'adx', 'and', 0, 'makeadx2and' );
+sub makeadx2and {
+ system( "makeindex -o \"$_[0].and\" \"$_[0].adx\"" );
+}
+add_cus_dep( 'ndx', 'nnd', 0, 'makendx2nnd' );
+sub makendx2nnd {
+ system( "makeindex -o \"$_[0].nnd\" \"$_[0].ndx\"" );
+}
+add_cus_dep( 'ldx', 'lnd', 0, 'makeldx2lnd' );
+sub makeldx2lnd {
+ system( "makeindex -o \"$_[0].lnd\" \"$_[0].ldx\"" );
+}
# 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");
- }
+add_cus_dep( 'nlo', 'nls', 0, 'makenlo2nls' );
+sub makenlo2nls {
+ system( "makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"" );
+}
# Custom dependency and function(s) for epstopdf package
# FOR USERS OF epstopf v1.4 and before: should also work with v1.5 and later
# note: you may get extras runs if you use the .eps extension in the \includgraphics command
# deletes an outdated pdf-image, and triggers a pdflatex-run
-add_cus_dep('eps', 'pdf', 0, 'cus_dep_delete_dest');
+add_cus_dep( 'eps', 'pdf', 0, 'cus_dep_delete_dest' );
# FOR USERS OF epstopdf v1.5 and later only:
# load it as \usepackage[update,prepend]{epstopdf}
# detects an outdated pdf-image, and triggers a pdflatex-run
-#add_cus_dep('eps', 'pdf', 0, 'cus_dep_require_primary_run');
+#add_cus_dep( 'eps', 'pdf', 0, 'cus_dep_require_primary_run' );
# Custom dependecy to convert tif to png
-add_cus_dep('tif', 'png', 0, 'maketif2png');
- sub maketif2png {
- system("convert $_[0].tif $_[0].png");
- }
+add_cus_dep( 'tif', 'png', 0, 'maketif2png' );
+sub maketif2png {
+ system( "convert \"$_[0].tif\" \"$_[0].png\"" );
+}
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sagetex_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sagetex_latexmkrc
index 67e97595f27..d185ac56d94 100644
--- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sagetex_latexmkrc
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sagetex_latexmkrc
@@ -14,8 +14,8 @@
# changed.
-add_cus_dep('sage', 'sout', 0, 'makesout');
+add_cus_dep( 'sage', 'sout', 0, 'makesout' );
$hash_calc_ignore_pattern{'sage'} = '^( _st_.goboom|print .SageT)';
sub makesout {
- system("sage '$_[0].sage'");
+ system( "sage \"$_[0].sage\"" );
} \ No newline at end of file
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc
new file mode 100644
index 00000000000..19f046be6be
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc
@@ -0,0 +1,57 @@
+# This is to allow the use of Sweave with latexmk, and in addition to
+# make synctex work properly with it.
+# SEE THE IMPORTANT NOTES below.
+#
+# Sweave (http://www.stat.uni-muenchen.de/~leisch/Sweave/) is a tool
+# that allows to embed the R code for complete data analyses in latex
+# documents. The user edits a file with an extension like .Rnw, and
+# the .tex file is generated from this.
+#
+# Four problems are solved by the code below:
+# 1. Generate the .tex file automatically.
+# 2. Arrange not to re-run unmodified chunks of R code. (A pure
+# optimization.)
+# 3. Fix the execution environment for (pdf)latex.
+# 4. Deal with synctex: If the user wants to use synctex
+# (www.tug.org/TUGboat/tb29-3/tb93laurens.pdf) to synchronize the
+# pdf file with the source file, by default synctex does the
+# synchronization with the generated .tex file, not the original
+# source file. Postprocessing of the .synctex.gz file is necessary
+# to fix this.
+#
+# The following version was worked out and tested by a user (thanks
+# to Brian Beitzel) on MSWindows. It will need at least one change to
+# work on UNIX-like operating systems (which include Linux and OS-X).
+
+# N.B. ===> IMPORTANT NOTES <===
+#
+# 1. The patchDVI package for R needs to be installed from R-Forge, as
+# follows:
+#
+# install.packages("patchDVI", repos="http://R-Forge.R-project.org")
+#
+# 2. In all Sweave (.Rnw) documents, the following lines must be included:
+#
+# \usepackage{Sweave}
+# \SweaveOpts{concordance=TRUE}
+
+
+# Fix the pdflatex command to run Sweave first, and to postprocess the
+# .synctex.gz file:
+# !!!!! THIS IS THE VERSION FOR MS-WINDOWS, with && as a command
+# separator
+$pdflatex = "cmd /c "
+ . "Rscript -e \"library(cacheSweave); setCacheDir(getwd()); "
+ . "Sweave('%S', driver=cacheSweaveDriver)\""
+ . " && R CMD pdflatex -interaction=nonstopmode -synctex=1 %O %B.tex"
+ . " && Rscript -e "
+ . "\"library('patchDVI');patchSynctex('%B.synctex.gz')\"";
+#
+# !!!TO FIX THIS FOR Linux/OS-X/UNIX, try uncommenting the following:
+# (this version hasn't been tested).
+#$pdflatex = "Rscript -e \"library(cacheSweave); setCacheDir(getwd()); "
+# . "Sweave('%S', driver=cacheSweaveDriver)\""
+# . " ; R CMD pdflatex -interaction=nonstopmode -synctex=1 %O %B.tex"
+# . " ; Rscript -e "
+# . "\"library('patchDVI');patchSynctex('%B.synctex.gz')\"";
+
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xelatex_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xelatex_latexmkrc
index c9f3a7fc8bd..896c7c5e310 100644
--- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xelatex_latexmkrc
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xelatex_latexmkrc
@@ -2,6 +2,9 @@
# with latexmk. Xelatex uses Unicode and "supporting modern font
# technologies such as OpenType or Apple Advanced Typography.
#
+# WARNING: latexmk.pl is changing, and plans to have internal
+# support for xelatex.
+#
# Since xelatex only produces pdf files, it is a replacement for
# pdflatex. To make it your default typesetting engine within latexmk
# you will not only need to set the $pdflatex variable to require the
diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf
index f400ae5a157..eb3c014fe72 100644
--- a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf
+++ b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.txt b/Master/texmf-dist/doc/support/latexmk/latexmk.txt
index 3e57500efa6..d863416b651 100644
--- a/Master/texmf-dist/doc/support/latexmk/latexmk.txt
+++ b/Master/texmf-dist/doc/support/latexmk/latexmk.txt
@@ -61,7 +61,7 @@ DESCRIPTION
- 30 March 2012 1
+ 12 August 2012 1
@@ -110,24 +110,24 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE
- (All options can be introduced by single or double "-" characters,
- e.g., "latexmk -help" or "latexmk --help".)
+ In general the command line to invoke latexmk has the form
- file One or more files can be specified. If no files are specified,
- latexmk will, by default, run on all files in the current work-
- ing directory with a ".tex" extension. This behavior can be
- changed: see the description concerning the @default_files vari-
- able in the section "List of configuration variables usable in
- initialization files".
+ latexmk [options] [file]
- If a file is specified without an extension, then the ".tex" extension
- is automatically added, just as LaTeX does. Thus, if you specify:
+ All options can be introduced by single or double "-" characters, e.g.,
+ "latexmk -help" or "latexmk --help".
- latexmk foo
+ Note: In addition to the options in the list below, latexmk recognizes
+ almost all the options recognized by the latex and pdflatex programs in
+ one of both of their current TeXLive and MiKTeX implementations. Some
+ of the options for these programs also trigger special action or behav-
+ ior by latexmk, in which case they are in this list. Otherwise, they
+ are just passed through to a called latex or pdflatex program. Run
+ latexmk with the -showextraoptions to get a list of the options that
- 30 March 2012 2
+ 12 August 2012 2
@@ -136,20 +136,39 @@ LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE
LATEXMK(1L) LATEXMK(1L)
+ latexmk accepts and that are simply passed through to latex or pdfla-
+ tex. See also the explanation of the -showextraoptions option for more
+ information.
+
+ Definitions of options and arguments
+
+
+ file One or more files can be specified. If no files are specified,
+ latexmk will, by default, run on all files in the current work-
+ ing directory with a ".tex" extension. This behavior can be
+ changed: see the description concerning the @default_files vari-
+ able in the section "List of configuration variables usable in
+ initialization files".
+
+ If a file is specified without an extension, then the ".tex" extension
+ is automatically added, just as LaTeX does. Thus, if you specify:
+
+ latexmk foo
+
then latexmk will operate on the file "foo.tex".
-auxdir=FOO or -aux-directory=FOO
- Sets the directory for auxiliary output files of (pdf)latex
- (.aux, .log etc). This achieves its effect by the -aux-direc-
- tory option of (pdf)latex, which currently is only implemented
+ Sets the directory for auxiliary output files of (pdf)latex
+ (.aux, .log etc). This achieves its effect by the -aux-direc-
+ tory option of (pdf)latex, which currently is only implemented
on the MiKTeX version of (pdf)latex.
- See also the -outdir/-output-directory options, and the
+ See also the -outdir/-output-directory options, and the
$aux_dir, $out_dir, and $search_path_separator configuration
- variables of latexmk. In particular, see the documentation of
- $out_dir for some complications on what directory names are
+ variables of latexmk. In particular, see the documentation of
+ $out_dir for some complications on what directory names are
suitable.
@@ -158,69 +177,68 @@ LATEXMK(1L) LATEXMK(1L)
When the source file uses bbl files for bibliography, run bibtex
or biber as needed to regenerate the bbl files.
- This property can also be configured by setting the $bibtex_use
+ This property can also be configured by setting the $bibtex_use
variable to 2 in a configuration file
-bibtex-
Never run bibtex or biber.
- A common use for this option is when a document comes from an
- external source, complete with its bbl file(s), and the user
- does not have the corresponding bib files available. In this
- situation use of the -bibtex- option will prevent latexmk from
+ A common use for this option is when a document comes from an
+ external source, complete with its bbl file(s), and the user
+ does not have the corresponding bib files available. In this
+ situation use of the -bibtex- option will prevent latexmk from
trying to run bibtex or biber, which would result in overwriting
of the bbl files.
- -bibtex-cond
- When the source file uses bbl file(s) for the bibliography, run
- bibtex or biber as needed to regenerate the bbl files, but only
- if the relevant bib file(s) exist. Thus when the bib files are
- not available, bibtex or biber is not run, thereby avoiding
- overwriting of the bbl file(s). This is the default setting.
-
- (Note that it is possible for latexmk to decide that the bib
- file does not exist, even though the bib file does exist and
- bibtex or biber finds it. The problem is that the bib file may
- not be in the current directory but in some search path; the
- places latexmk and bibtex or biber cause to be searched need not
- be identical. On modern installations of TeX and related pro-
- grams this problem should not arise, since latexmk uses the
- kpsewhich program to do the search, and kpsewhich should use the
- same search path as bibtex and biber. If this problem arises,
- use the -bibtex option when invoking latexmk.)
+ 12 August 2012 3
- 30 March 2012 3
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ -bibtex-cond
+ When the source file uses bbl file(s) for the bibliography, run
+ bibtex or biber as needed to regenerate the bbl files, but only
+ if the relevant bib file(s) exist. Thus when the bib files are
+ not available, bibtex or biber is not run, thereby avoiding
+ overwriting of the bbl file(s). This is the default setting.
+ (Note that it is possible for latexmk to decide that the bib
+ file does not exist, even though the bib file does exist and
+ bibtex or biber finds it. The problem is that the bib file may
+ not be in the current directory but in some search path; the
+ places latexmk and bibtex or biber cause to be searched need not
+ be identical. On modern installations of TeX and related pro-
+ grams this problem should not arise, since latexmk uses the
+ kpsewhich program to do the search, and kpsewhich should use the
+ same search path as bibtex and biber. If this problem arises,
+ use the -bibtex option when invoking latexmk.)
-bm <message>
- A banner message to print diagonally across each page when con-
- verting the dvi file to postscript. The message must be a sin-
+ A banner message to print diagonally across each page when con-
+ verting the dvi file to postscript. The message must be a sin-
gle argument on the command line so be careful with quoting spa-
ces and such.
- Note that if the -bm option is specified, the -ps option is
+ Note that if the -bm option is specified, the -ps option is
assumed.
-bi <intensity>
- How dark to print the banner message. A decimal number between
+ How dark to print the banner message. A decimal number between
0 and 1. 0 is black and 1 is white. The default is 0.95, which
is OK unless your toner cartridge is getting low.
-bs <scale>
- A decimal number that specifies how large the banner message
- will be printed. Experimentation is necessary to get the right
- scale for your message, as a rule of thumb the scale should be
- about equal to 1100 divided by the number of characters in the
+ A decimal number that specifies how large the banner message
+ will be printed. Experimentation is necessary to get the right
+ scale for your message, as a rule of thumb the scale should be
+ about equal to 1100 divided by the number of characters in the
message. The default is 220.0 which is just right for 5 charac-
ter messages.
@@ -230,183 +248,181 @@ LATEXMK(1L) LATEXMK(1L)
-c Clean up (remove) all regeneratable files generated by latex and
bibtex or biber except dvi, postscript and pdf. These files are
- a combination of log files, aux files, latexmk's database file
- of source file information, and those with extensions specified
- in the @generated_exts configuration variable. In addition,
- files with extensions by the $clean_ext configuration variable
+ a combination of log files, aux files, latexmk's database file
+ of source file information, and those with extensions specified
+ in the @generated_exts configuration variable. In addition,
+ files with extensions by the $clean_ext configuration variable
are removed.
- This cleanup is instead of a regular make. See the -gg option
+ This cleanup is instead of a regular make. See the -gg option
if you want to do a cleanup then a make.
- If $bibtex_use is set to 0 or 1, bbl files are counted as non-
- regeneratable.
- If $cleanup_includes_cusdep_generated is nonzero, regeneratable
- files are considered as including those generated by custom
- dependencies and are also deleted. Otherwise these files are
- not deleted.
- -C Clean up (remove) all regeneratable files generated by latex and
- bibtex or biber. This is the same as the -c option with the
- addition of dvi, postscript and pdf files, and those with exten-
- sions in the $clean_full_ext configuration variable.
+ 12 August 2012 4
- This cleanup is instead of a regular make. See the -gg option
- if you want to do a cleanup than a make.
-
- If $bibtex_use is set to 0 or 1, bbl files are counted as non-
- 30 March 2012 4
+LATEXMK(1L) LATEXMK(1L)
+ If $bibtex_use is set to 0 or 1, bbl files are counted as non-
+ regeneratable.
+ If $cleanup_includes_cusdep_generated is nonzero, regeneratable
+ files are considered as including those generated by custom
+ dependencies and are also deleted. Otherwise these files are
+ not deleted.
-LATEXMK(1L) LATEXMK(1L)
+ -C Clean up (remove) all regeneratable files generated by latex and
+ bibtex or biber. This is the same as the -c option with the
+ addition of dvi, postscript and pdf files, and those with exten-
+ sions in the $clean_full_ext configuration variable.
+ This cleanup is instead of a regular make. See the -gg option
+ if you want to do a cleanup than a make.
+ If $bibtex_use is set to 0 or 1, bbl files are counted as non-
regeneratable.
- If $cleanup_includes_cusdep_generated is nonzero, regeneratable
- files are considered as including those generated by custom
- dependencies and are also deleted. Otherwise these files are
+ If $cleanup_includes_cusdep_generated is nonzero, regeneratable
+ files are considered as including those generated by custom
+ dependencies and are also deleted. Otherwise these files are
not deleted.
- -CA (Obsolete). Now equivalent to the -C option. See that option
+ -CA (Obsolete). Now equivalent to the -C option. See that option
for details.
- -CF Remove the file containing the database of source file informa-
+ -CF Remove the file containing the database of source file informa-
tion, before doing the other actions requested.
- -d Set draft mode. This prints the banner message "DRAFT" across
- your page when converting the dvi file to postscript. Size and
+ -d Set draft mode. This prints the banner message "DRAFT" across
+ your page when converting the dvi file to postscript. Size and
intensity can be modified with the -bs and -bi options. The -bm
- option will override this option as this is really just a short
+ option will override this option as this is really just a short
way of specifying:
latexmk -bm DRAFT
- Note that if the -d option is specified, the -ps option is
+ Note that if the -d option is specified, the -ps option is
assumed.
-deps Show a list of dependent files after processing. This is in the
- form of a dependency list of the form used by the make program,
+ form of a dependency list of the form used by the make program,
and it is therefore suitable for use in a Makefile. It gives an
overall view of the files without listing intermediate files, as
well as latexmk can determine them.
- By default the list of dependent files is sent to stdout (i.e.,
- normally to the screen unless you've redirected latexmk's out-
- put). But you can set the filename where the list is sent by
- the -deps-out= option.
+ By default the list of dependent files is sent to stdout (i.e.,
+ normally to the screen unless you've redirected latexmk's out-
+ put). But you can set the filename where the list is sent by the
+ -deps-out= option.
- See the section "USING latexmk WITH make" for an example of how
+ See the section "USING latexmk WITH make" for an example of how
to use a dependency list with make.
- Users familiar with GNU automake and gcc will find that the
- -deps option is very similar in its purpose and results to the
- -M option to gcc. (In fact, latexmk also has options -M, -MF,
- and -MP options that behave like those of gcc.)
- -dependents
- Equivalent to -deps.
-
- -deps- Do not show a list of dependent files after processing. (This
- is the default.)
- -dependents-
- Equivalent to -deps-.
+ 12 August 2012 5
- -deps-out=FILENAME
- Set the filename to which the list of dependent files is
- 30 March 2012 5
+LATEXMK(1L) LATEXMK(1L)
+ Users familiar with GNU automake and gcc will find that the
+ -deps option is very similar in its purpose and results to the
+ -M option to gcc. (In fact, latexmk also has options -M, -MF,
+ and -MP options that behave like those of gcc.)
+ -dependents
+ Equivalent to -deps.
-LATEXMK(1L) LATEXMK(1L)
+ -deps- Do not show a list of dependent files after processing. (This
+ is the default.)
+ -dependents-
+ Equivalent to -deps-.
- written. If the FILENAME argument is omitted or set to '-',
- then the output is sent to stdout.
+ -deps-out=FILENAME
+ Set the filename to which the list of dependent files is writ-
+ ten. If the FILENAME argument is omitted or set to "-", then
+ the output is sent to stdout.
- Use of this option also turns on the output of the list of
+ Use of this option also turns on the output of the list of
dependent files after processing.
- -dF Dvi file filtering. The argument to this option is a filter
- which will generate a filtered dvi file with the extension
- ".dviF". All extra processing (e.g. conversion to postscript,
- preview, printing) will then be performed on this filtered dvi
+ -dF Dvi file filtering. The argument to this option is a filter
+ which will generate a filtered dvi file with the extension
+ ".dviF". All extra processing (e.g. conversion to postscript,
+ preview, printing) will then be performed on this filtered dvi
file.
Example usage: To use dviselect to select only the even pages of
the dvi file:
- latexmk -dF 'dviselect even' foo.tex
+ latexmk -dF "dviselect even" foo.tex
-diagnostics
- Print detailed diagnostics during a run. This may help for
+ Print detailed diagnostics during a run. This may help for
debugging problems or to understand latexmk's behavior in diffi-
cult situations.
-dvi Generate dvi version of document.
- -dvi- Turn off generation of dvi version of document. (This may get
- overridden, if some other file is made (e.g., a .ps file) that
- is generated from the dvi file, or if no generated file at all
+ -dvi- Turn off generation of dvi version of document. (This may get
+ overridden, if some other file is made (e.g., a .ps file) that
+ is generated from the dvi file, or if no generated file at all
is requested.)
-e <code>
- Execute the specified initialization code before processing.
- The code is Perl code of the same form as is used in latexmk's
+ Execute the specified initialization code before processing.
+ The code is Perl code of the same form as is used in latexmk's
initialization files -- for more details, see the information on
- the -r option, and the section about "Configuration/initializa-
- tion (RC) files". The code is typically a sequence of assign-
+ the -r option, and the section about "Configuration/initializa-
+ tion (RC) files". The code is typically a sequence of assign-
ment statements separated by semicolons.
- The code is executed when the -e option is encountered during
- latexmk's parsing of its command line. See the -r option for a
- way of executing initialization code from a file. An error
- results in latexmk stopping. Multiple instances of the -r and
- -e options can be used, and they are executed in the order they
- appear on the command line.
+ The code is executed when the -e option is encountered during
- Some care is needed to deal with proper quoting of special char-
- acters in the code on the command line. For example, suppose
- you want to set the latex command to use its -shell-escape
- option, then under UNIX/LINUX you could use the line
- latexmk -e '$latex=q/latex %O -shell-escape %S/' file.tex
- Note that the single quotes block normal UNIX/LINUX command
- shells from treating the characters inside the quotes as spe-
- cial. (In this example, the q/.../ construct is a Perl idiom
+ 12 August 2012 6
- 30 March 2012 6
+LATEXMK(1L) LATEXMK(1L)
+ latexmk's parsing of its command line. See the -r option for a
+ way of executing initialization code from a file. An error
+ results in latexmk stopping. Multiple instances of the -r and
+ -e options can be used, and they are executed in the order they
+ appear on the command line.
-LATEXMK(1L) LATEXMK(1L)
+ Some care is needed to deal with proper quoting of special char-
+ acters in the code on the command line. For example, suppose
+ you want to set the latex command to use its -shell-escape
+ option, then under UNIX/LINUX you could use the line
+ latexmk -e '$latex=q/latex %O -shell-escape %S/' file.tex
- equivalent to using single quotes. This avoids the complica-
- tions of getting a quote character inside an already quoted
- string in a way that is independent of both the shell and the
+ Note that the single quotes block normal UNIX/LINUX command
+ shells from treating the characters inside the quotes as spe-
+ cial. (In this example, the q/.../ construct is a Perl idiom
+ equivalent to using single quotes. This avoids the complica-
+ tions of getting a quote character inside an already quoted
+ string in a way that is independent of both the shell and the
operating-system.)
- The above command line will NOT work under MS-Windows with
- cmd.exe or command.com or 4nt.exe. For MS-Windows with these
+ The above command line will NOT work under MS-Windows with
+ cmd.exe or command.com or 4nt.exe. For MS-Windows with these
command shells you could use
latexmk -e "$latex=q/latex %O -shell-escape %S/" file.tex
@@ -415,22 +431,22 @@ LATEXMK(1L) LATEXMK(1L)
latexmk -e "$latex='latex %O -shell-escape %S'" file.tex
- The last two examples will NOT work with UNIX/LINUX command
+ The last two examples will NOT work with UNIX/LINUX command
shells.
- -f Force latexmk to continue document processing despite errors.
+ -f Force latexmk to continue document processing despite errors.
Normally, when latexmk detects that LaTeX or another program has
found an error which will not be resolved by further processing,
no further processing is carried out.
-f- Turn off the forced processing-past-errors such as is set by the
- -f option. This could be used to override a setting in a con-
+ -f option. This could be used to override a setting in a con-
figuration file.
- -g Force latexmk to process document fully, even under situations
- where latexmk would normally decide that no changes in the
- source files have occurred since the previous run. This option
- is useful, for example, if you change some options and wish to
+ -g Force latexmk to process document fully, even under situations
+ where latexmk would normally decide that no changes in the
+ source files have occurred since the previous run. This option
+ is useful, for example, if you change some options and wish to
reprocess the files.
-g- Turn off -g.
@@ -438,9 +454,30 @@ LATEXMK(1L) LATEXMK(1L)
-gg "Super go mode" or "clean make": clean out generated files as if
-C had been given, and then do a regular make.
+
+
+
+ 12 August 2012 7
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
-h, -help
Print help information.
+ -jobname=STRING
+ Set the basename of output files(s) to STRING, instead of the
+ default, which is the basename of the specified TeX file.
+
+ This is like the same option for current implementations of the
+ latex and pdflatex, and the passing of this option to these pro-
+ grams is part of latexmk's implementation of -jobname.
+
+
-l Run in landscape mode, using the landscape mode for the preview-
ers and the dvi to postscript converters. This option is not
normally needed nowadays, since current previewers normally
@@ -448,23 +485,12 @@ LATEXMK(1L) LATEXMK(1L)
-l- Turn off -l.
- -latex='command'
+ -latex="COMMAND"
This sets the string specifying the command to run latex, and is
typically used to add desired options. Since the string nor-
mally contains spaces, it should be quoted, e.g.,
- latex -latex='latex --shell-escape %O %S' foo.tex
-
-
-
- 30 March 2012 7
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
+ latex -latex="latex --shell-escape %O %S" foo.tex
The specification of the contents of the string are the same as
for the $latex configuration variable. Depending on your oper-
@@ -493,13 +519,25 @@ LATEXMK(1L) LATEXMK(1L)
-new-viewer
When in continuous-preview mode, always start a new viewer to
- view the generated file. By default, latexmk will, in continu-
- ous-preview mode, test for a previously running previewer for
- the same file and not start a new one if a previous previewer is
- running. However, its test sometimes fails (notably if there is
- an already-running previewer that is viewing a file of the same
- name as the current file, but in a different directory). This
- option turns off the default behavior.
+ view the generated file. By default, latexmk will, in
+
+
+
+ 12 August 2012 8
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
+ continuous-preview mode, test for a previously running previewer
+ for the same file and not start a new one if a previous pre-
+ viewer is running. However, its test sometimes fails (notably
+ if there is an already-running previewer that is viewing a file
+ of the same name as the current file, but in a different direc-
+ tory). This option turns off the default behavior.
-new-viewer-
The inverse of the -new-viewer option. It puts latexmk in its
@@ -520,18 +558,6 @@ LATEXMK(1L) LATEXMK(1L)
N.B. Normally the initialization files are read and obeyed, and
then command line options are obeyed in the order they are
-
-
-
- 30 March 2012 8
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
encountered. Then -norc is an exception to this rule: it is
acted on first, no matter where is occurs on the command line.
@@ -560,6 +586,18 @@ LATEXMK(1L) LATEXMK(1L)
However, printing is enabled by default only under UNIX/LINUX
systems, where the default is to use the lpr command. In gen-
eral, the correct behavior for printing very much depends on
+
+
+
+ 12 August 2012 9
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
your system's software. In particular, under MS-Windows you
must have suitable program(s) available, and you must have con-
figured the print commands used by latexmk. This can be non-
@@ -585,25 +623,12 @@ LATEXMK(1L) LATEXMK(1L)
overridden if some other option requires the generation of a pdf
file.)
-
-
-
-
- 30 March 2012 9
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
- -pdflatex='command'
+ -pdflatex="COMMAND"
This sets the string specifying the command to run pdflatex, and
is typically used to add desired options. Since the string nor-
mally contains spaces, it should be quoted, e.g.,
- latex -pdf -pdflatex='pdflatex --shell-escape %O %S'
+ latex -pdf -pdflatex="pdflatex --shell-escape %O %S"
foo.tex
The specification of the contents of the string are the same as
@@ -626,7 +651,20 @@ LATEXMK(1L) LATEXMK(1L)
-ps Generate postscript version of document.
- -ps- Turn off generation of postscript version of document. This can
+ -ps-
+
+
+
+ 12 August 2012 10
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
+ Turn off generation of postscript version of document. This can
be used to override a setting in a configuration file. (It may
get overridden by some other option that requires a postscript
file, for example a request for printing.)
@@ -652,18 +690,6 @@ LATEXMK(1L) LATEXMK(1L)
select the kind of file to be previewed (dvi, ps or pdf). Oth-
erwise the viewer views the "highest" kind of file selected, by
the -dvi, -ps, -pdf, -pdfps options, in the order dvi, ps, pdf
-
-
-
- 30 March 2012 10
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
(low to high). If no file type has been selected, the dvi pre-
viewer will be used. This option is incompatible with the -p
and -pvc options, so it turns them off.
@@ -692,6 +718,18 @@ LATEXMK(1L) LATEXMK(1L)
pdf file is read.) Many other previewers will need a manual
update.
+
+
+
+ 12 August 2012 11
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
Important note: the acroread program on MS-Windows locks the pdf
file, and prevents new versions being written, so it is a bad
idea to use acroread to view pdf files in preview-continuous
@@ -718,18 +756,6 @@ LATEXMK(1L) LATEXMK(1L)
Read the specified initialization file ("RC file") before pro-
cessing.
-
-
-
- 30 March 2012 11
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
Be careful about the ordering: (1) Standard initialization files
-- see the section below on "Configuration/initialization (RC)
files" -- are read first. (2) Then the options on the command
@@ -758,6 +784,18 @@ LATEXMK(1L) LATEXMK(1L)
a run of latex or pdflatex.
For further information, see the documentation for the $recorder
+
+
+
+ 12 August 2012 12
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
configuration variable.
-recorder-
@@ -769,6 +807,36 @@ LATEXMK(1L) LATEXMK(1L)
Do not show a list of latexmk's rules and dependencies after
processing. (This is the default.)
+ -showextraoptions
+ Show the list of extra latex and pdflatex options that latexmk
+ recognizes. These are options for the latex and pdflatex that
+ latexmk recognizes, but simply passes through to these programs
+ when they are run. These options are (currently) a combination
+ of those allowed by the TeXLive and MiKTeX implementations. (If
+ a particular option is given to latexmk but is not handled by
+ the particular implementation of latex or pdflatex that is being
+ used, that program will probably give an error message.) These
+ options are very numerous, but are not listed in this documenta-
+ tion because they have no effect on latexmk's actions.
+
+ There are a few options (-includedirectory=dir, -initialize,
+ -ini) that are not recognized, either because they don't fit
+ with latexmk's intended operations, or because they need special
+ processing by latexmk that isn't implemented (at least, not
+ yet).
+
+ There are also options that are accepted by latex etc, but
+ instead trigger actions by latexmk: -help, -version.
+
+ Finally, there are certain options for latex and pdflatex (e.g.,
+ -recorder) that trigger special actions or behavior by latexmk
+ itself as well as being passed in some form to the called latex
+ and pdflatex program, or that affect other programs as well.
+ These options do have entries in this documentation. These
+ options are: -jobname=STRING, -aux-directory=dir, -output-direc-
+ tory=DIR, -quiet, and -recorder.
+
+
-silent
Run commands silently, i.e., with options that reduce the amount
of diagnostics generated. For example, with the default set-
@@ -781,13 +849,11 @@ LATEXMK(1L) LATEXMK(1L)
To change the options used to make the commands run silently,
you need to configure latexmk with changed values of its config-
uration variables, the relevant ones being $bib-
- tex_silent_switch, $biber_silent_switch, $dvips_silent_switch,
- $latex_silent_switch, and $pdflatex_silent_switch.
-
+ tex_silent_switch, $biber_silent_switch, $dvipdf_silent_switch,
- 30 March 2012 12
+ 12 August 2012 13
@@ -796,26 +862,29 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ $dvips_silent_switch, $latex_silent_switch, $makein-
+ dex_silent_switch, and $pdflatex_silent_switch.
+
-use-make
- When after a run of latex or pdflatex, there are warnings about
+ When after a run of latex or pdflatex, there are warnings about
missing files (e.g., as requested by the LaTeX \input, \include,
- and \includgraphics), latexmk tries to make them by a custom
+ and \includgraphics), latexmk tries to make them by a custom
dependency. If no relevant custom dependency with an appropriate
- source file is found, and if the -use-make option is set, then
- latexmk will try as a resort using the make program to try to
+ source file is found, and if the -use-make option is set, then
+ latexmk will try as a resort using the make program to try to
make the missing files.
- Note that the filename may be specified without an extension,
- e.g., by \includegraphics{drawing} in a LaTeX file. In that
- case, latexmk will try making drawing.ext with ext set in turn
- to the possible extensions that are relevant for latex (or as
+ Note that the filename may be specified without an extension,
+ e.g., by \includegraphics{drawing} in a LaTeX file. In that
+ case, latexmk will try making drawing.ext with ext set in turn
+ to the possible extensions that are relevant for latex (or as
appropriate pdflatex).
- See also the documentation for the $use_make_for_missing_files
+ See also the documentation for the $use_make_for_missing_files
configuration variable.
-use-make-
- Do not use the make program to try to make missing files.
+ Do not use the make program to try to make missing files.
(Default.)
-v, -version
@@ -831,29 +900,26 @@ LATEXMK(1L) LATEXMK(1L)
-xelatex
Use xelatex. That is, use xelatex to process the source file(s)
- to pdf (in place of pdflatex). This option is exactly equiva-
+ to pdf (in place of pdflatex). This option is exactly equiva-
lent to specifying the following sequence of options:
-pdflatex="xelatex %O %S" -pdf -dvi- -ps
- The preview-continuous option -pvc can only work with one file. So in
- this case you will normally only specify one filename on the command
+ The preview-continuous option -pvc can only work with one file. So in
+ this case you will normally only specify one filename on the command
line.
- Options -p, -pv and -pvc are mutually exclusive. So each of these
+ Options -p, -pv and -pvc are mutually exclusive. So each of these
options turns the others off.
EXAMPLES
% latexmk thesis # run latex enough times to resolve
- cross-references
-
- % latexmk -pvc -ps thesis# run latex enough times to resolve
- 30 March 2012 13
+ 12 August 2012 14
@@ -862,6 +928,9 @@ EXAMPLES
LATEXMK(1L) LATEXMK(1L)
+ cross-references
+
+ % latexmk -pvc -ps thesis# run latex enough times to resolve
cross-references, make a postscript
file, start a previewer. Then
watch for changes in the source
@@ -889,7 +958,7 @@ CONFIGURATION/INITIALIZATION (RC) FILES
"/usr/local/share/latexmk/LatexMk",
"/usr/local/lib/latexmk/LatexMk".
On a MS-WINDOWS system it looks for "C:\latexmk\LatexMk".
- On a cygwin system (i.e., a MS-Windows system in which perl is that
+ On a cygwin system (i.e., a MS-Windows system in which perl is that
of cygwin), latexmk reads for the first it finds of
"/cygdrive/c/latexmk/LatexMk",
"/opt/local/share/latexmk/LatexMk",
@@ -897,29 +966,26 @@ CONFIGURATION/INITIALIZATION (RC) FILES
"/usr/local/lib/latexmk/LatexMk".
2) The user's RC file, "$HOME/.latexmkrc", if it exists. Here $HOME is
- the user's home directory. [Latexmk determines the user's home direc-
- tory as follows: It is the value of the environment variable HOME, if
- this variable exists, which normally is the case on UNIX-like systems
- (including LINUX and OS-X). Otherwise the environment variable USER-
+ the user's home directory. [Latexmk determines the user's home direc-
+ tory as follows: It is the value of the environment variable HOME, if
+ this variable exists, which normally is the case on UNIX-like systems
+ (including LINUX and OS-X). Otherwise the environment variable USER-
PROFILE is used, if it exists, which normally is the case on MS-Windows
systems. Otherwise a blank string is used instead of $HOME.]
- 3) The RC file in the current working directory. This file can be
- named either "latexmkrc" or ".latexmkrc", and the first of these to be
+ 3) The RC file in the current working directory. This file can be
+ named either "latexmkrc" or ".latexmkrc", and the first of these to be
found is used, if any.
4) Any RC file(s) specified on the command line with the -r option.
Each RC file is a sequence of Perl commands. Naturally, a user can use
- this in creative ways. But for most purposes, one simply uses a
- sequence of assignment statements that override some of the built-in
- settings of Latexmk. Straightforward cases can be handled without
- knowledge of the Perl language by using the examples in this document
- as templates. Comment lines are introduced by the "#" character.
+ this in creative ways. But for most purposes, one simply uses a
+ sequence of assignment statements that override some of the built-in
- 30 March 2012 14
+ 12 August 2012 15
@@ -928,20 +994,24 @@ CONFIGURATION/INITIALIZATION (RC) FILES
LATEXMK(1L) LATEXMK(1L)
- Note that command line options are obeyed in the order in which they
+ settings of Latexmk. Straightforward cases can be handled without
+ knowledge of the Perl language by using the examples in this document
+ as templates. Comment lines are introduced by the "#" character.
+
+ Note that command line options are obeyed in the order in which they
are written; thus any RC file specified on the command line with the -r
- option can override previous options but can be itself overridden by
- later options on the command line. There is also the -e option, which
+ option can override previous options but can be itself overridden by
+ later options on the command line. There is also the -e option, which
allows initialization code to be specified in latexmk's command line.
- For possible examples of code for in an RC file, see the directory
- example_rcfiles in the distribution of latexmk (e.g., at
+ For possible examples of code for in an RC file, see the directory
+ example_rcfiles in the distribution of latexmk (e.g., at
http://ctan.tug.org/tex-archive/support/latexmk/example_rcfiles).
HOW TO SET VARIABLES IN INITIALIZATION FILES
- The important variables that can be configured are described in the
- section "List of configuration variables usable in initialization
+ The important variables that can be configured are described in the
+ section "List of configuration variables usable in initialization
files". Syntax for setting these variables is of the following forms:
$bibtex = 'bibtex %O %B';
@@ -954,38 +1024,34 @@ HOW TO SET VARIABLES IN INITIALIZATION FILES
@default_files = ('paper', 'paper1');
- for the setting of an array of strings. It is possible to append an
+ for the setting of an array of strings. It is possible to append an
item to an array variable as follows:
push @default_files, 'paper2';
- Note that simple "scalar" variables have names that begin with a $
+ Note that simple "scalar" variables have names that begin with a $
character and array variables have names that begin with a @ character.
Each statement ends with a semicolon.
- Strings should be enclosed in single quotes. (You could use double
- quotes, as in many programming languages. But then the Perl program-
- ming language brings into play some special rules for interpolating
- variables into strings. People not fluent in Perl will want to avoid
+ Strings should be enclosed in single quotes. (You could use double
+ quotes, as in many programming languages. But then the Perl program-
+ ming language brings into play some special rules for interpolating
+ variables into strings. People not fluent in Perl will want to avoid
these complications.)
- You can do much more complicated things, but for this you will need to
+ You can do much more complicated things, but for this you will need to
consult a manual for the Perl programming language.
FORMAT OF COMMAND SPECIFICATIONS
- Some of the variables set the commands that latexmk uses for carrying
- out its work, for example to generate a dvi file from a tex file or to
- view a postscript file. This section describes some important features
- of how the commands are specified.
-
- Placeholders: Supposed you wanted latexmk to use the command elatex in
+ Some of the variables set the commands that latexmk uses for carrying
+ out its work, for example to generate a dvi file from a tex file or to
- 30 March 2012 15
+ 12 August 2012 16
@@ -994,64 +1060,64 @@ FORMAT OF COMMAND SPECIFICATIONS
LATEXMK(1L) LATEXMK(1L)
- place of the regular latex command, and suppose moreover that you
- wanted to give it the option "--shell-escape". You could do this by
+ view a postscript file. This section describes some important features
+ of how the commands are specified.
+
+ Placeholders: Supposed you wanted latexmk to use the command elatex in
+ place of the regular latex command, and suppose moreover that you
+ wanted to give it the option "--shell-escape". You could do this by
the following setting:
$latex = 'elatex --shell-escape %O %S';
- The two items starting with the % character are placeholders. These
- are substituted by appropriate values before the command is run. Thus
- %S will be replaced by the source file that elatex will be applied to,
- and %O will be replaced by any options that latexmk has decided to use
- for this command. (E.g., if you used the -silent option it would
+ The two items starting with the % character are placeholders. These
+ are substituted by appropriate values before the command is run. Thus
+ %S will be replaced by the source file that elatex will be applied to,
+ and %O will be replaced by any options that latexmk has decided to use
+ for this command. (E.g., if you used the -silent option it would
replace %O by "-interaction=batchmode".)
The available placeholders are:
- %B base of filename for current command. E.g., if a postscript
- file document.ps is being made from the dvi file document.dvi,
+ %B base of filename for current command. E.g., if a postscript
+ file document.ps is being made from the dvi file document.dvi,
then the basename is document.
- %D destination file (e.g., the name of the postscript file when
+ %D destination file (e.g., the name of the postscript file when
converting a dvi file to postscript).
%O options
%R root filename. This is the base name for the main tex file.
- %S source file (e.g., the name of the dvi file when converting a
+ %S source file (e.g., the name of the dvi file when converting a
dvi file to ps).
- %T The name of the primary tex file. %Y Name of directory for aux-
- iliary output files (see the configuration variable $aux_dir).
- A directory separation character ('/') is appended if $aux_dir
- is non-empty and does not end in a suitable character, with
- suitable characters being those appropriate to UNIX and MS-Win-
- dows, i.e., ':', '/' and '\'. %Z Name of directory for output
- files (see the configuration variable $out_dir). A directory
- separation character ('/') is appended if $out_dir is non-empty
- and does not end in a suitable character, with suitable charac-
- ters being those appropriate to UNIX and MS-Windows, i.e., ':',
- '/' and '\'.
-
- If for some reason you need a literal % character in your string not
- subject to the above rules, use a pair of these characters. Thus with
- the command specification $ps_previewer = 'latex -ad=%%Sfile.ad %S',
+ %T The name of the primary tex file.
+
+ %Y Name of directory for auxiliary output files (see the configura-
+ tion variable $aux_dir). A directory separation character ('/')
+ is appended if $aux_dir is non-empty and does not end in a suit-
+ able character, with suitable characters being those appropriate
+ to UNIX and MS-Windows, i.e., ':', '/' and '\'.
+
+ %Z Name of directory for output files (see the configuration vari-
+ able $out_dir). A directory separation character ('/') is
+ appended if $out_dir is non-empty and does not end in a suitable
+ character, with suitable characters being those appropriate to
+ UNIX and MS-Windows, i.e., ':', '/' and '\'.
+
+ If for some reason you need a literal % character in your string not
+ subject to the above rules, use a pair of these characters. Thus with
+ the command specification $ps_previewer = 'latex -ad=%%Sfile.ad %S',
the %%S will become %S when the command is executed, but the %S will be
- replaced by the source filename, which in this case would be the name
+ replaced by the source filename, which in this case would be the name
of a postscript file to be viewed.
- Appropriate quoting will be applied to the filename substitutions, so
- you mustn't supply them yourself even if the names of your files have
- spaces in them. (But if your TeX filenames have spaces in them, beware
- that many versions of the TeX program cannot correctly handle filenames
- containing spaces.) In case latexmk's quoting does not work correctly
- on your system, you can turn it off -- see the documentation for the
- 30 March 2012 16
+ 12 August 2012 17
@@ -1060,64 +1126,64 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ Appropriate quoting will be applied to the filename substitutions, so
+ you mustn't supply them yourself even if the names of your files have
+ spaces in them. (But if your TeX filenames have spaces in them, beware
+ that many versions of the TeX program cannot correctly handle filenames
+ containing spaces.) In case latexmk's quoting does not work correctly
+ on your system, you can turn it off -- see the documentation for the
variable $quote_filenames.
- The distinction between %B and %R needs a bit of care, since they are
- often the same, but not always. For example on a simple document, the
+ The distinction between %B and %R needs a bit of care, since they are
+ often the same, but not always. For example on a simple document, the
basename of a bibtex run is the same as for the texfile. But in a doc-
- ument with several bibliographies, the bibliography files will have a
- variety of names. Since bibtex is invoked with the basename of the
- bibliography file, the setting for the bibtex command should therefore
+ ument with several bibliographies, the bibliography files will have a
+ variety of names. Since bibtex is invoked with the basename of the
+ bibliography file, the setting for the bibtex command should therefore
be
$bibtex = 'bibtex %O %B';
- Generally, you should use %B rather than %R. Similarly for most pur-
+ Generally, you should use %B rather than %R. Similarly for most pur-
poses, the name %T of the primary texfile is not a useful placeholder.
- See the default values in the section "List of configuration variables
+ See the default values in the section "List of configuration variables
usable in initialization files" for what is normally the most appropri-
ate usage.
If you omit to supply any placeholders whatever in the specification of
- a command, latexmk will supply what its author thinks are appropriate
+ a command, latexmk will supply what its author thinks are appropriate
defaults. This gives compatibility with configuration files for previ-
ous versions of latexmk, which didn't use placeholders.
- "Detaching" a command: Normally when latexmk runs a command, it waits
+ "Detaching" a command: Normally when latexmk runs a command, it waits
for the command to run to completion. This is appropriate for commands
like latex, of course. But for previewers, the command should normally
- run detached, so that latexmk gets the previewer running and then
+ run detached, so that latexmk gets the previewer running and then
returns to its next task (or exits if there is nothing else to do). To
- achieve this effect of detaching a command, you need to precede the
+ achieve this effect of detaching a command, you need to precede the
command name with "start ", as in
$dvi_previewer = 'start xdvi %O %S';
- This will be translated to whatever is appropriate for your operating
+ This will be translated to whatever is appropriate for your operating
system.
- Notes: (1) In some circumstances, latex will always run a command
+ Notes: (1) In some circumstances, latex will always run a command
detached. This is the case for a previewer in preview continuous mode,
- since otherwise previewing continuously makes no sense. (2) This pre-
- cludes the possibility of running a command named start. (3) If the
- word start occurs more than once at the beginning of the command
- string, that is equivalent to having just one. (4) Under cygwin, some
- complications happen, since cygwin amounts to a complicated merging of
- UNIX and MS-Windows. See the source code for how I've handled the
+ since otherwise previewing continuously makes no sense. (2) This pre-
+ cludes the possibility of running a command named start. (3) If the
+ word start occurs more than once at the beginning of the command
+ string, that is equivalent to having just one. (4) Under cygwin, some
+ complications happen, since cygwin amounts to a complicated merging of
+ UNIX and MS-Windows. See the source code for how I've handled the
problem.
Command names containing spaces: Under MS-Windows it is common that the
- name of a command includes spaces, since software is often installed in
- a subdirectory of "C:\Program Files". Such command names should be
- enclosed in double quotes, as in
- $lpr_pdf = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p
- %S';
-
- 30 March 2012 17
+ 12 August 2012 18
@@ -1126,39 +1192,45 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ name of a command includes spaces, since software is often installed in
+ a subdirectory of "C:\Program Files". Such command names should be
+ enclosed in double quotes, as in
+
+ $lpr_pdf = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p
+ %S';
$pdf_previewer = 'start "c:/Program Files/SumatraPDF/Suma-
traPDF.exe" %O %S';
- $pdf_previewer = 'start "c:/Program Files/SumatraPDF (x86)/Suma-
+ $pdf_previewer = 'start "c:/Program Files/SumatraPDF (x86)/Suma-
traPDF.exe" %O %S';
- (Note about the above example: Forward slashes are equivalent to back-
- slashes in filenames under MS-Windows, provided that the filename is
- inside double quotes. It is easier to use forward slashes in examples
- like the one above, since then one does not have to worry about the
- rules for dealing with forward slashes in strings in the Perl lan-
+ (Note about the above example: Forward slashes are equivalent to back-
+ slashes in filenames under MS-Windows, provided that the filename is
+ inside double quotes. It is easier to use forward slashes in examples
+ like the one above, since then one does not have to worry about the
+ rules for dealing with forward slashes in strings in the Perl lan-
guage.)
- Command names under Cygwin: If latexmk is executed by Cygwin's perl,
+ Command names under Cygwin: If latexmk is executed by Cygwin's perl,
be particularly certain that pathnames in commands have forward slashes
- not the usual backslashes for the separator of pathname components.
- See the above examples. Backslashes often get misinterpreted by the
+ not the usual backslashes for the separator of pathname components.
+ See the above examples. Backslashes often get misinterpreted by the
Unix shell used by Cygwin's Perl to execute external commands. Forward
slashes don't suffer from this problem, and (when quoted, as above) are
equally acceptable to MS-Windows.
- Using MS-Windows file associations: A useful trick under modern ver-
+ Using MS-Windows file associations: A useful trick under modern ver-
sions of MS-Windows (e.g., WinXP) is to use just the command 'start' by
itself:
$dvi_previewer = 'start %S';
Under recent versions of MS-Windows, this will cause to be run whatever
- program the system has associated with dvi files. (The same applies
+ program the system has associated with dvi files. (The same applies
for a postscript viewer and a pdf viewer.) But note that this trick is
- not always suitable for the pdf previwer, if your system has acroread
+ not always suitable for the pdf previwer, if your system has acroread
for the default pdf viewer. As explained elsewhere, acroread under MS-
- Windows does not work well with latex and latexmk, because acroread
+ Windows does not work well with latex and latexmk, because acroread
locks the pdf file.
Not using a certain command: If a command is not to be run, the command
@@ -1166,31 +1238,30 @@ LATEXMK(1L) LATEXMK(1L)
$lpr = 'NONE lpr';
- This typically is used when an appropriate command does not exist on
+ This typically is used when an appropriate command does not exist on
your system. The string after the "NONE" is effectively a comment.
Options to commands: Setting the name of a command can be used not only
for changing the name of the command called, but also to add options to
- command. Suppose you want latexmk to use latex with source specials
- enabled. Then you might use the following line in an initialization
+ command. Suppose you want latexmk to use latex with source specials
+ enabled. Then you might use the following line in an initialization
file:
- $latex = 'latex --src-specials %O %S';
-
- Running a subroutine instead of an external command: Use a specifica-
- tion starting with "internal", as in
+ 12 August 2012 19
- 30 March 2012 18
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ $latex = 'latex --src-specials %O %S';
+ Running a subroutine instead of an external command: Use a specifica-
+ tion starting with "internal", as in
$latex = 'internal mylatex %O %S';
sub mylatex {
@@ -1199,22 +1270,22 @@ LATEXMK(1L) LATEXMK(1L)
return system 'latex', @args;
}
- Advanced tricks: Normally one specifies a single command for the com-
- mands invoked by latexmk. Naturally, if there is some complicated
+ Advanced tricks: Normally one specifies a single command for the com-
+ mands invoked by latexmk. Naturally, if there is some complicated
additional processing you need to do in your special situation, you can
write a script (or batch file) to do the processing, and then configure
latexmk to use your script in place of the standard program.
It is also possible to configure latexmk to run multiple commands. For
- example, if when running pdflatex to generate a pdf file from a tex
- file you need to run another program after pdflatex to perform some
+ example, if when running pdflatex to generate a pdf file from a tex
+ file you need to run another program after pdflatex to perform some
extra processing, you could do something like:
- $pdflatex = 'pdflatex --shell-escape %O %S; pst2pdf_for_latexmk
+ $pdflatex = 'pdflatex --shell-escape %O %S; pst2pdf_for_latexmk
%B';
- This definition assumes you are using a UNIX-like system (which
- includes Linux and OS-X), so that the two commands to be run are sepa-
+ This definition assumes you are using a UNIX-like system (which
+ includes Linux and OS-X), so that the two commands to be run are sepa-
rated by the semicolon in the middle of the string.
If you are using MS-Windows, you would replace the above line by
@@ -1222,9 +1293,9 @@ LATEXMK(1L) LATEXMK(1L)
$pdflatex = 'cmd /c pdflatex --shell-escape %O %S'
. '&& pst2pdf_for_latexmk %B';
- Here, the UNIX command separator ; is replaced by &&. In addition,
+ Here, the UNIX command separator ; is replaced by &&. In addition,
there is a problem that some versions of Perl on MS-Windows do not obey
- the command separator; this problem is overcome by explicitly invoking
+ the command separator; this problem is overcome by explicitly invoking
the MS-Windows command-line processor cmd.exe.
@@ -1233,23 +1304,18 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
$always_view_file_via_temporary [0]
Whether ps and pdf files are initially to be made in a temporary
- directory and then moved to the final location. (This applies
+ directory and then moved to the final location. (This applies
to dvips, dvipdf, and ps2pdf operations, and the filtering oper-
- ators on dvi and ps files. It does not apply to pdflatex,
+ ators on dvi and ps files. It does not apply to pdflatex,
unfortunately.)
This use of a temporary file solves a problem that the making of
- these files can occupy a substantial time. If a viewer sees
- that the file has changed, it reads the new file, and this can
- cause havoc if the program writing the file has not yet finished
- its work.
-
- See the $pvc_view_file_via_temporary variable for a setting that
- applies only if preview-continuous mode (-pvc option) is used.
+ these files can occupy a substantial time. If a viewer sees
+ that the file has changed, it reads the new file, and this can
- 30 March 2012 19
+ 12 August 2012 20
@@ -1258,31 +1324,36 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
LATEXMK(1L) LATEXMK(1L)
+ cause havoc if the program writing the file has not yet finished
+ its work.
+
+ See the $pvc_view_file_via_temporary variable for a setting that
+ applies only if preview-continuous mode (-pvc option) is used.
See $tmpdir for the setting of the directory where the temporary
file is created.
$auto_rc_use [1]
- Whether to automatically read the standard initialization (rc)
+ Whether to automatically read the standard initialization (rc)
files, which are the system RC file, the user's RC file, and the
RC file in the current directory. The command line option -norc
- can be used to turn this setting off. Each RC file could also
- turn this setting off, i.e., it could set $auto_rc_use to zero
+ can be used to turn this setting off. Each RC file could also
+ turn this setting off, i.e., it could set $auto_rc_use to zero
to prevent automatic reading of the later RC files.
- This variable does not affect the reading of RC files specified
+ This variable does not affect the reading of RC files specified
on the command line by the -r option.
$aux_dir [""]
The directory in which auxiliary files (aux, log, etc) are to be
- written by a run of (pdf)latex. If this variable is not set,
- but $out_dir is set, then $aux_dir is set to $out_dir, which is
+ written by a run of (pdf)latex. If this variable is not set,
+ but $out_dir is set, then $aux_dir is set to $out_dir, which is
the directory to which general output files are to be written.
- Important note: The effect of $aux_dir, if different from
- $out_dir, is achieved by giving (pdf)latex the -aux-directory.
- Currently (Dec. 2011) this only works on the MiKTeX version of
+ Important note: The effect of $aux_dir, if different from
+ $out_dir, is achieved by giving (pdf)latex the -aux-directory.
+ Currently (Dec. 2011) this only works on the MiKTeX version of
(pdf)latex.
See also the documentation of $out_dir for some complications on
@@ -1290,9 +1361,9 @@ LATEXMK(1L) LATEXMK(1L)
$banner [0]
- If nonzero, the banner message is printed across each page when
- converting the dvi file to postscript. Without modifying the
- variable $banner_message, this is equivalent to specifying the
+ If nonzero, the banner message is printed across each page when
+ converting the dvi file to postscript. Without modifying the
+ variable $banner_message, this is equivalent to specifying the
-d option.
Note that if $banner is nonzero, the $postscript_mode is assumed
@@ -1301,21 +1372,16 @@ LATEXMK(1L) LATEXMK(1L)
$banner_intensity [0.95]
Equivalent to the -bi option, this is a decimal number between 0
- and 1 that specifies how dark to print the banner message. 0 is
+ and 1 that specifies how dark to print the banner message. 0 is
black, 1 is white. The default is just right if your toner car-
tridge isn't running too low.
$banner_message ["DRAFT"]
The banner message to print across each page when converting the
- dvi file to postscript. This is equivalent to the -bm option.
- $banner_scale [220.0]
- A decimal number that specifies how large the banner message
- will be printed. Experimentation is necessary to get the right
-
- 30 March 2012 20
+ 12 August 2012 21
@@ -1324,17 +1390,22 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- scale for your message, as a rule of thumb the scale should be
- about equal to 1100 divided by the number of characters in the
- message. The Default is just right for 5 character messages.
+ dvi file to postscript. This is equivalent to the -bm option.
+
+ $banner_scale [220.0]
+ A decimal number that specifies how large the banner message
+ will be printed. Experimentation is necessary to get the right
+ scale for your message, as a rule of thumb the scale should be
+ about equal to 1100 divided by the number of characters in the
+ message. The Default is just right for 5 character messages.
This is equivalent to the -bs option.
@BIBINPUTS
- This is an array variable, now mostly obsolete, that specifies
- directories where latexmk should look for .bib files. By
+ This is an array variable, now mostly obsolete, that specifies
+ directories where latexmk should look for .bib files. By
default it is set from the BIBINPUTS environment variable of the
- operating system. If that environment variable is not set, a
- single element list consisting of the current directory is set.
+ operating system. If that environment variable is not set, a
+ single element list consisting of the current directory is set.
The format of the directory names depends on your operating sys-
tem, of course. Examples for setting this variable are:
@@ -1344,23 +1415,23 @@ LATEXMK(1L) LATEXMK(1L)
@BIBINPUTS = ( ".", "//server/bibfiles" );
@BIBINPUTS = ( ".", "/usr/local/texmf/bibtex/bib" );
- Note that under MS Windows, either a forward slash "/" or a
- backward slash "\" can be used to separate pathname components,
- so the first two and the second two examples are equivalent.
- Each backward slash should be doubled to avoid running afoul of
+ Note that under MS Windows, either a forward slash "/" or a
+ backward slash "\" can be used to separate pathname components,
+ so the first two and the second two examples are equivalent.
+ Each backward slash should be doubled to avoid running afoul of
Perl's rules for writing strings.
Important note: This variable is now mostly obsolete in the cur-
rent version of latexmk, since it has a better method of search-
- ing for files using the kpsewhich command. However, if your
- system is an unusual one without the kpsewhich command, you may
+ ing for files using the kpsewhich command. However, if your
+ system is an unusual one without the kpsewhich command, you may
need to set the variable @BIBINPUTS.
$biber ["biber %O %S"]
The biber processing program.
$biber_silent_switch ["--onlylog"]
- Switch(es) for the biber processing program when silent mode is
+ Switch(es) for the biber processing program when silent mode is
on.
$bibtex ["bibtex %O %S"]
@@ -1372,16 +1443,11 @@ LATEXMK(1L) LATEXMK(1L)
$bibtex_use [1]
Under what conditions to run BibTeX or biber. When latexmk dis-
- covers from the log file that one (or more) BibTeX/biber-gener-
- ated bibliographies are used, it can run BibTeX or biber when-
- ever it appears necessary to regenerate the bbl file(s) from
- their source bib database file(s).
-
- But sometimes, the bib file(s) are not available (e.g., for a
+ covers from the log file that one (or more) BibTeX/biber-
- 30 March 2012 21
+ 12 August 2012 22
@@ -1390,64 +1456,64 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- document obtained from an external archive), but the bbl files
- are provided. In that case use of BibTeX or biber will result
- in incorrect overwriting of the precious bbl files. The vari-
- able $bibtex_use controls whether this happens. Its possible
+ generated bibliographies are used, it can run BibTeX or biber
+ whenever it appears necessary to regenerate the bbl file(s) from
+ their source bib database file(s).
+
+ But sometimes, the bib file(s) are not available (e.g., for a
+ document obtained from an external archive), but the bbl files
+ are provided. In that case use of BibTeX or biber will result
+ in incorrect overwriting of the precious bbl files. The vari-
+ able $bibtex_use controls whether this happens. Its possible
values are: 0: never use BibTeX or biber. 1: only use BibTeX or
- biber if the bib files exist. 2: run BibTeX or biber whenever
- it appears necessary to update the bbl files, without testing
+ biber if the bib files exist. 2: run BibTeX or biber whenever
+ it appears necessary to update the bbl files, without testing
for the existence of the bib files.
$cleanup_includes_cusdep_generated [0]
- If nonzero, specifies that cleanup also deletes files that are
+ If nonzero, specifies that cleanup also deletes files that are
generated by custom dependencies. (When doing a clean up, e.g.,
by use of the -C option, custom dependencies are those listed in
the .fdb_latexmk file from a previous run.)
$cleanup_includes_generated [0]
- If nonzero, specifies that cleanup also deletes files that are
- detected in log file as being generated (see the \openout lines
- in the log file). It will also include files made from these
+ If nonzero, specifies that cleanup also deletes files that are
+ detected in log file as being generated (see the \openout lines
+ in the log file). It will also include files made from these
first generation generated files.
$cleanup_mode [0]
- If nonzero, specifies cleanup mode: 1 for full cleanup, 2 for
- cleanup except for dvi, ps and pdf files, 3 for cleanup except
- for dep and aux files. (There is also extra cleaning as speci-
- fied by the $clean_ext, $clean_full_ext and @generated_exts
+ If nonzero, specifies cleanup mode: 1 for full cleanup, 2 for
+ cleanup except for dvi, ps and pdf files, 3 for cleanup except
+ for dep and aux files. (There is also extra cleaning as speci-
+ fied by the $clean_ext, $clean_full_ext and @generated_exts
variables.)
- This variable is equivalent to specifying one of the -c or -C
- options. But there should be no need to set this variable from
+ This variable is equivalent to specifying one of the -c or -C
+ options. But there should be no need to set this variable from
an RC file.
$clean_ext [""]
- Extra extensions of files for latexmk to remove when any of the
- clean-up options (-c or -C) is selected. The value of this
+ Extra extensions of files for latexmk to remove when any of the
+ clean-up options (-c or -C) is selected. The value of this
variable is a string containing the extensions separated by spa-
ces.
It is also possible to specify a more general pattern of file to
- be deleted, by using the place holder %R, as in commands. Thus
+ be deleted, by using the place holder %R, as in commands. Thus
setting
$clean_ext = "out %R-blx.bib";
in an initialization file will imply that when a clean-up opera-
- tion is specified, not only is the standard set of files
- deleted, but also files of the form FOO.out and FOO-blx.bib,
- where FOO stands for the basename of the file being processed
+ tion is specified, not only is the standard set of files
+ deleted, but also files of the form FOO.out and FOO-blx.bib,
+ where FOO stands for the basename of the file being processed
(as in FOO.tex).
- $clean_full_ext [""]
- Extra extensions of files for latexmk to remove when the -C
- option is selected, i.e., extensions of files to remove when the
-
-
- 30 March 2012 22
+ 12 August 2012 23
@@ -1456,50 +1522,53 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ $clean_full_ext [""]
+ Extra extensions of files for latexmk to remove when the -C
+ option is selected, i.e., extensions of files to remove when the
.dvi, etc files are to be cleaned-up.
More general patterns are allowed, as for $clean_ext.
- $compiling_cmd [undefined], $failure_cmd [undefined], $success_cmd
+ $compiling_cmd [undefined], $failure_cmd [undefined], $success_cmd
[undefined]
- These variables specify commands that are executed at certain
- points of compilations during preview-continuous mode. One
- motivation for their existance is to allow convenient visual
+ These variables specify commands that are executed at certain
+ points of compilations during preview-continuous mode. One
+ motivation for their existance is to allow convenient visual
indications of compilation status even when the window receiving
the screen output of the compilation is hidden.
- The commands are executed at the following points: $compil-
- ing_cmd at the start of compilation, $success_cmd at the end of
- a successful compilation, and $failure_cmd at the end of an
- unsuccessful compilation. If any of above variables is unde-
- fined (the default situation) or blank, then the corresponding
+ The commands are executed at the following points: $compil-
+ ing_cmd at the start of compilation, $success_cmd at the end of
+ a successful compilation, and $failure_cmd at the end of an
+ unsuccessful compilation. If any of above variables is unde-
+ fined (the default situation) or blank, then the corresponding
command is not executed.
An example of a typical setting of these variables is as follows
- $compiling_cmd = "xdotool search --name \"%D\" set_window
+ $compiling_cmd = "xdotool search --name \"%D\" set_window
--name \"%D compiling\"";
- $success_cmd = "xdotool search --name \"%D\" set_window
+ $success_cmd = "xdotool search --name \"%D\" set_window
--name \"%D OK\"";
- $failure_cmd = "xdotool search --name \"%D\" set_window
+ $failure_cmd = "xdotool search --name \"%D\" set_window
--name \"%D FAILURE\"";
- These assume that the program xdotool is installed, that the
- previewer is using an X-Window system for display, and that the
- title of the window contains the name of the displayed file, as
- it normally does. When the commands are executed, the place-
- holder string %D is replaced by the name of the destination
+ These assume that the program xdotool is installed, that the
+ previewer is using an X-Window system for display, and that the
+ title of the window contains the name of the displayed file, as
+ it normally does. When the commands are executed, the place-
+ holder string %D is replaced by the name of the destination
file, which is the previewed file. The above commands result in
an appropriate string being appended to the filename in the win-
dow title: " compiling", " OK", or " FAILURE".
- Other placeholders that can be used are %S, %T, and %R, with %S
- and %T normally being identical. These can be useful for a com-
- mand changing the title of the edit window. The visual indica-
- tion in a window title can useful, since the user does not have
- to keep shifting attention to the (possibly hidden) compilation
+ Other placeholders that can be used are %S, %T, and %R, with %S
+ and %T normally being identical. These can be useful for a com-
+ mand changing the title of the edit window. The visual indica-
+ tion in a window title can useful, since the user does not have
+ to keep shifting attention to the (possibly hidden) compilation
window to know the status of the compilation.
@@ -1507,13 +1576,10 @@ LATEXMK(1L) LATEXMK(1L)
Custom dependency list -- see section on "Custom Dependencies".
- @default_files [("*.tex")]
- Default list of files to be processed.
-
- 30 March 2012 23
+ 12 August 2012 24
@@ -1522,15 +1588,18 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- Normally, if no filenames are specified on the command line,
- latexmk processes all tex files specified in the @default_files
- variable, which by default is set to all tex files ("*.tex") in
- the current directory. This is a convenience: just run latexmk
- and it will process an appropriate set of files. But sometimes
+ @default_files [("*.tex")]
+ Default list of files to be processed.
+
+ Normally, if no filenames are specified on the command line,
+ latexmk processes all tex files specified in the @default_files
+ variable, which by default is set to all tex files ("*.tex") in
+ the current directory. This is a convenience: just run latexmk
+ and it will process an appropriate set of files. But sometimes
you want only some of these files to be processed. In this case
- you set the @default_files in an initialization file (e.g., the
- file "latexmkrc" in the current directory). Then if no files
- are specified on the command line then the files you specify by
+ you set the @default_files in an initialization file (e.g., the
+ file "latexmkrc" in the current directory). Then if no files
+ are specified on the command line then the files you specify by
setting @default_files are processed.
Three examples:
@@ -1541,45 +1610,42 @@ LATEXMK(1L) LATEXMK(1L)
@default_files = ("*.tex", "*.dtx");
- Note that more than file may be given, and that the default
- extension is ".tex". Wild cards are allowed. The parentheses
+ Note that more than file may be given, and that the default
+ extension is ".tex". Wild cards are allowed. The parentheses
are because @default_files is an array variable, i.e., a
sequence of filename specifications is possible.
$dependents_phony [0]
- If a list of dependencies is output, this variable determines
- whether to include a phony target for each source file. If you
- use the dependents list in a Makefile, the dummy rules work
- around errors make gives if you remove header files without
+ If a list of dependencies is output, this variable determines
+ whether to include a phony target for each source file. If you
+ use the dependents list in a Makefile, the dummy rules work
+ around errors make gives if you remove header files without
updating the Makefile to match.
$dependents_list [0]
- Whether to display a list(s) of dependencies at the end of a
+ Whether to display a list(s) of dependencies at the end of a
run.
$dvi_filter [empty]
- The dvi file filter to be run on the newly produced dvi file
- before other processing. Equivalent to specifying the -dF
+ The dvi file filter to be run on the newly produced dvi file
+ before other processing. Equivalent to specifying the -dF
option.
$dvi_mode [See below for default]
- If nonzero, generate a dvi version of the document. Equivalent
+ If nonzero, generate a dvi version of the document. Equivalent
to the -dvi option.
- The variable $dvi_mode defaults to 0, but if no explicit
- requests are made for other types of file (postscript, pdf),
- then $dvi_mode will be set to 1. In addition, if a request for
- a file for which a .dvi file is a prerequisite, then $dvi_mode
+ The variable $dvi_mode defaults to 0, but if no explicit
+ requests are made for other types of file (postscript, pdf),
+ then $dvi_mode will be set to 1. In addition, if a request for
+ a file for which a .dvi file is a prerequisite, then $dvi_mode
will be set to 1.
- $dvi_previewer ["start xdvi %O %S" under UNIX]
- The command to invoke a dvi-previewer. [Default is "start"
- under MS-WINDOWS; under more recent versions of Windows, this
- will cause to be run whatever command the system has associated
- 30 March 2012 24
+
+ 12 August 2012 25
@@ -1588,169 +1654,183 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ $dvi_previewer ["start xdvi %O %S" under UNIX]
+ The command to invoke a dvi-previewer. [Default is "start"
+ under MS-WINDOWS; under more recent versions of Windows, this
+ will cause to be run whatever command the system has associated
with .dvi files.]
- Important note: Normally you will want to have a previewer run
+ Important note: Normally you will want to have a previewer run
detached, so that latexmk doesn't wait for the previewer to ter-
- minate before continuing its work. So normally you should pre-
- fix the command by "start ", which flags to latexmk that it
- should do the detaching of the previewer itself (by whatever
- method is appropriate to the operating system). But sometimes
+ minate before continuing its work. So normally you should pre-
+ fix the command by "start ", which flags to latexmk that it
+ should do the detaching of the previewer itself (by whatever
+ method is appropriate to the operating system). But sometimes
letting latexmk do the detaching is not appropriate (for a vari-
- ety of non-trivial reasons), so you should put the "start " bit
+ ety of non-trivial reasons), so you should put the "start " bit
in yourself, whenever it is needed.
$dvi_previewer_landscape ["start xdvi %O %S"]
The command to invoke a dvi-previewer in landscape mode.
[Default is "start" under MS-WINDOWS; under more recent versions
- of Windows, this will cause to be run whatever command the sys-
+ of Windows, this will cause to be run whatever command the sys-
tem has associated with .dvi files.]
$dvipdf ["dvipdf %O %S %D"]
Command to convert dvi to pdf file. A common reconfiguration is
- to use the dvipdfm command, which needs its arguments in a dif-
+ to use the dvipdfm command, which needs its arguments in a dif-
ferent order:
$dvipdf = "dvipdfm %O -o %D %S";
- WARNING: The default dvipdf script generates pdf files with
+ WARNING: The default dvipdf script generates pdf files with
bitmapped fonts, which do not look good when viewed by acroread.
- That script should be modified to give dvips the options "-P
+ That script should be modified to give dvips the options "-P
pdf" to ensure that type 1 fonts are used in the pdf file.
+ $dvipdf_silent_switch ["-q"]
+ Switch(es) for dvipdf program when silent mode is on.
+
+ N.B. The standard dvipdf program runs silently, so adding the
+ silent switch has no effect, but is actually innocuous. But if
+ an alternative program is used, e.g., dvipdfmx, then the silent
+ switch has an effect. The default setting is correct for
+ dvipdfm and dvipdfmx.
+
$dvips ["dvips %O -o %D %S"]
- The program to used as a filter to convert a .dvi file to a .ps
- file. If pdf is going to be generated from pdf, then the value
+ The program to used as a filter to convert a .dvi file to a .ps
+ file. If pdf is going to be generated from pdf, then the value
of the $dvips_pdf_switch -- see below -- will be included in the
options substituted for "%O".
$dvips_landscape ["dvips -tlandscape %O -o %D %S"]
- The program to used as a filter to convert a .dvi file to a .ps
+ The program to used as a filter to convert a .dvi file to a .ps
file in landscape mode.
- $dvips_pdf_switch ["-P pdf"]
- Switch(es) for dvips program when pdf file is to be generated
- from ps file.
- $dvips_silent_switch ["-q"]
- Switch(es) for dvips program when silent mode is on.
- $dvi_update_command [""]
- When the dvi previewer is set to be updated by running a com-
- mand, this is the command that is run. See the information for
- the variable $dvi_update_method for further information, and see
- information on the variable $pdf_update_method for an example
- for the analogous case of a pdf previewer.
+ 12 August 2012 26
- 30 March 2012 25
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ $dvips_pdf_switch ["-P pdf"]
+ Switch(es) for dvips program when pdf file is to be generated
+ from ps file.
+ $dvips_silent_switch ["-q"]
+ Switch(es) for dvips program when silent mode is on.
+
+ $dvi_update_command [""]
+ When the dvi previewer is set to be updated by running a com-
+ mand, this is the command that is run. See the information for
+ the variable $dvi_update_method for further information, and see
+ information on the variable $pdf_update_method for an example
+ for the analogous case of a pdf previewer.
$dvi_update_method [2 under UNIX, 1 under MS-Windows]
- How the dvi viewer updates its display when the dvi file has
- changed. The values here apply equally to the
+ How the dvi viewer updates its display when the dvi file has
+ changed. The values here apply equally to the
$pdf_update_method and to the $ps_update_method variables.
0 => update is automatic,
1=> manual update by user, which may only mean a mouse click
on the viewer's window or may mean a more serious action.
- 2 => Send the signal, whose number is in the variable
- $dvi_update_signal. The default value under UNIX is suitable
+ 2 => Send the signal, whose number is in the variable
+ $dvi_update_signal. The default value under UNIX is suitable
for xdvi.
- 3 => Viewer cannot do an update, because it locks the file.
+ 3 => Viewer cannot do an update, because it locks the file.
(As with acroread under MS-Windows.)
- 4 => run a command to do the update. The command is speci-
+ 4 => run a command to do the update. The command is speci-
fied by the variable $dvi_update_command.
- See information on the variable $pdf_update_method for an exam-
+ See information on the variable $pdf_update_method for an exam-
ple of updating by command.
- $dvi_update_signal [Under UNIX: SIGUSR1, which is a system-dependent
+ $dvi_update_signal [Under UNIX: SIGUSR1, which is a system-dependent
value]
- The number of the signal that is sent to the dvi viewer when it
- is updated by sending a signal -- see the information on the
- variable $dvi_update_method. The default value is the one
+ The number of the signal that is sent to the dvi viewer when it
+ is updated by sending a signal -- see the information on the
+ variable $dvi_update_method. The default value is the one
appropriate for xdvi on a UNIX system.
$failure_cmd [undefined]
See the documentation for $compiling_cmd.
$fdb_ext ["fdb_latexmk"]
- The extension of the file which latexmk generates to contain a
- database of information on source files. You will not normally
+ The extension of the file which latexmk generates to contain a
+ database of information on source files. You will not normally
need to change this.
$force_mode [0]
- If nonzero, continue processing past minor latex errors includ-
+ If nonzero, continue processing past minor latex errors includ-
ing unrecognized cross references. Equivalent to specifying the
-f option.
- @generated_exts [( aux , bbl , idx , ind , lof , lot , out , toc ,
+ @generated_exts [( aux , bbl , idx , ind , lof , lot , out , toc ,
$fdb_ext )]
- This contains a list of extensions for files that are generated
- during a LaTeX run and that are read in by LaTeX in later runs,
- either directly or indirectly.
- This list has two uses: (a) to set the kinds of file to be
- deleted in a cleanup operation (with the -c, -C, -CA, -g and -gg
- options), and (b) in the determination of whether a rerun of
- (pdf)LaTeX is needed after a run that gives an error.
- (Normally, a change of a source file during a run should provoke
- a rerun. This includes a file generated by LaTeX, e.g., an aux
- file, that is read in on subsequent runs. But after a run that
- results in an error, a new run should occur until the user has
- made a change in the files. But the user may have corrected an
+ 12 August 2012 27
- 30 March 2012 26
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ This contains a list of extensions for files that are generated
+ during a LaTeX run and that are read in by LaTeX in later runs,
+ either directly or indirectly.
+ This list has two uses: (a) to set the kinds of file to be
+ deleted in a cleanup operation (with the -c, -C, -CA, -g and -gg
+ options), and (b) in the determination of whether a rerun of
+ (pdf)LaTeX is needed after a run that gives an error.
+ (Normally, a change of a source file during a run should provoke
+ a rerun. This includes a file generated by LaTeX, e.g., an aux
+ file, that is read in on subsequent runs. But after a run that
+ results in an error, a new run should occur until the user has
+ made a change in the files. But the user may have corrected an
error in a source .tex file during the run. So latexmk needs to
distinguish user-generated and automatically generated files; it
- determines the automatically generated files as those with
+ determines the automatically generated files as those with
extensions in the list in @generated_exts.)
- A convenient way to add an extra extension to the list, without
- losing the already defined ones is to use a push command in the
+ A convenient way to add an extra extension to the list, without
+ losing the already defined ones is to use a push command in the
line in an RC file. E.g.,
push @generated_exts, "end";
- adds the extension "end" to the list of predefined generated
- extensions. (This extension is used by the RevTeX package, for
+ adds the extension "end" to the list of predefined generated
+ extensions. (This extension is used by the RevTeX package, for
example.)
$go_mode [0]
- If nonzero, process files regardless of timestamps, and is then
+ If nonzero, process files regardless of timestamps, and is then
equivalent to the -g option.
%hash_calc_ignore_pattern
!!!This variable is for experts only!!!
- The general rule latexmk uses for determining when an extra run
- of some program is needed is that one of the source files has
- changed. But consider for example a latex package that causes
- an encapsulated postscript file (an "eps" file) to be made that
- is to be read in on the next run. The file contains a comment
- line giving its creation date and time. On the next run the
- time changes, latex sees that the eps file has changed, and
- therefore reruns latex. This causes an infinite loop, that is
- only terminated becaues latexmk has a limit on the number of
+ The general rule latexmk uses for determining when an extra run
+ of some program is needed is that one of the source files has
+ changed. But consider for example a latex package that causes
+ an encapsulated postscript file (an "eps" file) to be made that
+ is to be read in on the next run. The file contains a comment
+ line giving its creation date and time. On the next run the
+ time changes, latex sees that the eps file has changed, and
+ therefore reruns latex. This causes an infinite loop, that is
+ only terminated becaues latexmk has a limit on the number of
runs to guard against pathological situations.
But the changing line has no real effect, since it is a comment.
@@ -1759,25 +1839,11 @@ LATEXMK(1L) LATEXMK(1L)
$hash_calc_ignore_pattern{'eps'} = '^%%CreationDate: ';
This creates a rule for files with extension .eps about lines to
- ignore. The left-hand side is a Perl idiom for setting an item
- in a hash. Note that the file extension is specified without a
- period. The value, on the right-hand side, is a string contain-
- ing a regular expresssion. (See documentation on Perl for how
- they are to be specified in general.) This particular regular
- expression specifies that lines beginning with "%%CreationDate:
- " are to be ignored in deciding whether a file of the given
- extension .eps has changed.
-
- There is only one regular expression available for each exten-
- sion. If you need more one pattern to specify lines to ignore,
- then you need to combine the patterns into a single regular
- expression. The simplest method is separate the different sim-
- ple patterns by a vertical bar character (indicating "alterna-
- tion" in the jargon of regular expressions). For example,
+ ignore. The left-hand side is a Perl idiom for setting an item
- 30 March 2012 27
+ 12 August 2012 28
@@ -1786,14 +1852,29 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate:
+ in a hash. Note that the file extension is specified without a
+ period. The value, on the right-hand side, is a string contain-
+ ing a regular expresssion. (See documentation on Perl for how
+ they are to be specified in general.) This particular regular
+ expression specifies that lines beginning with "%%CreationDate:
+ " are to be ignored in deciding whether a file of the given
+ extension .eps has changed.
+
+ There is only one regular expression available for each exten-
+ sion. If you need more one pattern to specify lines to ignore,
+ then you need to combine the patterns into a single regular
+ expression. The simplest method is separate the different sim-
+ ple patterns by a vertical bar character (indicating "alterna-
+ tion" in the jargon of regular expressions). For example,
+
+ $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate:
|^%%Title: ';
- causes lines starting with either "^%%CreationDate: " or
+ causes lines starting with either "^%%CreationDate: " or
"^%%Title: " to be ignored.
- It may happen that a pattern to be ignored is specified in, for
- example, in a system or user initialization file, and you wish
+ It may happen that a pattern to be ignored is specified in, for
+ example, in a system or user initialization file, and you wish
to remove this in a file read later. To do this, you use perl's
delete function, e.g.,
@@ -1801,49 +1882,34 @@ LATEXMK(1L) LATEXMK(1L)
$kpsewhich ["kpsewhich %S"]
- The program called to locate a source file when the name alone
- is not sufficient. Most filenames used by latexmk have suffi-
- cient path information to be found directly. But sometimes,
- notably when .bib files are found from the log file of a bibtex
- or biber run, the name of the file, but not its path is known.
+ The program called to locate a source file when the name alone
+ is not sufficient. Most filenames used by latexmk have suffi-
+ cient path information to be found directly. But sometimes,
+ notably when .bib files are found from the log file of a bibtex
+ or biber run, the name of the file, but not its path is known.
The program specified by $kpsewhich is used to find it.
- See also the @BIBINPUTS variable for another way that latexmk
+ See also the @BIBINPUTS variable for another way that latexmk
also uses to try to locate files; it applies only in the case of
.bib files.
$landscape_mode [0]
If nonzero, run in landscape mode, using the landscape mode pre-
- viewers and dvi to postscript converters. Equivalent to the -l
+ viewers and dvi to postscript converters. Equivalent to the -l
option. Normally not needed with current previewers.
$latex ["latex %O %S"]
The LaTeX processing program. Note that as with other programs,
- you can use this variable not just to change the name of the
+ you can use this variable not just to change the name of the
program used, but also specify options to the program. E.g.,
$latex = "latex --src-specials";
- %latex_input_extensions
- This variable specifies the extensions tried by latexmk when it
- finds that a LaTeX run resulted in an error that a file has not
- been found, and the file is given without an extension. This
- typically happens when LaTeX commands of the form \input{file}
- or \includegraphics{figure}, when the relevant source file does
- not exist.
- In this situation, latexmk searches for custom dependencies to
- make the missing file(s), but restricts it to the extensions
- specified by the variable %latex_input_extensions. The default
- extensions are 'tex' and 'eps'.
- (For Perl experts: %latex_input_extensions is a hash whose keys
- are the extensions. The values are irrelevant.) Two subrou-
- tines are provided for manipulating this and the related
-
- 30 March 2012 28
+ 12 August 2012 29
@@ -1852,8 +1918,24 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- variable %pdflatex_input_extensions, add_input_ext and
- remove_input_ext. They are used as in the following examples
+ %latex_input_extensions
+ This variable specifies the extensions tried by latexmk when it
+ finds that a LaTeX run resulted in an error that a file has not
+ been found, and the file is given without an extension. This
+ typically happens when LaTeX commands of the form \input{file}
+ or \includegraphics{figure}, when the relevant source file does
+ not exist.
+
+ In this situation, latexmk searches for custom dependencies to
+ make the missing file(s), but restricts it to the extensions
+ specified by the variable %latex_input_extensions. The default
+ extensions are 'tex' and 'eps'.
+
+ (For Perl experts: %latex_input_extensions is a hash whose keys
+ are the extensions. The values are irrelevant.) Two subrou-
+ tines are provided for manipulating this and the related vari-
+ able %pdflatex_input_extensions, add_input_ext and
+ remove_input_ext. They are used as in the following examples
are possible lines in an initialization file:
remove_input_ext( 'latex', 'tex' );
@@ -1862,20 +1944,20 @@ LATEXMK(1L) LATEXMK(1L)
add_input_ext( 'latex', 'asdf' );
- add the extension 'asdf to latex_input_extensions. (Naturally
+ add the extension 'asdf to latex_input_extensions. (Naturally
with such an extension, you should have made an appropriate cus-
tom dependency for latexmk, and should also have done the appro-
- priate programming in the LaTeX source file to enable the file
- to be read. The standard extensions are handled by LaTeX and
+ priate programming in the LaTeX source file to enable the file
+ to be read. The standard extensions are handled by LaTeX and
its graphics/graphicx packages.
$latex_silent_switch ["-interaction=batchmode"]
- Switch(es) for the LaTeX processing program when silent mode is
+ Switch(es) for the LaTeX processing program when silent mode is
on.
- If you use MikTeX, you may prefer the results if you configure
- the options to include -c-style-errors, e.g., by the following
+ If you use MikTeX, you may prefer the results if you configure
+ the options to include -c-style-errors, e.g., by the following
line in an initialization file
$latex_silent_switch = "-interaction=batchmode -c-style-
@@ -1885,46 +1967,47 @@ LATEXMK(1L) LATEXMK(1L)
$lpr ["lpr %O %S" under UNIX/LINUX, "NONE lpr" under MS-WINDOWS]
The command to print postscript files.
- Under MS-Windows (unlike UNIX/LINUX), there is no standard pro-
+ Under MS-Windows (unlike UNIX/LINUX), there is no standard pro-
gram for printing files. But there are ways you can do it. For
example, if you have gsview installed, you could use it with the
option "/p":
- $lpr = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p';
- If gsview is installed in a different directory, you will need
- to make the appropriate change. Note the combination of single
- and double quotes around the name. The single quotes specify
- that this is a string to be assigned to the configuration vari-
- able $lpr. The double quotes are part of the string passed to
- the operating system to get the command obeyed; this is neces-
- sary because one part of the command name ("Program Files") con-
- tains a space which would otherwise be misinterpreted.
- $lpr_dvi ["NONE lpr_dvi"]
- The printing program to print dvi files.
- $lpr_pdf ["NONE lpr_pdf"]
- The printing program to print pdf files.
+ 12 August 2012 30
- 30 March 2012 29
+LATEXMK(1L) LATEXMK(1L)
+ $lpr = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p';
-LATEXMK(1L) LATEXMK(1L)
+ If gsview is installed in a different directory, you will need
+ to make the appropriate change. Note the combination of single
+ and double quotes around the name. The single quotes specify
+ that this is a string to be assigned to the configuration vari-
+ able $lpr. The double quotes are part of the string passed to
+ the operating system to get the command obeyed; this is neces-
+ sary because one part of the command name ("Program Files") con-
+ tains a space which would otherwise be misinterpreted.
+ $lpr_dvi ["NONE lpr_dvi"]
+ The printing program to print dvi files.
- Under MS-Windows you could set this to use gsview, if it is
+ $lpr_pdf ["NONE lpr_pdf"]
+ The printing program to print pdf files.
+
+ Under MS-Windows you could set this to use gsview, if it is
installed, e.g.,
$lpr = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p';
- If gsview is installed in a different directory, you will need
- to make the appropriate change. Note the double quotes around
+ If gsview is installed in a different directory, you will need
+ to make the appropriate change. Note the double quotes around
the name: this is necessary because one part of the command name
("Program Files") contains a space which would otherwise be mis-
interpreted.
@@ -1937,6 +2020,10 @@ LATEXMK(1L) LATEXMK(1L)
$makeindex ["makeindex %O -o %D %S"]
The index processing program.
+ $makeindex_silent_switch ["-q"]
+ Switch(es) for the index processing program when silent mode is
+ on.
+
$max_repeat [5]
The maximum number of times latexmk will run latex/pdflatex
before deciding that there may be an infinite loop and that it
@@ -1947,6 +2034,36 @@ LATEXMK(1L) LATEXMK(1L)
(Note that the "etc" covers a lot of cases where one run of
latex/pdflatex generates files to be read in on a later run.)
+ $MSWin_back_slash [1]
+ This configuration variable only has an effect when latexmk is
+ running under MS-Windows. It determines whether, when a command
+ is executed under MS-Windows, there should be substituted "\"
+
+
+
+ 12 August 2012 31
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
+ for the separator character between components of a directory
+ name. Internally, latexmk uses "/" for the directory separator
+ character, which is the character used by Unix-like systems.
+
+ For many programs under MS-Windows, both "\" and "/" are accept-
+ able as the directory separator character. But some programs
+ only accept "\". So for safety latexmk makes a translation, by
+ default. It is conceivable that under certain situations this
+ is undesirable, so the configuration can be changed. (A possi-
+ ble example might be when some of the software is implemented
+ using Cygwin, which provides an Unix-like environment inside MS-
+ Windows.)
+
+
$new_viewer_always [0]
This variable applies to latexmk only in continuous-preview
mode. If $new_viewer_always is 0, latexmk will check for a pre-
@@ -1972,18 +2089,6 @@ LATEXMK(1L) LATEXMK(1L)
bibtex. This is because modern versions of these programs, by
default, will refuse to work when they find that they are asked
to write to a file in a directory that appears not to be the
-
-
-
- 30 March 2012 30
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
current working directory or one of its subdirectories. This is
part of security measures by the whole TeX system that try to
prevent malicious or errant TeX documents from incorrectly mess-
@@ -1998,10 +2103,22 @@ LATEXMK(1L) LATEXMK(1L)
$pdf_mode [0]
If zero, do NOT generate a pdf version of the document. If
- equal to 1, generate a pdf version of the document using pdfla-
- tex. If equal to 2, generate a pdf version of the document from
- the ps file, by using the command specified by the $ps2pdf vari-
- able. If equal to 3, generate a pdf version of the document
+ equal to 1, generate a pdf version of the document using
+
+
+
+ 12 August 2012 32
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
+ pdflatex. If equal to 2, generate a pdf version of the document
+ from the ps file, by using the command specified by the $ps2pdf
+ variable. If equal to 3, generate a pdf version of the document
from the dvi file, by using the command specified by the $dvipdf
variable.
@@ -2038,18 +2155,6 @@ LATEXMK(1L) LATEXMK(1L)
In this situation, latexmk searches for custom dependencies to
make the missing file(s), but restricts it to the extensions
specified by the variable %pdflatex_input_extensions. The
-
-
-
- 30 March 2012 31
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
default extensions are 'tex', 'pdf', 'jpg, and 'png'.
(For Perl experts: %pdflatex_input_extensions is a hash whose
@@ -2065,6 +2170,18 @@ LATEXMK(1L) LATEXMK(1L)
add_input_ext( 'pdflatex', 'asdf' );
+
+
+
+ 12 August 2012 33
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
add the extension 'asdf to pdflatex_input_extensions. (Natu-
rally with such an extension, you should have made an appropri-
ate custom dependency for latexmk, and should also have done the
@@ -2103,20 +2220,8 @@ LATEXMK(1L) LATEXMK(1L)
as the pdf previewer, and it is actually viewing a pdf file, the
pdf file cannot be updated. Thus makes acroread a bad choice of
previewer if you use latexmk's previous-continuous mode (option
- -pvc) under MS-windows. This problem does not occur if
-
-
-
- 30 March 2012 32
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
- ghostview, gv or gsview is used to view pdf files.
+ -pvc) under MS-windows. This problem does not occur if ghost-
+ view, gv or gsview is used to view pdf files.
Important note: Normally you will want to have a previewer run
detached, so that latexmk doesn't wait for the previewer to ter-
@@ -2130,9 +2235,21 @@ LATEXMK(1L) LATEXMK(1L)
$pdf_update_command [""]
- When the pdf previewer is set to be updated by running a com-
- mand, this is the command that is run. See the information for
- the variable $pdf_update_method.
+ When the pdf previewer is set to be updated by running a
+
+
+
+ 12 August 2012 34
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
+ command, this is the command that is run. See the information
+ for the variable $pdf_update_method.
$pdf_update_method [1 under UNIX, 3 under MS-Windows]
How the pdf viewer updates its display when the pdf file has
@@ -2170,18 +2287,6 @@ LATEXMK(1L) LATEXMK(1L)
$pid_position[1 under UNIX, -1 under MS-Windows]
The variable $pid_position is used to specify which word in
lines of the output from $pscmd corresponds to the process ID.
-
-
-
- 30 March 2012 33
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
The first word in the line is numbered 0. The default value of
1 (2nd word in line) is correct for Solaris 2.6 and Linux. Set-
ting the variable to -1 is used to indicate that $pscmd is not
@@ -2197,6 +2302,18 @@ LATEXMK(1L) LATEXMK(1L)
$preview_continuous_mode [0]
If nonzero, run a previewer to view the document, and continue
running latexmk to keep .dvi up-to-date. Equivalent to the -pvc
+
+
+
+ 12 August 2012 35
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
option. Which previewer is run depends on the other settings,
see the command line options -view=, and the variable $view.
@@ -2235,25 +2352,12 @@ LATEXMK(1L) LATEXMK(1L)
$ps2pdf ["ps2pdf %O %S %D"]
Command to convert ps to pdf file.
-
-
-
-
- 30 March 2012 34
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
$ps_filter [empty]
The postscript file filter to be run on the newly produced post-
script file before other processing. Equivalent to specifying
the -pF option.
- $ps_previewer ["start gv %O %S", but "start %O %S" under MS-WINDOWS]
+ $ps_previewer ["start gv %O %S", but start %O %S under MS-WINDOWS]
The command to invoke a ps-previewer. (The default under MS-
WINDOWS will cause to be run whatever command the system has
associated with .ps files.)
@@ -2264,6 +2368,18 @@ LATEXMK(1L) LATEXMK(1L)
ferent ways of writing this option. You can configure this
variable apppropriately.
+
+
+
+ 12 August 2012 36
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
WARNING: Linux systems may have installed one (or more) versions
of gv under different names, e.g., ggv, kghostview, etc, but
perhaps not one called gv.
@@ -2279,8 +2395,8 @@ LATEXMK(1L) LATEXMK(1L)
in yourself, whenever it is needed.
- $ps_previewer_landscape ["start gv -swap %O %S", but "start %O %S"
- under MS-WINDOWS]
+ $ps_previewer_landscape ["start gv -swap %O %S", but start %O %S under
+ MS-WINDOWS]
The command to invoke a ps-previewer in landscape mode.
$ps_update_command [""]
@@ -2302,18 +2418,6 @@ LATEXMK(1L) LATEXMK(1L)
value]
The number of the signal that is sent to the pdf viewer when it
is updated by sending a signal -- see $ps_update_method. The
-
-
-
- 30 March 2012 35
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
default value is the one appropriate for gv on a UNIX system.
@@ -2330,6 +2434,18 @@ LATEXMK(1L) LATEXMK(1L)
The quoting method used by latexmk is tested to work correctly
under UNIX systems (including Linux and Mac OS-X) and under MS-
+
+
+
+ 12 August 2012 37
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
Windows. It allows the use of filenames containing special
characters, notably spaces. (But note that many versions of
LaTeX and PdfLaTeX cannot correctly deal with TeX files whose
@@ -2368,18 +2484,6 @@ LATEXMK(1L) LATEXMK(1L)
communicate appropriately modified search paths to $bibtex,
dvipdf, dvips, and (pdf)latex.
-
-
-
- 30 March 2012 36
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
[Comment to technically savvy readers: (pdf)latex doesn't actu-
ally need the modified search path, because it corrects it
internally. But, surprisingly, dvipdf and dvips do, because
@@ -2397,6 +2501,17 @@ LATEXMK(1L) LATEXMK(1L)
the MSWin, Linux, OS-X, Unix collection.)
+
+
+ 12 August 2012 38
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
$sleep_time [2]
The time to sleep (in seconds) between checking for source file
changes when running with the -pvc option. This is subject to a
@@ -2434,18 +2549,6 @@ LATEXMK(1L) LATEXMK(1L)
$use_make_for_missing_files [0]
Whether to use make to try and make files that are missing after
-
-
-
- 30 March 2012 37
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
a run of latex or pdflatex, and for which a custom dependency
has not been found. This is generally useful only when latexmk
is used as part of a bigger project which is built by using the
@@ -2465,6 +2568,16 @@ LATEXMK(1L) LATEXMK(1L)
generated is to be used (among dvi, ps and pdf).
+
+ 12 August 2012 39
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
CUSTOM DEPENDENCIES
In any RC file a set of custom dependencies can be set up to convert a
file with one extension to a file with another. An example use of this
@@ -2500,18 +2613,6 @@ CUSTOM DEPENDENCIES
function:
The name of the subroutine that latexmk should call to perform
the file conversion. The first argument to the subroutine is
-
-
-
- 30 March 2012 38
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
the base name of the file to be converted without any extension.
The subroutines are declared in the syntax of Perl. The func-
tion should return 0 if it was successful and a nonzero number
@@ -2532,6 +2633,17 @@ LATEXMK(1L) LATEXMK(1L)
those without knowledge of the Perl programming language. Of course,
experts could do something much more elaborate.
+
+
+ 12 August 2012 40
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
One other item in each custom-dependency rule labelled "must" above
specifies how the rule should be applied when the source file fails to
exist.
@@ -2540,7 +2652,7 @@ LATEXMK(1L) LATEXMK(1L)
add_cus_dep( 'fig', 'eps', 0, 'fig2eps' );
sub fig2eps {
- system("fig2dev -Leps $_[0].fig $_[0].eps");
+ system( "fig2dev -Leps
}
The first line adds a custom dependency that converts a file with
@@ -2567,42 +2679,44 @@ LATEXMK(1L) LATEXMK(1L)
return value is the value returned by the last (and only) statement,
i.e., the invocation of system, which returns the value 0 on success.
+ If you use pdflatex instead of latex, then you will probably prefer to
+ convert your graphics files to pdf format, in which case you would
+ replace the above code in an initialization file by
+ add_cus_dep( 'fig', 'pdf, 0, 'fig2pdf' );
+ sub fig2pdf {
+ system( "fig2dev -Lpdf
+ }
- 30 March 2012 39
+ Note 1: In the command lines given in the system commands in the above
+ examples, double quotes have been inserted around the file names
+ (implemented by ' of the program against special characters in file-
+ names. Very often these quotes are not necessary, i.e., they can be
+ omitted. But it is normally safer to keep them in. Even though the
+ rules for quoting vary between operating systems, command shells and
+ individual pieces of software, the quotes in the above examples do not
+ cause problems in the cases I have tested.
+ Note 2: One case in which the quotes are important is when the files
+ 12 August 2012 41
-LATEXMK(1L) LATEXMK(1L)
- If you use filenames with spaces in them, and if your LaTeX system and
- all other relevant software correctly handle such filenames, then you
- could put single quotes around filenames in the command line that is
- executed:
- add_cus_dep( 'fig', 'eps', 0, 'fig2eps' );
- sub fig2eps {
- system("fig2dev -Lps '$_[0].fig' '$_[0].eps'");
- }
- This causes the invocation of the fig2dev program to have quoted file-
- names; it should therefore work with filenames containing spaces. How-
- ever, not all software deals correctly with filenames that contain spa-
- ces. Moreover, the rules, if any, for quoting filenames vary between
- operating systems, command shells and individual pieces of software, so
- this code may not always work.
+LATEXMK(1L) LATEXMK(1L)
- If you use pdflatex instead of latex, then you will probably prefer to
- convert your graphics files to pdf format, in which case you would
- replace the above code in an initialization file by
- add_cus_dep( 'fig', 'pdf, 0, 'fig2pdf' );
- sub fig2pdf {
- system("fig2dev -Lpdf $_[0].fig $_[0].pdf");
- }
+ are in a subdirectory and your operating system is Microsoft Windows.
+ Then the separator character for directory components can be either a
+ forward slash '/' or Microsoft's more usual backward slash sanity from
+ software like MiKTeX that mixes both directory separators; but their
+ correct use normally requires quoted filenames. (See a log file from a
+ run of MiKTeX (at least in v. 2.9) for an example of the use of both
+ directory separators.)
If you have some general custom dependencies defined in the system or
user initialization file, you may find that for a particular project
@@ -2632,20 +2746,8 @@ LATEXMK(1L) LATEXMK(1L)
file will cause this to happen:
add_cus_dep('ndx', 'nnd', 0, 'makendx2nnd');
-
-
-
- 30 March 2012 40
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
sub makendx2nnd {
- system("makeindex -o $_[0].nnd $_[0].ndx");
+ system( "makeindex -o
}
(You will need to modify this code if you use filenames with spaces in
@@ -2662,6 +2764,18 @@ LATEXMK(1L) LATEXMK(1L)
Of course if you choose to write random data to the .nnd (or and .aux
file, etc) that changes on each new run, then you will have a problem.
+
+
+
+ 12 August 2012 42
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
For real experts: See the %hash_cal_ignore_pattern if you have to deal
with such problems.
@@ -2683,7 +2797,7 @@ OLD METHOD OF DEFINING CUSTOM DEPENDENCIES
push @cus_dep_list, "fig eps 0 fig2eps";
sub fig2eps {
- system("fig2dev -Lps $_[0].fig $_[0].eps");
+ system( "fig2dev -Lps
}
This method still works, and is equivalent to the earlier code using
@@ -2699,17 +2813,6 @@ USING latexmk WITH make
gram for complex projects, as for software development, with the depen-
dencies specified by a Makefile.
-
-
- 30 March 2012 41
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
Now the basic task of latexmk is to run the appropriate programs to
make a viewable version of a LaTeX document. However, the usual make
program is not suited to this purpose for at least two reasons. First
@@ -2728,6 +2831,17 @@ LATEXMK(1L) LATEXMK(1L)
as created by the xfig program). Custom dependencies are latexmk's
equivalent of pattern rules in Makefiles.
+
+
+ 12 August 2012 43
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
Nevertheless there are projects for which a Makefile is appropriate,
and it is useful to know how to use latexmk from a Makefile. A typical
example would be to generate documentation for a software project.
@@ -2763,21 +2877,9 @@ LATEXMK(1L) LATEXMK(1L)
try.pdf. So when make is invoked, by default it makes try.pdf. The
only complication is that there may be many source files beyond
try.tex, but these aren't specified in the Makefile, so changes in them
- will not by themselves cause latexmk to be invoked. Instead, the
-
-
-
- 30 March 2012 42
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
- pattern rule is equipped with a "phony" prerequisite FORCE_MAKE; this
- has the effect of causing the rule to be always out-of-date, so that
+ will not by themselves cause latexmk to be invoked. Instead, the pat-
+ tern rule is equipped with a "phony" prerequisite FORCE_MAKE; this has
+ the effect of causing the rule to be always out-of-date, so that
latexmk is always run. It is latexmk that decides whether any action
is needed, e.g., a rerun of pdflatex. Effectively the Makefile dele-
gates all decisions to latexmk, while make has no knowledge of the list
@@ -2794,6 +2896,18 @@ LATEXMK(1L) LATEXMK(1L)
DEPS_DIR = .deps
LATEXMK = latexmk -recorder -use-make -deps \
-e 'warn qq(In Makefile, turn off custom dependencies0;' \
+
+
+
+ 12 August 2012 44
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
-e '@cus_dep_list = ();' \
-e 'show_cus_dep();'
all : $(TARGETS)
@@ -2830,18 +2944,6 @@ LATEXMK(1L) LATEXMK(1L)
Suppose in the LaTeX file there is a command \includegraphics{graph},
and an xfig file "graph.fig" exists. On a first run, pdflatex reports
-
-
-
- 30 March 2012 43
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
a missing file, named "graph". Latexmk succeeds in making "graph.pdf"
by calling "make graph.pdf", and after completion of its work, it lists
"fig.pdf" among the dependents of the file latexmk is making. Then let
@@ -2861,6 +2963,17 @@ BUGS
manually refresh (or reopen) display. Or use one of the other preview-
ers and update methods.
+
+
+ 12 August 2012 45
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
(The following isn't really a bug, but concerns features of preview-
ers.) Preview continuous mode only works perfectly with certain pre-
viewers: Xdvi on UNIX/LINUX works for dvi files. Gv on UNIX/LINUX
@@ -2882,7 +2995,7 @@ THANKS TO
AUTHOR
Current version, by John Collins (username collins at node
- phys.psu.edu). (Version 4.31).
+ phys.psu.edu). (Version 4.33b).
Released version can be obtained from CTAN: <http://www.tug.org/tex-ar-
chive/support/latexmk/>, and from the author's website
@@ -2899,53 +3012,6 @@ AUTHOR
- 30 March 2012 44
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -2965,6 +3031,6 @@ LATEXMK(1L) LATEXMK(1L)
- 30 March 2012 45
+ 12 August 2012 46
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl
index dfcea37feaf..0455c015067 100755
--- a/Master/texmf-dist/scripts/latexmk/latexmk.pl
+++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl
@@ -1,5 +1,8 @@
#!/usr/bin/env perl
+# N.B. !!!!!!!!!!! See 17 July 2012 comments !!!!!!!!!!!!!!!!!!
+
+
# On a UNIX-like system, the above enables latexmk to run independently
# of the location of the perl executable. This line relies on the
# existence of the program /usr/bin/env
@@ -10,7 +13,6 @@
# with the path of the perl executable adjusted for your system.
-
use warnings;
# Delete #??!! when working
@@ -109,8 +111,8 @@ use warnings;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.31';
-$version_details = "$My_name, John Collins, 30 March 2012";
+$version_num = '4.33b';
+$version_details = "$My_name, John Collins, 12 Aug. 2012";
use Config;
use File::Copy;
@@ -180,36 +182,71 @@ else {
## Modification log from 9 Dec 2011 onwards in detail
##
## 12 Jan 2012 STILL NEED TO DOCUMENT some items below
-## 29, 30 Mar 2012, John Collins Optimize file checking, and # calcs of MD5
-## 24 Jan 2012, John Collins Remove unneeded call to traceback
-## 23 Jan 2012, John Collins Remove initial ./ from ./foo entries in .fls file
-## 16 Jan 2012, John Collins Make aux and/or out directories if it/they
-## don't exist
-## 14 Jan 2012, John Collins Correct bug in parse_quotes
-## 12 Jan 2012, John Collins $success_cmd, $compiling_cmd, $failure_cmd
-## allow actions (e.g., to set window title)
-## after successful compilation, before
-## compilation, and after failure, in -pvc mode
-## Thanks to Aasmud Ervik (12 Jan 2012)
-## 2 Jan 2012, John Collins Add MikTeX-specific options to pass-through list
-## Remove redundancy of subroutines rdb_ext_cmd and rdb_ext_cmd1
-## In rdb_one_file, give &$file_act null argument list
-## 30 Dec 2011 STILL NEED TO DOCUMENT next items
-## 30 Dec 2011, John Collins Add nostart to possible keywords in commands
-## Insert start before command called from view
-## 24 Dec 2011, John Collins Add -xelatex option
-## Change OS-X defaults for viewers.
-## 21 Dec 2011, John Collins Add options reproducing options of (pdf)latex
-## 21 Dec 2011, John Collins Add -latexoption=... option
-## 20 Dec 2011, John Collins Command specification string can start
-## with "include routine" to invoke a Perl
-## subroutine instead of an external cmd.
-## 19 Dec 2011, John Collins Recorder option is now on by default.
-## 13 Dec 2011, John Collins Add -M -MP and -MF options, like gcc.
-## 9 Dec 2011, John Collins Use OS-dependent search path separator when
-## when manipulating TEXINPUTS, etc.
-## Correct treatment of current directory
-## when modifying TEXINPUTS, etc
+## 12 Aug 2012 John Collins V. 4.33b
+## Improve text displayed by -showextraoptions
+## 8 Aug 2012 John Collins V. 4.33a
+## Fix problem that with Cygwin,
+## latexmk runs very slowly, because
+## subroutine good_cwd() runs the
+## program cygpath on every
+## invocation. Solution: cach cwd.
+## 6 Aug 2012 John Collins Version number to 4.33
+## 4 Aug 2012 John Collins Further fixes of filename treatment:
+## normalize_filename routine to remove
+## string for current directory, and
+## convert '\' directory separator to '/'
+## (Note MiKTeX uses BOTH, see e.g., its
+## log file, so MSWin systems are NOT
+## guaranteed to be consistent. But latexmk
+## needs to treat filenames differing by
+## change of directory separator as equivalent.
+## Warning: SOME MWWin programs, e.g., current
+## cmd.exe (as tested yesterday on PSU computer
+## in library) do not accept '/' as directory
+## separator, so it may be worth allowing conversion
+## to '\' in executed files.)
+## Also improve running when $silent is on:
+## don't print warnings about undefined references
+## and citations, but simply display a summary, whose
+## criterion for being shown had to be fixed.
+## 3 Aug 2012 John Collins Fix finding of files in aux-dir
+## 1 Aug 2012 John Collins Handle aliasing of cwd in output file
+## to avoid unnecessary warnings about
+## actual o/p file .ne. expected with MiKTeX
+## Clean up subroutine names:
+## parse_logB to parse_log
+## make_preview_continuousB to make_preview_continuous
+## rdb_find_new_filesB to rdb_find_new_files
+## rdb_set_dependentsA to rdb_set_dependents
+## rdb_makeB to rdb_make
+## rdb_makeB1 to rdb_make1
+## rdb_one_depA to rdb_one_dep
+## rdb_recurseA to rdb_recurse
+## rdb_update_filesA to rdb_update_files
+## 28, 29, 30 Jul 2012 John Collins Try better file-name normalization in reading fls file.
+## 18 Jul 2012 John Collins Change ver. to 4.32d.
+## Merge changes from 29 June 2012:
+## Add $dvipdf_silent_switch
+## 17 Jul 2012 John Collins Try better fix for error/rerun and retest issue.
+## Now rdb_primary_run doesn't have so many complications
+## rdb_makeB's PASS loop is simpler
+## rdb_submakeB is unneeded.
+## See the lines starting #??
+## See comments nearby
+## Compare w/ v. 4.32a
+## V. 4.32b
+## 17 Jul 2012 John Collins Fix problem that after finding error in a run
+## of (pdf)latex, latexmk didn't check for
+## changed files before giving up.
+## To do that, I reverted some changes in
+## rdb_primary_run to pre v. 4.31
+## Remove unused code
+## v. 4.32a
+## 8 May 2012 John Collins Possibility to substitute backslashes for
+## forward slashes in file and directory
+## names in executed command line,
+## for MSWin
+## 5 May 2012 John Collins Comment on ctrl/C handling in WAIT loop
##
## 1998-2010, John Collins. Many improvements and fixes.
## See CHANGE-log.txt for full list, and CHANGES for summary
@@ -542,6 +579,12 @@ $makeindex_silent_switch = '-q';
## Command to convert dvi file to pdf file directly:
$dvipdf = 'dvipdf %O %S %D';
+# N.B. Standard dvipdf runs dvips and gs with their silent switch, so for
+# standard dvipdf $dvipdf_silent_switch is unneeded, but innocuous.
+# But dvipdfmx can be used instead, and it has a silent switch (-q).
+# So implementing $dvipdf_silent_switch is useful.
+
+$dvipdf_silent_switch = '-q';
## Command to convert dvi file to ps file:
$dvips = 'dvips %O -o %D %S';
@@ -576,6 +619,10 @@ $print_type = 'ps'; # When printing, print the postscript file.
## Current tex's treat extensions like UNIX teTeX:
$extension_treatment = 'unix';
+## Substitute backslashes in file and directory names for
+## MSWin command line
+$MSWin_back_slash = 1;
+
$dvi_update_signal = undef;
$ps_update_signal = undef;
$pdf_update_signal = undef;
@@ -1046,8 +1093,11 @@ $dependents_list = 0; # Whether to display list(s) of dependencies
$dependents_phony = 0; # Whether list(s) of dependencies includes phony targets
# (as with 'gcc -MP').
$deps_file = '-'; # File for dependency list output. Default stdout.
-$rules_list = 0; # Whether to display list(s) of dependencies
-@dir_stack = (); # Stack of pushed directories.
+$rules_list = 0; # Whether to display list(s) of dependencies
+@dir_stack = (); # Stack of pushed directories, each of form of
+ # pointer to array [ cwd, good_cwd ], where
+ # good_cwd differs from cwd by being converted
+ # to native MSWin path when cygwin is used.
$cleanup_mode = 0; # No cleanup of nonessential LaTex-related files.
# $cleanup_mode = 0: no cleanup
# $cleanup_mode = 1: full cleanup
@@ -1097,6 +1147,10 @@ $reference_changed = 0;
$bad_reference = 0;
$bad_citation = 0;
+# Cache of expensive-to-compute state variables, e.g., cwd in form
+# fixed to deal with cygwin issues.
+%cache = ();
+&cache_good_cwd;
# Set search paths for includes.
# Set them early so that they can be overridden
@@ -1229,7 +1283,7 @@ if (!$BIBINPUTS) { $BIBINPUTS = '.'; }
%primaries = (); # Hash of rules for primary part of make. Keys are
# currently 'latex', 'pdflatex' or both. Value is
# currently irrelevant. Use hash for ease of lookup
- # Make remove this later, if use makeB
+ # Make remove this later, if use rdb_makeB
# Hashes, whose keys give names of particular kinds of rule. We use
# hashes for ease of lookup.
@@ -1530,10 +1584,17 @@ while ($_ = $ARGV[0])
elsif (/^-rules$/ ) { $rules_list = 1; }
elsif (/^-norules$/ || /^-rules-$/ ) { $rules_list = 0; }
elsif (/^-showextraoptions$/) {
- print "List of extra latex and pdflatex options recognized by $my_name:\n",
+ print "List of extra latex and pdflatex options recognized by $my_name.\n",
"These are passed as is to (pdf)latex. They may not be recognized by\n",
"particular versions of (pdf)latex. This list is a combination of those\n",
- "for TeXLive and MikTeX.\n\n";
+ "for TeXLive and MikTeX.\n",
+ "\n",
+ "Note that in addition to the options in this list, there are several\n",
+ "options known to the (pdf)latex programs that are also recognized by\n",
+ "latexmk and trigger special behavior by latexmk. Since these options\n",
+ "appear in the main list given by running 'latexmk --help', they do not\n",
+ "appear in the following list\n",
+ "\n";
foreach $option ( sort( keys %allowed_latex_options, keys %allowed_latex_options_with_arg ) ) {
if (exists $allowed_latex_options{$option} ) { print " $allowed_latex_options{$option}\n"; }
if (exists $allowed_latex_options_with_arg{$option} ) { print " $allowed_latex_options_with_arg{$option}\n"; }
@@ -1642,6 +1703,11 @@ if ( ($out_dir ne '') && ($aux_dir eq '') ){
$aux_dir = $out_dir;
}
+foreach ($out_dir, $aux_dir) {
+ # Remove aliases to cwd:
+ $_ = normalize_filename( $_ );
+ if ($_ eq '.' ) { $_ = ''; }
+}
# Versions terminating in directory/path separator
$out_dir1 = $out_dir;
$aux_dir1 = $aux_dir;
@@ -1794,6 +1860,7 @@ if ( $silent ) {
add_option( "$biber_silent_switch", \$biber );
add_option( "$bibtex_silent_switch", \$bibtex );
add_option( "$makeindex_silent_switch", \$makeindex );
+ add_option( "$dvipdf_silent_switch", \$dvipdf );
add_option( "$dvips_silent_switch", \$dvips );
}
@@ -2031,10 +2098,10 @@ foreach $filename ( @file_list )
);
}
else {
- # No fdb file, so do inferior job by parse_logB
+ # No fdb file, so do inferior job by parse_log
print "$My_name: Examining log file '$log_name' for generated files...\n";
- # Variables set by parse_logB. Can I remove them
+ # Variables set by parse_log. Can I remove them
local %generated_log = ();
local %dependents = (); # Maps files to status. Not used here.
local @bbl_files = (); # Not used here.
@@ -2043,7 +2110,7 @@ foreach $filename ( @file_list )
# Maps output file created and read by (pdf)latex
# to source file of conversion.
local $primary_out = ''; # Actual output file (dvi or pdf). Not used here.
- &parse_logB;
+ &parse_log;
%other_generated = %generated_log;
}
@@ -2097,7 +2164,7 @@ foreach $filename ( @file_list )
if ($cleanup_only) { next FILE; }
-#??? The following are not needed if use makeB.
+#??? The following are not needed if use rdb_make.
# ?? They may be set too early?
# Arrays and hashes for picking out accessible rules.
# Distinguish rules for making files and others
@@ -2140,7 +2207,7 @@ foreach $filename ( @file_list )
# previous run. So use filetime criterion for make
# instead of change from previous run, until we have
# done our own make.
- rdb_recurseA( [keys %possible_primaries],
+ rdb_recurse( [keys %possible_primaries],
sub{ if ( $$Ptest_kind == 1 ) { $$Ptest_kind = 3;} }
);
if ( -e $log_name ) {
@@ -2158,7 +2225,7 @@ foreach $filename ( @file_list )
if ($go_mode) {
# Force everything to be remade.
- rdb_recurseA( [keys %requested_filerules], sub{$$Pout_of_date=1;} );
+ rdb_recurse( [keys %requested_filerules], sub{$$Pout_of_date=1;} );
}
@@ -2170,7 +2237,7 @@ foreach $filename ( @file_list )
#************************************************************
if ( $preview_continuous_mode ) {
- &make_preview_continuousB;
+ &make_preview_continuous;
# Will probably exit by ctrl/C and never arrive here.
next FILE;
}
@@ -2191,7 +2258,7 @@ foreach $filename ( @file_list )
#Initialize failure flags now.
$failure = 0;
$failure_msg = '';
- $failure = rdb_makeB( keys %requested_filerules );
+ $failure = rdb_make( keys %requested_filerules );
if ($failure > 0) { next FILE; }
rdb_for_some( [keys %one_time], \&rdb_run1 );
} # end FILE
@@ -2718,7 +2785,7 @@ sub find_basename
#************************************************************
-sub make_preview_continuousB {
+sub make_preview_continuous {
local @changed = ();
local @disappeared = ();
local @no_dest = (); # Non-existent destination files
@@ -2726,7 +2793,6 @@ sub make_preview_continuousB {
local @rules_to_apply = ();
local $failure = 0;
- local $runs = 0;
local %rules_applied = ();
local $updated = 0;
@@ -2796,7 +2862,7 @@ CHANGE:
if ($compiling_cmd) {
Run_subst( $compiling_cmd );
}
- $failure = rdb_makeB( @targets );
+ $failure = rdb_make( @targets );
## warn "=========Viewer PID = $$Pviewer_process; updated=$updated\n";
@@ -2878,6 +2944,10 @@ CHANGE:
print "\n=== Watching for updated files. Use ctrl/C to stop ...\n";
}
$waiting = 1; if ($diagnostics) { warn "WAITING\n"; }
+# During waiting for file changes, handle ctrl/C and ctrl/break here, rather than letting
+# system handle them by terminating script (and any script that calls it). This allows,
+# for example, the clean up code in the following command line to work:
+# latexmk -pvc foo; cleanup;
&catch_break;
$have_break = 0;
WAIT: while (1) {
@@ -2894,7 +2964,7 @@ CHANGE:
$processing_time1 = processing_time();
# Does this do this job????
local $new_files = 0;
- rdb_for_some( [keys %current_primaries], sub{ $new_files += &rdb_find_new_filesB } );
+ rdb_for_some( [keys %current_primaries], sub{ $new_files += &rdb_find_new_files } );
if ($new_files > 0) {
warn "$My_name: New file(s) found.\n";
last WAIT;
@@ -2908,7 +2978,7 @@ CHANGE:
}
$waiting = 0; if ($diagnostics) { warn "NOT WAITING\n"; }
} #end infinite_loop CHANGE:
-} #END sub make_preview_continuousB
+} #END sub make_preview_continuous
#************************************************************
@@ -3488,40 +3558,25 @@ sub check_bibtex_log {
#**************************************************
-sub force_directory {
- # Usage, force_directory( dir, filename )
- # If filename contains no path component, return concatenation
- # of dir and filename,
- # else return filename
+sub normalize_force_directory {
+ # Usage, normalize_force_directory( dir, filename )
+ # Perform the following operations:
+ # Clean filename
+ # If filename contains no path component, insert dir in front
+ # Normalize filename
+ # Return result
my $default_dir = $_[0];
- my $filename = $_[1];
+ my $filename = clean_filename( $_[1] );
my ($base_name, $path ) = fileparse( $filename );
- if ( $path ne '' ) { $filename = "$default_dir$filename"; }
- return $filename;
-}
-
-# ------------------------------
-
-sub clean_file_name {
- # Convert quoted filename as found in log file to filename without quotes
- # Allows arbitrarily embedded double-quoted substrings, includes the
- # cases
- # 1. `"string".ext', which arises e.g., from \jobname.bbl:
- # when the base filename contains spaces, \jobname has quotes.
- # and from \includegraphics with basename specified.
- # Also deals with filenames written by asymptote.sty
- # 2. Or "string.ext" from \includegraphcs with basename and ext specified.
- # and from MiKTeX logfile for input files with spaces.
- # Doubled quotes (e.g., A""B) don't get converted.
- # Neither do unmatched quotes.
- my $filename = $_[0];
- while ( $filename =~ s/^([^\"]*)\"([^\"]+)\"(.*)$/$1$2$3/ ) {}
- return $filename;
-}
+ if ( $base_name eq $filename ) {
+ $filename = "$default_dir$filename";
+ }
+ return normalize_filename( $filename );
+} #END normalize force_directory
# ------------------------------
-sub parse_logB {
+sub parse_log {
# Scan log file for: dependent files
# reference_changed, bad_reference, bad_citation
# Return value: 1 if success, 0 if no log file.
@@ -3660,8 +3715,9 @@ LINE:
# First line OK
next LINE;
} else {
- warn "$My_name: Error on first line of '$log_name'. ".
- "This is apparently not a TeX log file.\n";
+ warn "$My_name: Error on first line of '$log_name'.\n".
+ "This is apparently not a TeX log file. ",
+ "The first line is:\n$_\n";
$failure = 1;
$failure_msg = "Log file '$log_name' appears to have wrong format.";
return 0;
@@ -3674,7 +3730,7 @@ LINE:
if ( ($block_type eq 'conversion')
&& /^\($current_pkg\)\s+Output file: <([^>]+)>/ )
{
- $delegated_output = $1;
+ $delegated_output = normalize_clean_filename($1);
}
next LINE;
}
@@ -3688,20 +3744,20 @@ LINE:
}
# Check for changed references, bad references and bad citations:
if (/Rerun to get/) {
- warn "$My_name: References changed.\n";
+ warn "$My_name: References changed.\n" if ! $silent;
$reference_changed = 1;
}
if (/LaTeX Warning: (Reference[^\001]*undefined)./) {
- warn "$My_name: $1 \n";
- $bad_reference = 1;
+ warn "$My_name: $1 \n" unless $silent;
+ $bad_reference++;
}
if (/LaTeX Warning: (Citation[^\001]*undefined)./) {
- warn "$My_name: $1 \n";
- $bad_citation = 1;
+ warn "$My_name: $1 \n" unless $silent;
+ $bad_citation++;
}
if (/Package natbib Warning: (Citation[^\001]*undefined)./) {
- warn "$My_name: $1 \n";
- $bad_citation = 1;
+ warn "$My_name: $1 \n" unless $silent;
+ $bad_citation++;
}
if ( /^Document Class: / ) {
# Class sign-on line
@@ -3717,7 +3773,7 @@ LINE:
next LINE;
}
if ( /^Output written on\s+(.*)\s+\(\d+\s+page/ ) {
- $primary_out = clean_file_name($1);
+ $primary_out = normalize_clean_filename($1);
warn "$My_name: Log file says output to '$primary_out'\n"
unless $silent;
next LINE;
@@ -3734,15 +3790,15 @@ LINE:
# When (pdf)latex is run with an -output-directory
# or an -aux_directory, the file name does not contain
# the output path; fix this, after removing quotes:
- $generated_log{ force_directory( $aux_dir1, clean_file_name($1) )} = 1;
+ $generated_log{normalize_force_directory( $aux_dir1, $1 )} = 1;
next LINE;
}
# Test for conversion produced by package:
if ( /^Package (\S+) Info: Source file: <([^>]+)>/ ) {
# Info. produced by epstopdf (and possibly others)
# about file conversion
- $current_pkg = clean_file_name($1);
- $delegated_source = clean_file_name($2);
+ $current_pkg = normalize_clean_filename($1);
+ $delegated_source = normalize_clean_filename($2);
$block_type = 'conversion';
next LINE;
}
@@ -3774,7 +3830,7 @@ LINE:
# When (pdf)latex is run with an -output-directory
# or an -aux_directory, the file name does not contain
# the output path; fix this, after removing quotes:
- $idx_file = force_directory( $aux_dir1, clean_file_name($idx_file) );
+ $idx_file = normalize_force_directory( $aux_dir1, $idx_file );
my ($idx_base, $idx_path, $idx_ext) = fileparseA( $idx_file );
$idx_base = $idx_path.$idx_base;
$idx_file = $idx_base.$idx_ext;
@@ -3801,7 +3857,7 @@ LINE:
# When (pdf)latex is run with an -output-directory
# or an -aux_directory, the file name does not contain
# the output path; fix this, after removing quotes:
- my $bbl_file = force_directory( $aux_dir1, clean_file_name($1) );
+ my $bbl_file = normalize_force_directory( $aux_dir1, $1 );
warn "$My_name: Non-existent bbl file '$bbl_file'\n $_\n";
$dependents{$bbl_file} = 0;
push @bbl_files, $bbl_file;
@@ -3809,27 +3865,28 @@ LINE:
}
foreach my $pattern (@file_not_found) {
if ( /$pattern/ ) {
- my $file = clean_file_name($1);
- my ($base, $path) = fileparse( $file );
+ my $file = clean_filename($1);
warn "$My_name: Missing input file: '$file' from line\n '$_'\n"
unless $silent;
- $dependents{$file} = 0;
- if ( $aux_dir && ( ($path eq './') || ($path eq '') ) ) {
- # This allows for the possibility that latex generated
+ $dependents{normalize_filename($file)} = 0;
+ my $file1 = $file;
+ if ( $aux_dir ) {
+ # Allow for the possibility that latex generated
# a file in $aux_dir, from which the missing file can
# be created by a cusdep (or other) rule that puts
# the result in $out_dir. If the announced missing file
# has no path, then it would be effectively a missing
# file in $aux_dir, with a path. So give this alternate
# location.
- $dependents{$aux_dir1.$file} = 0;
+ my $file1 = normalize_force_directory( $aux_dir1, $file );
+ $dependents{$file1} = 0;
}
next LINE;
}
}
if ( /^File: (.+) Graphic file \(type / ) {
# First line of message from includegraphics/x
- $dependents{clean_file_name($1)} = 1;
+ $dependents{normalize_clean_filename($1)} = 1;
next LINE;
}
# Now test for generic lines to ignore, only after special cases!
@@ -3958,6 +4015,7 @@ LINE:
}
INCLUDE_NAME:
foreach my $include_name (@new_includes) {
+ $include_name = normalize_filename( $include_name );
my ($base, $path, $ext) = fileparseB( $include_name );
if ( ($path eq './') || ($path eq '.\\') ) {
$include_name = $base.$ext;
@@ -4145,7 +4203,7 @@ CANDIDATE_PAIR:
}
}
return 1;
-} #END parse_logB
+} #END parse_log
#************************************************************
@@ -4153,21 +4211,28 @@ sub parse_fls {
my ($fls_name, $Pinputs, $Poutputs ) = @_;
%$Pinputs = %$Poutputs = ();
my $fls_file = new FileHandle;
+ # Make a note of current working directory
+ # I'll update it from the fls file later
+ # Currently I don't use this, but it would be useful to use
+ # this when testing prefix for cwd in a filename, by
+ # giving (pdf)latex's best view of the cwd. Note that the
+ # value given by the cwd() function may be mangled, e.g., by cygwin
+ # compared with native MSWin32.
+ my $cwd = good_cwd();
if ( ! open ($fls_file, "<$fls_name") ) {
return 1;
}
foreach $_ ( <$fls_file> ) {
- if (/^\s*INPUT\s+(.*)\s+$/) {
- my $file = $1;
- # Take precautions against aliasing of ./foo and foo:
- $file =~ s(^\./)();
- $$Pinputs{$file} = 1;
+ if (/^\s*PWD\s+(.*)\s+$/) {
+ $cwd = $1;
+ }
+ elsif (/^\s*INPUT\s+(.*)\s+$/) {
+ # Take precautions against aliasing of foo, ./foo and other possibilities for cwd.
+ $$Pinputs{ normalize_filename( $1 )} = 1;
}
elsif (/^\s*OUTPUT\s+(.*)\s+$/) {
- my $file = $1;
- # Take precautions against aliasing of ./foo and foo:
- $file =~ s(^\./)();
- $$Poutputs{$file} = 1;
+ # Take precautions against aliasing of foo, ./foo and other possibilities for cwd.
+ $$Poutputs{ normalize_filename( $1 )} = 1;
}
}
close( $fls_file );
@@ -4176,6 +4241,68 @@ sub parse_fls {
#************************************************************
+sub clean_filename {
+ # Convert quoted filename as found in log file to filename without quotes
+ # Allows arbitrarily embedded double-quoted substrings, includes the
+ # cases
+ # 1. `"string".ext', which arises e.g., from \jobname.bbl:
+ # when the base filename contains spaces, \jobname has quotes.
+ # and from \includegraphics with basename specified.
+ # Also deals with filenames written by asymptote.sty
+ # 2. Or "string.ext" from \includegraphcs with basename and ext specified.
+ # and from MiKTeX logfile for input files with spaces.
+ # Doubled quotes (e.g., A""B) don't get converted.
+ # Neither do unmatched quotes.
+ my $filename = $_[0];
+ while ( $filename =~ s/^([^\"]*)\"([^\"]+)\"(.*)$/$1$2$3/ ) {}
+ return $filename;
+}
+
+# ------------------------------
+
+sub normalize_filename {
+ # Remove various forms for cwd at start of filename.
+ # Convert to have directory separator = '/' only
+ my $file = $_[0];
+ my $file1 = $file; # Saved original value
+ my $cwd = good_cwd();
+ # Normalize files to use / to separate directory components:
+ # (Note both / and \ are allowed under MSWin.)
+ $cwd =~ s(\\)(/)g;
+ $file =~ s(\\)(/)g;
+
+ # Remove current directory string:
+ $file =~ s(^\./)();
+ $file =~ s(^$cwd/)();
+
+ return $file;
+}
+
+# ------------------------------
+
+sub normalize_clean_filename {
+ # Remove quotes around filename --- see clean_filename --- as from log file.
+ # Then remove any string for cwd, and convert to use '/' for directory separator,
+ # (and any other standardization) done by normalize_filename.
+ return normalize_filename( clean_filename( $_[0] ));
+}
+
+#************************************************************
+
+sub OS_preferred_filename {
+ # Usage: OS_preferred_filename(name)
+ # Returns filename with directory separator '/' converted
+ # to preferred conventions for current OS.
+ # Currently implemented: only '\' for MSWin32
+ my $file = $_[0];
+ if ( $^O eq 'MSWin32' ) {
+ $file =~ s(/)(\\)g;
+ }
+ return $file;
+}
+
+#************************************************************
+
sub parse_aux {
#Usage: parse_aux( $aux_file, \@new_bib_files, \@new_aux_files, \@new_bst_files )
# Parse aux_file (recursively) for bib files, and bst files.
@@ -4570,7 +4697,7 @@ LINE:
}
undef $in_handle;
# Set cus dependencies.
- &rdb_set_dependentsA( keys %rule_db );
+ &rdb_set_dependents( keys %rule_db );
#?? Check from_rules exist.
@@ -4673,7 +4800,7 @@ sub rdb_set_latex_deps {
# The following are also returned, but are global, to be used by caller
# $reference_changed, $bad_reference $bad_citation
- &parse_logB;
+ &parse_log;
my $fls_file = "$aux_dir1$root_filename.fls";
if ($recorder && test_gen_file($fls_file) ) {
parse_fls( $fls_file, \%source_fls, \%generated_fls );
@@ -4681,6 +4808,7 @@ sub rdb_set_latex_deps {
$dependents{$_} = 4;
}
foreach (keys %generated_fls) {
+ $_ = normalize_filename($_);
rdb_add_generated( $_ );
if ( exists($dependents{$_}) ) {
$dependents{$_} = 6;
@@ -4696,7 +4824,7 @@ sub rdb_set_latex_deps {
# missing input file might be correctable by a run of some
# other program whose running is provoked AFTER a run of
# (pdf)latex, we'll set a diagnostic and leave it to the
- # rdb_makeB to handle after all circular dependencies are
+ # rdb_make to handle after all circular dependencies are
# resolved.
# 2. The output file might be of a different kind than expected
# (i.e., dvi instead of pdf, or vv). This could
@@ -4722,7 +4850,7 @@ sub rdb_set_latex_deps {
rdb_create_rule( $from_rule, 'external', $makeindex, '', 1,
$idx_file, $ind_file, $ind_base, 1, 0, 0 );
print " ===Source file '$ind_file' for '$rule'\n"
- if ($diagnostics > -1);
+ if ($diagnostics);
rdb_ensure_file( $rule, $ind_file, $from_rule );
}
# Make sure the .ind file is treated as a detected source file;
@@ -4842,7 +4970,7 @@ NEW_SOURCE:
}
}
- my @more_sources = &rdb_set_dependentsA( $rule );
+ my @more_sources = &rdb_set_dependents( $rule );
my $num_new = $#more_sources + 1;
foreach (@more_sources) {
$dependents{$_} = 4;
@@ -4894,8 +5022,8 @@ sub test_gen_file {
#************************************************************
-sub rdb_find_new_filesB {
- # Call: rdb_find_new_filesB
+sub rdb_find_new_files {
+ # Call: rdb_find_new_files
# Assumes rule context for primary rule.
# Deal with files which were missing and for which a method
# of finding them has become available:
@@ -4987,30 +5115,30 @@ MISSING_FILE:
}
}
return $found;
-} # END rdb_find_new_filesB
+} # END rdb_find_new_files
#************************************************************
-sub rdb_set_dependentsA {
- # Call rdb_set_dependentsA( rules ...)
+sub rdb_set_dependents {
+ # Call rdb_set_dependents( rules ...)
# Returns array (sorted), of new source files.
local @new_sources = ();
local @deletions = ();
# Shouldn't recurse. The definite rules to be examined are given.
- rdb_for_some( [@_], 0, \&rdb_one_depA );
-# OLD rdb_recurseA( [@_], 0, \&rdb_one_depA );
+ rdb_for_some( [@_], 0, \&rdb_one_dep );
+# OLD rdb_recurse( [@_], 0, \&rdb_one_dep );
foreach (@deletions) {
my ($rule, $file) = @$_;
rdb_remove_files( $rule, $file );
}
&rdb_make_links;
return uniqs( @new_sources );
-} #END rdb_set_dependentsA
+} #END rdb_set_dependents
#************************************************************
-sub rdb_one_depA {
+sub rdb_one_dep {
# Helper for finding dependencies. One case, $rule and $file given
# Assume file (and rule) context for DESTINATION file.
@@ -5019,7 +5147,7 @@ sub rdb_one_depA {
if ( (! exists $possible_primaries{$rule}) && ($rule !~ /^cusdep/) ) {
return;
}
-#print "=============ONE_DEPA: '$rule' '$file'\n";
+#print "=============ONE_DEP: '$rule' '$file'\n";
local $new_dest = $file;
my ($base_name, $path, $toext) = fileparseA( $new_dest );
$base_name = $path.$base_name;
@@ -5141,7 +5269,7 @@ DEP:
}
}
}
-} #END rdb_one_depA
+} #END rdb_one_dep
#************************************************************
@@ -5247,7 +5375,7 @@ sub rdb_accessible {
# Call: rdb_accessible( rule, ...)
# Returns array of rules accessible from the given rules
local @accessible = ();
- rdb_recurseA( [@_], sub{ push @accessible, $rule; } );
+ rdb_recurse( [@_], sub{ push @accessible, $rule; } );
return @accessible;
} #END rdb_accessible
@@ -5255,8 +5383,8 @@ sub rdb_accessible {
#************************************************************
#************************************************************
-sub rdb_makeB {
- # Call: rdb_makeB( target, ... )
+sub rdb_make {
+ # Call: rdb_make( target, ... )
# Makes the targets and prerequisites.
# Leaves one-time rules to last.
# Does appropriate repeated makes to resolve dependency loops
@@ -5416,7 +5544,7 @@ sub rdb_makeB {
local $failure = 0; # General accumulated error flag
local $missing_dvi_pdf = ''; # Did primary run fail to make its output file?
local $runs = 0;
- local $too_many_runs = 0;
+ local $too_many_passes = 0;
local %rules_applied = ();
my $retry_msg = 0; # Did I earlier say I was going to attempt
# another pass after a failure?
@@ -5437,25 +5565,14 @@ sub rdb_makeB {
if ($diagnostics) {
print "MakeB: doing pre_primary and primary...\n";
}
- rdb_for_some( [@pre_primary, $primary], \&rdb_makeB1 );
- if ( ($runs > 0) && ! $too_many_runs ) {
- $retry_msg = 0;
- if ( $failure && $newrule_nofile ) {
- $retry_msg = 1;
- print "$My_name: Error on run, but found possibility to ",
- "make new source files\n";
- next PASS;
- }
- elsif ( $force_mode || (! $failure) ) {
- next PASS;
- }
+ rdb_for_some( [@pre_primary, $primary], \&rdb_make1 );
+ if ( ($runs > 0) && ! $too_many_passes ) {
+ next PASS;
}
- elsif ($runs == 0) {
+ if ($runs == 0) {
# $failure not set on this pass, so use value from previous pass:
$failure = $previous_failure;
- if ($retry_msg) {
- print "But in fact no new files made\n";
- }
+ if ($failure && !$force_mode ) { last PASS; }
}
if ( $missing_dvi_pdf ) {
# No output from primary, after completing circular dependence
@@ -5463,19 +5580,13 @@ sub rdb_makeB {
$failure = 1;
last PASS;
}
- if ($failure && !$force_mode ) { last PASS; }
if ($diagnostics) {
print "MakeB: doing post_primary...\n";
}
- rdb_for_some( [@post_primary], \&rdb_makeB1 );
- if ($failure) { last PASS; }
- if ($runs > 0) {
- # If something was run, repeat the loop to test for any changes
- # that entail further processing.
- next PASS;
- }
- # Get here if nothing was run.
- last PASS;
+ rdb_for_some( [@post_primary], \&rdb_make1 );
+ if ($runs == 0) {
+ last PASS;
+ }
}
continue {
# Re-evaluate rule classification and accessibility,
@@ -5487,18 +5598,11 @@ sub rdb_makeB {
&rdb_make_links;
}
}
- rdb_for_some( [@one_time], \&rdb_makeB1 );
+ rdb_for_some( [@one_time], \&rdb_make1 );
rdb_write( $fdb_name );
- if (! $silent) {
- # Diagnose of the runs
- if ( $#{keys %rules_applied } > -1 ) {
- print "$My_name: $runs runs. Rules applied:\n";
- foreach (sort keys %rules_applied) {
- print " '$_'\n";
- }
- }
- elsif ($failure && $force_mode) {
+ if (! $silent) {
+ if ($failure && $force_mode) {
print "$My_name: Errors, in force_mode: so I tried finishing targets\n";
}
elsif ($failure) {
@@ -5511,7 +5615,7 @@ sub rdb_makeB {
}
}
return $failure;
-} #END rdb_makeB
+} #END rdb_make
#-------------------
@@ -5556,9 +5660,9 @@ sub rdb_show_rule_errors {
#-------------------
-sub rdb_makeB1 {
- # Call: rdb_makeB1
- # Helper routine for rdb_makeB.
+sub rdb_make1 {
+ # Call: rdb_make1
+ # Helper routine for rdb_make.
# Carries out make at level of given rule (all data available).
# Assumes contexts for recursion, make, and rule, and
# assumes that source files for the rule are to be considered
@@ -5672,7 +5776,7 @@ sub rdb_makeB1 {
"without getting stable files\n";
warn " Use the -f option to force complete processing.\n"
if (! $force_mode);
- $too_many_runs = 1;
+ $too_many_passes = 1;
# Treat rule as completed, else in -pvc mode get infinite reruns:
$$Pout_of_date = 0;
$failure = 1;
@@ -5723,7 +5827,7 @@ sub rdb_makeB1 {
# For a primary rule, i.e., (pdf)latex, not to produce the
# expected output file may not be an error condition.
# Diagnostics were handled in parsing the log file.
- # Special action in main loop in rdb_makeB
+ # Special action in main loop in rdb_make
$missing_dvi_pdf = $$Pdest;
}
elsif ($return == -2) {
@@ -5743,20 +5847,20 @@ sub rdb_makeB1 {
# !!?? $failure_msg = $$Plast_message;
}
-} #END rdb_makeB1
+} #END rdb_make1
#************************************************************
-sub rdb_submakeB {
- # Call: rdb_submakeB
- # Makes all the source files for a given rule.
- # Assumes contexts for recursion, for make, and rule.
- %visited = %visited_at_rule_start;
- local $failure = 0; # Error flag
- my @v = keys %visited;
- rdb_do_files( sub{ rdb_recurse_rule( $$Pfrom_rule, 0,0,0, \&rdb_makeB1 ) } );
- return $failure;
-} #END rdb_submakeB
+#??sub rdb_submake {
+#?? # Call: rdb_submake
+#?? # Makes all the source files for a given rule.
+#?? # Assumes contexts for recursion, for make, and rule.
+#?? %visited = %visited_at_rule_start;
+#?? local $failure = 0; # Error flag
+#?? my @v = keys %visited;
+#?? rdb_do_files( sub{ rdb_recurse_rule( $$Pfrom_rule, 0,0,0, \&rdb_make1 ) } );
+#?? return $failure;
+#??} #END rdb_submake
#************************************************************
@@ -5783,7 +5887,7 @@ sub rdb_classify_rules {
@post_primary = ();
@one_time = ();
- rdb_recurseA( \@requested_targets, \&rdb_classify1, 0,0, \&rdb_classify2 );
+ rdb_recurse( \@requested_targets, \&rdb_classify1, 0,0, \&rdb_classify2 );
# Reverse, as tendency is to find last rules first.
@pre_primary = reverse @pre_primary;
@@ -5878,7 +5982,7 @@ sub rdb_run1 {
# Source file data, by definition, correspond to the file state just
# before the latest run, and the run_time to the time just before the run:
- &rdb_update_filesA;
+ &rdb_update_files;
$$Prun_time = time;
$$Pchanged = 0; # No special changes in files
$$Plast_result = 0;
@@ -6019,7 +6123,7 @@ sub rdb_dummy_run1 {
# Source file data, by definition, correspond to the file state just before
# the latest run, and the run_time to the time just before the run:
- &rdb_update_filesA;
+ &rdb_update_files;
$$Prun_time = time;
$$Pchanged = 0; # No special changes in files
$$Plast_result = 0;
@@ -6085,6 +6189,11 @@ sub Run_subst {
'%Z' => $q.$out_dir1.$q,
'%%' => '%' # To allow literal %B, %R, etc, by %%B.
);
+ if ( ($^O eq "MSWin32" ) && $MSWin_back_slash ) {
+ foreach ( '%R', '%B', '%T', '%S', '%D', '%Y', '%Z' ) {
+ $subst{$_} =~ s(/)(\\)g;
+ }
+ }
my @tokens = split /(%.)/, $ext_cmd;
foreach (@tokens) {
@@ -6169,14 +6278,33 @@ sub rdb_primary_run {
# up-to-date:
rdb_do_files( sub { if ($$Pcorrect_after_primary) {&rdb_update1;} } );
+#?? # There may be new source files, and the run may have caused
+#?? # circular-dependency files to be changed. And the regular
+#?? # source files may have been updated during a lengthy run of
+#?? # latex. So redo the makes for sources of the current rule:
+#?? my $submake_return = &rdb_submake;
+#?? &rdb_clear_change_record;
+#?? &rdb_flag_changes_here(0);
+#?? if ($$Pout_of_date && !$silent) {
+#?? &rdb_diagnose_changes( "Rule '$rule': " );
+#?? }
+
$updated = 1; # Flag that some dependent file has been remade
+#?? # Fix the state of the files as of now: this will solve the
+#?? # problem of latex and pdflatex interfering with each other,
+#?? # at the expense of some non-optimality
+#?? #?? Check this is correct:
+#?? &rdb_update_files;
+
if ( $diagnostics ) {
print "$My_name: Rules after run: \n";
rdb_show();
}
$return = $return_latex;
+
+# ???? Is the following needed?
if ($return_latex && $$Pout_of_date_user) {
print "Error in (pdf)LaTeX, but change of user file(s), ",
"so ignore error & provoke rerun\n"
@@ -6187,12 +6315,12 @@ sub rdb_primary_run {
# Summarize issues that may have escaped notice:
my @warnings = ();
if ($bad_reference) {
- push @warnings, "Latex could not resolve all references";
+ push @warnings, "Latex failed to resolve $bad_reference reference(s)";
}
if ($bad_citation) {
- push @warnings, "Latex could not resolve all citations";
+ push @warnings, "Latex failed to resolve $bad_citation citation(s)";
}
- if ($#warnings > 0) {
+ if ($#warnings > -1) {
show_array( "$My_name: Summary of warnings:", @warnings );
}
return $return;
@@ -6296,7 +6424,7 @@ sub rdb_file_change1 {
sub rdb_new_changes {
&rdb_clear_change_record;
- rdb_recurseA( [@_], sub{ &rdb_flag_changes_here(1); } );
+ rdb_recurse( [@_], sub{ &rdb_flag_changes_here(1); } );
return ($#changed >= 0) || ($#no_dest >= 0) || ($#rules_to_apply >= 0);
} #END rdb_new_changes
@@ -6416,8 +6544,8 @@ sub rdb_diagnose_changes {
#************************************************************
-sub rdb_recurseA {
- # Call: rdb_recurseA( rule | [ rules],
+sub rdb_recurse {
+ # Call: rdb_recurse( rule | [ rules],
# \&rule_act1, \&file_act1, \&file_act2,
# \&rule_act2 )
# The actions are pointers to subroutines, and may be null (0, or
@@ -6451,7 +6579,7 @@ sub rdb_recurseA {
foreach $rule ( @heads ) { rdb_recurse_rule( $rule, @_ ); }
-} #END rdb_recurseA
+} #END rdb_recurse
#************************************************************
@@ -6533,7 +6661,7 @@ sub rdb_recurse_rule {
$depth++;
# We may need to repeat actions on dependent rules, without being
# blocked by the test on visited files. So save %visited:
- local %visited_at_rule_start = %visited;
+ # NOT CURRENTLY USED!! local %visited_at_rule_start = %visited;
# At end, the last value set for %visited wins.
rdb_one_rule( $rule, $rule_act1, \&rdb_recurse_file, $rule_act2 );
$depth--;
@@ -6797,8 +6925,8 @@ sub rdb_update_gen_files {
#************************************************************
-sub rdb_update_filesA {
- # Call: rdb_update_filesA
+sub rdb_update_files {
+ # Call: rdb_update_files
# Assumes rule context. Update source files of rule to current state.
rdb_do_files( \&rdb_update1 );
}
@@ -6897,7 +7025,7 @@ sub show_array {
# Then print rest of @_, one item per line preceeded by some space
warn "$_[0]\n";
shift;
- if ($#_ >= 0) { foreach (@_){ warn " '$_'\n";} }
+ if ($#_ >= 0) { foreach (@_){ warn " $_\n";} }
else { warn " NONE\n"; }
}
@@ -7131,6 +7259,7 @@ sub get_checksum_md5 {
my $md5 = Digest::MD5->new;
my $ignore_pattern = '';
+#&traceback;
#warn "======= GETTING MD5: $source\n";
if ( $source eq "" ) {
# STDIN:
@@ -7620,7 +7749,7 @@ sub Run {
# string is then to be obeyed by the system, and any necessary
# detaching (as of a previewer) is done by the executed command(s).
# internal: The following command string, of the form 'routine arguments'
-# specifies a called to the named Perl subroutine.
+# specifies a call to the named Perl subroutine.
# NONE: This does not run anything, but causes an error message to be
# printed. This is provided to allow program names defined in the
# configuration to flag themselves as unimplemented.
@@ -7797,10 +7926,11 @@ sub find_process_id {
#============================================
-sub good_cwd {
- # Return cwd, but under cygwin, convert to MSWin path
- # so that result can be used for input to MSWin programs
- # as well as cygwin programs
+sub cache_good_cwd {
+ # Set cached value of cwd to current cwd.
+ # Under cygwin, the cwd is converted to a native MSWin path so
+ # that the result can be used for input to MSWin programs as well
+ # as cygwin programs.
my $cwd = cwd();
if ( $^O eq "cygwin" ) {
my $cmd = "cygpath -w \"$cwd\"";
@@ -7818,22 +7948,37 @@ sub good_cwd {
" 'Win_cwd'\n";
}
}
- return $cwd;
-}
+ $cache{cwd} = $cwd;
+} # END cache_good_cwd
+
+#============================================
+
+sub good_cwd {
+ # Return cwd, but under cygwin, convert to MSWin path.
+ # Use cached result
+ return $cache{cwd};
+} # END good_cwd
#============================================
# Directory stack routines
sub pushd {
- push @dir_stack, cwd();
- if ( $#_ > -1) { chdir $_[0]; }
+ push @dir_stack, [cwd(), $cache{cwd}];
+ if ( $#_ > -1) {
+ chdir $_[0];
+ &cache_good_cwd;
+ }
}
#************************************************************
sub popd {
- if ($#dir_stack > -1 ) { chdir pop @dir_stack; }
+ if ($#dir_stack > -1 ) {
+ my $Parr = pop @dir_stack;
+ chdir $$Parr[0];
+ $cache{cwd} = $$Parr[1];
+ }
}
#************************************************************
diff --git a/Master/texmf/doc/man/man1/latexmk.1 b/Master/texmf/doc/man/man1/latexmk.1
index 45858eb1c56..d6df6565e50 100644
--- a/Master/texmf/doc/man/man1/latexmk.1
+++ b/Master/texmf/doc/man/man1/latexmk.1
@@ -1,4 +1,4 @@
-.TH LATEXMK 1L "30 March 2012" ""
+.TH LATEXMK 1L "12 August 2012" ""
.SH NAME
latexmk \- generate LaTeX document
.SH SYNOPSIS
@@ -97,8 +97,28 @@ is that \fIlatexmk\fR generates an extra file (with extension
information.
.SH LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE
-(All options can be introduced by single or double "-" characters,
-e.g., "latexmk -help" or "latexmk --help".)
+In general the command line to invoke \fIlatexmk\fR has the form
+
+ latexmk [options] [file]
+
+All options can be introduced by single or double "-" characters,
+e.g., "latexmk -help" or "latexmk --help".
+
+\fBNote\fR: In addition to the options in the list below,
+\fIlatexmk\fR recognizes almost all the options recognized by the
+\fIlatex\fR and \fIpdflatex\fR programs in one of both of their
+current TeXLive and MiKTeX implementations. Some of the options for
+these programs also trigger special action or behavior by
+\fIlatexmk\fR, in which case they are in this list. Otherwise, they
+are just passed through to a called \fIlatex\fR or \fIpdflatex\fR
+program. Run \fIlatexmk\fR with the \fB-showextraoptions\fR to get a
+list of the options that \fIlatexmk\fR accepts and that are simply
+passed through to \fIlatex\fR or \fIpdflatex\fR. See also the
+explanation of the \fB-showextraoptions\fR option for more
+information.
+
+\fBDefinitions of options and arguments\fR
+
.TP
.B file
One or more files can be specified. If no files are specified,
@@ -197,8 +217,8 @@ exit.
.B -c
Clean up (remove) all regeneratable files generated by \fIlatex\fR and
\fIbibtex\fR or \fIbiber\fR except dvi, postscript and pdf. These files are a
-combination of log files, aux files, latexmk's database file of source
-file information,
+combination of log files, aux files, \fIlatexmk\fR's database file of
+source file information,
and those with extensions
specified in the \fI@generated_exts\fR configuration variable. In addition,
files with extensions by the \fI$clean_ext\fR configuration variable are
@@ -258,8 +278,8 @@ view of the files without listing intermediate files, as well as
\fIlatexmk\fR can determine them.
By default the list of dependent files is sent to stdout (i.e.,
-normally to the screen unless you've redirected latexmk's output).
-But you can set the filename where the list is sent by the
+normally to the screen unless you've redirected \fIlatexmk\fR's
+output). But you can set the filename where the list is sent by the
\fB-deps-out=\fR option.
See the section "USING \fIlatexmk\fR WITH \fImake\fR" for
@@ -283,7 +303,7 @@ Equivalent to \fB-deps-\fR.
.TP
.B -deps-out=FILENAME
Set the filename to which the list of dependent files is written. If
-the FILENAME argument is omitted or set to '-', then the output is
+the FILENAME argument is omitted or set to "-", then the output is
sent to stdout.
Use of this option also turns on the output of the list of dependent
@@ -297,7 +317,7 @@ be performed on this filtered dvi file.
Example usage: To use dviselect to select only the even pages of the dvi file:
- latexmk -dF 'dviselect even' foo.tex
+ latexmk -dF "dviselect even" foo.tex
.TP
.B -diagnostics
Print detailed diagnostics during a run. This may help for debugging
@@ -383,6 +403,16 @@ Turn off \fB-g\fR.
.B -h, -help
Print help information.
.TP
+.B -jobname=STRING
+Set the basename of output files(s) to STRING, instead of the default,
+which is the basename of the specified TeX file.
+
+This is like the same option for current implementations of the
+\fIlatex\fR and \fIpdflatex\fR, and the passing of this option to
+these programs is part of \fIlatexmk\fR's implementation of
+\fB-jobname\fR.
+
+.TP
.B -l
Run in landscape mode, using the landscape mode for the previewers and
the dvi to postscript converters. This option is not normally needed
@@ -392,12 +422,12 @@ automatically.
.B -l-
Turn off \fB-l\fR.
.TP
-.B -latex='command'
+.B -latex="COMMAND"
This sets the string specifying the command to run latex, and is
typically used to add desired options. Since the string normally
contains spaces, it should be quoted, e.g.,
- latex -latex='latex --shell-escape %O %S' foo.tex
+ latex -latex="latex --shell-escape %O %S" foo.tex
The specification of the contents of the string are the same as for
the \fI$latex\fR configuration variable. Depending on your
@@ -512,12 +542,12 @@ Turn off generation of pdf version of document.
It may get overridden if some other option requires the generation of
a pdf file.)
.TP
-.B -pdflatex='command'
+.B -pdflatex="COMMAND"
This sets the string specifying the command to run pdflatex, and is
typically used to add desired options. Since the string normally
contains spaces, it should be quoted, e.g.,
- latex -pdf -pdflatex='pdflatex --shell-escape %O %S' foo.tex
+ latex -pdf -pdflatex="pdflatex --shell-escape %O %S" foo.tex
The specification of the contents of the string are the same as for
the \fI$pdflatex\fR configuration variable. Depending on your
@@ -666,6 +696,39 @@ Show a list of \fIlatemk\fR's rules and dependencies after processing.
Do not show a list of \fIlatexmk\fR's rules and dependencies after
processing. (This is the default.)
.TP
+.B -showextraoptions
+Show the list of extra \fIlatex\fR and \fIpdflatex\fR options that
+\fIlatexmk\fR recognizes. These are options for the \fIlatex\fR and
+\fIpdflatex\fR that \fIlatexmk\fR recognizes, but simply passes
+through to these programs when they are run. These options are
+(currently) a combination of those allowed by the TeXLive and MiKTeX
+implementations. (If a particular option is given to \fIlatexmk\fR
+but is not handled by the particular implementation of \fIlatex\fR or
+\fIpdflatex\fR that is being used, that program will probably give an
+error message.) These options are very numerous, but are not listed
+in this documentation because they have no effect on \fIlatexmk\fR's
+actions.
+
+There are a few options (\fB-includedirectory=dir\fR,
+\fB-initialize\fR, \fB-ini\fR) that are not recognized, either because
+they don't fit with \fIlatexmk\fR's intended operations, or because
+they need special processing by \fIlatexmk\fR that isn't implemented
+(at least, not yet).
+
+There are also options that are accepted by \fIlatex\fR etc, but
+instead trigger actions by \fIlatexmk\fR: \fB-help\fR,
+\fB-version\fR.
+
+Finally, there are certain options for \fIlatex\fR and \fIpdflatex\fR
+(e.g., \fB-recorder\fR) that trigger special actions or behavior by
+\fIlatexmk\fR itself as well as being passed in some form to the
+called \fIlatex\fR and \fIpdflatex\fR program, or that affect other
+programs as well. These options do have entries in this
+documentation. These options are:
+\fB-jobname=STRING\fR, \fB-aux-directory=dir\fR,
+\fB-output-directory=DIR\fR, \fB-quiet\fR, and \fB-recorder\fR.
+
+.TP
.B -silent
Run commands silently, i.e., with options that reduce the amount of
diagnostics generated. For example, with the default settings, the
@@ -677,9 +740,9 @@ generates.
To change the options used to make the commands run silently, you need
to configure \fIlatexmk\fR with changed values of its configuration
variables, the relevant ones being \fI$bibtex_silent_switch\fR,
-\fI$biber_silent_switch\fR,
-\fI$dvips_silent_switch\fR, \fI$latex_silent_switch\fR, and
-\fI$pdflatex_silent_switch\fR.
+\fI$biber_silent_switch\fR, \fI$dvipdf_silent_switch\fR,
+\fI$dvips_silent_switch\fR, \fI$latex_silent_switch\fR,
+\fI$makeindex_silent_switch\fR, and \fI$pdflatex_silent_switch\fR.
.TP
.B -use-make
When after a run of \fIlatex\fR or \fIpdflatex\fR, there are warnings
@@ -884,12 +947,14 @@ to ps).
.TP
.B %T
The name of the primary tex file.
+.TP
.B %Y
Name of directory for auxiliary output files (see the configuration
variable \fI$aux_dir\fR). A directory separation character ('/') is
appended if \fI$aux_dir\fR is non-empty and does not end in a suitable
character, with suitable characters being those appropriate to UNIX
and MS-Windows, i.e., ':', '/' and '\\'.
+.TP
.B %Z
Name of directory for output files (see the configuration
variable \fI$out_dir\fR). A directory separation character ('/') is
@@ -1362,6 +1427,14 @@ fonts, which do not look good when viewed by acroread. That script
should be modified to give dvips the options "-P pdf" to ensure that
type 1 fonts are used in the pdf file.
.TP
+.B $dvipdf_silent_switch ["-q"]
+Switch(es) for dvipdf program when silent mode is on.
+
+N.B. The standard dvipdf program runs silently, so adding the silent
+switch has no effect, but is actually innocuous. But if an
+alternative program is used, e.g., dvipdfmx, then the silent switch
+has an effect. The default setting is correct for dvipdfm and dvipdfmx.
+.TP
.B $dvips ["dvips %O -o %D %S"]
The program to used as a filter to convert a .dvi file to a .ps file.
If pdf is going to be generated from pdf, then the value of the
@@ -1616,6 +1689,9 @@ The make processing program.
.B $makeindex ["makeindex %O -o %D %S"]
The index processing program.
.TP
+.B $makeindex_silent_switch ["-q"]
+\fBSwitch(es)\fR for the index processing program when silent mode is on.
+.TP
.B $max_repeat [5]
The maximum number of times \fIlatexmk\fR will run latex/pdflatex
before deciding that there may be an infinite loop and that it needs
@@ -1625,6 +1701,23 @@ cross-references, etc. The default value covers all normal cases.
(Note that the "etc" covers a lot of cases where one run of
latex/pdflatex generates files to be read in on a later run.)
.TP
+.B $MSWin_back_slash [1]
+This configuration variable only has an effect when \fIlatexmk\fR is
+running under MS-Windows. It determines whether, when a command is
+executed under MS-Windows, there should be substituted "\\" for the
+separator character between components of a directory name.
+Internally, \fIlatexmk\fR uses "/" for the directory separator
+character, which is the character used by Unix-like systems.
+
+For many programs under MS-Windows, both "\\" and "/" are acceptable
+as the directory separator character. But some programs only accept
+"\\". So for safety \fIlatexmk\fR makes a translation, by default.
+It is conceivable that under certain situations this is undesirable,
+so the configuration can be changed. (A possible example might be
+when some of the software is implemented using Cygwin, which provides
+an Unix-like environment inside MS-Windows.)
+
+.TP
.B $new_viewer_always [0]
This variable applies to \fIlatexmk\fR \fBonly\fR in
continuous-preview mode. If \fI$new_viewer_always\fR is 0,
@@ -1866,7 +1959,7 @@ The postscript file filter to be run on the newly produced postscript
file before other processing. Equivalent to specifying the \fB-pF\fR
option.
.TP
-.B $ps_previewer ["start gv %O %S", but \(dqstart %O %S" under MS-WINDOWS]
+.B $ps_previewer ["start gv %O %S", but "start %O %S" under MS-WINDOWS]
The command to invoke a ps-previewer. (The default under MS-WINDOWS
will cause to be run whatever command the system has associated
with .ps files.)
@@ -1891,7 +1984,7 @@ non-trivial reasons), so you should put the "start " bit in
yourself, whenever it is needed.
.TP
-.B $ps_previewer_landscape ["start gv -swap %O %S", but \(dqstart %O %S" under MS-WINDOWS]
+.B $ps_previewer_landscape ["start gv -swap %O %S", but "start %O %S" under MS-WINDOWS]
The command to invoke a ps-previewer in landscape mode.
.TP
.B $ps_update_command [""]
@@ -2100,7 +2193,7 @@ A simple and typical example of code in an initialization rcfile is
add_cus_dep( 'fig', 'eps', 0, 'fig2eps' );
sub fig2eps {
- system("fig2dev -Leps $_[0].fig $_[0].eps");
+ system( "fig2dev -Leps \"$_[0].fig\" \"$_[0].eps\"" );
}
The first line adds a custom dependency that converts a file with
@@ -2128,32 +2221,35 @@ the return value is the value returned by the last (and only)
statement, i.e., the invocation of system, which returns the value 0
on success.
-If you use filenames with spaces in them, and if your LaTeX system and
-all other relevant software correctly handle such filenames, then you
-could put single quotes around filenames in the command line that is
-executed:
-
- add_cus_dep( 'fig', 'eps', 0, 'fig2eps' );
- sub fig2eps {
- system("fig2dev -Lps '$_[0].fig' '$_[0].eps'");
- }
-
-This causes the invocation of the \fIfig2dev\fR program to have quoted
-filenames; it should therefore work with filenames containing spaces.
-\fBHowever, not all software deals correctly with filenames that
-contain spaces. Moreover, the rules, if any, for quoting filenames
-vary between operating systems, command shells and individual pieces
-of software, so this code may not always work.\fR
-
If you use pdflatex instead of latex, then you will probably prefer to
convert your graphics files to pdf format, in which case you would
replace the above code in an initialization file by
add_cus_dep( 'fig', 'pdf, 0, 'fig2pdf' );
sub fig2pdf {
- system("fig2dev -Lpdf $_[0].fig $_[0].pdf");
+ system( "fig2dev -Lpdf \"$_[0].fig\" \"$_[0].pdf\"" );
}
+\fBNote 1:\fR In the command lines given in the system commands in the
+above examples, double quotes have been inserted around the file names
+(implemented by '\"' in the Perl language). They immunize the running
+of the program against special characters in filenames. Very often
+these quotes are not necessary, i.e., they can be omitted. But it is
+normally safer to keep them in. Even though the rules for quoting
+vary between operating systems, command shells and individual pieces
+of software, the quotes in the above examples do not cause problems in
+the cases I have tested.
+
+\fBNote 2:\fR One case in which the quotes are important is when the
+files are in a subdirectory and your operating system is Microsoft
+Windows. Then the separator character for directory components can be
+either a forward slash '/' or Microsoft's more usual backward slash
+'\\'. Forward slashes are generated by latexmk, to maintain its
+sanity from software like MiKTeX that mixes both directory
+separators; but their correct use normally requires quoted filenames.
+(See a log file from a run of MiKTeX (at least in v. 2.9) for an
+example of the use of both directory separators.)
+
If you have some general custom dependencies defined in the system or
user initialization file, you may find that for a particular project
they are undesirable. So you might want to delete the unneeded ones.
@@ -2184,7 +2280,7 @@ happen:
add_cus_dep('ndx', 'nnd', 0, 'makendx2nnd');
sub makendx2nnd {
- system("makeindex -o $_[0].nnd $_[0].ndx");
+ system( "makeindex -o \"$_[0].nnd\" \"$_[0].ndx"\" );
}
(You will need to modify this code if you use filenames
@@ -2222,7 +2318,7 @@ of \fI.fig\fR files to \fI.eps\fR files:
push @cus_dep_list, "fig eps 0 fig2eps";
sub fig2eps {
- system("fig2dev -Lps $_[0].fig $_[0].eps");
+ system( "fig2dev -Lps \"$_[0].fig\" \"$_[0].eps\"" );
}
This method still works, and is equivalent to the earlier code using
@@ -2395,7 +2491,7 @@ e-mail addresses are not written in their standard form to avoid being
harvested by worms and viruses.)
.SH AUTHOR
Current version, by John Collins (username collins at node phys.psu.edu).
-(Version 4.31).
+(Version 4.33b).
Released version can be obtained from CTAN:
<http://www.tug.org/tex-archive/support/latexmk/>, and from the
diff --git a/Master/texmf/doc/man/man1/latexmk.man1.pdf b/Master/texmf/doc/man/man1/latexmk.man1.pdf
index bbfefcd087c..46ddae74617 100644
--- a/Master/texmf/doc/man/man1/latexmk.man1.pdf
+++ b/Master/texmf/doc/man/man1/latexmk.man1.pdf
Binary files differ