summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-04-15 18:21:17 +0000
committerKarl Berry <karl@freefriends.org>2009-04-15 18:21:17 +0000
commit88f7d1ac35385d57d17eb60fb2d77f6704eadde5 (patch)
tree9a1168ab8bd498e87bd743e4fe2e9b4fe289653b
parentf331ca2bd8e23f91132a8c372c999c2d8a8731aa (diff)
latexmk 4.05 (13apr09)
git-svn-id: svn://tug.org/texlive/trunk@12722 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/latexmk/latexmk.pl673
-rw-r--r--Master/texmf-dist/doc/support/latexmk/CHANGES19
-rw-r--r--Master/texmf-dist/doc/support/latexmk/INSTALL91
-rw-r--r--Master/texmf-dist/doc/support/latexmk/README2
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.137
-rwxr-xr-xMaster/texmf-dist/doc/support/latexmk/latexmk.bat10
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.pdfbin155123 -> 73863 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.txt741
-rwxr-xr-xMaster/texmf-dist/scripts/latexmk/latexmk.pl80
9 files changed, 1062 insertions, 591 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl b/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
index 4d124a67893..1b122c7e975 100755
--- a/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
+++ b/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
@@ -1,22 +1,16 @@
-eval '(exit $?0)' && eval 'exec perl -x -S "$0" ${1+"$@"}' &&
-eval 'exec perl -x -S "$0" $argv:q'
-if 0;
+#!/usr/bin/env perl
+# 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
+# If there is a problem for any reason, you can replace the first line of
+# this file by:
+
#!/usr/bin/perl -w
-#!/opt/local/bin/perl -w
-#!/usr/local/bin/perl -w
-# The above code allows this script to be run under UNIX/LINUX without
-# the need to adjust the path to the perl program in a "shebang" line.
-# (The location of perl changes between different installations, and
-# may even be different when several computers running different
-# flavors of UNIX/LINUX share a copy of latex or other scripts.) The
-# script is started under the default command interpreter sh, and the
-# evals in the first two lines restart the script under perl, and work
-# under various flavors of sh. The -x switch tells perl to start the
-# script at the first #! line containing "perl". The "if 0;" on the
-# 3rd line converts the first two lines into a valid perl statement
-# that does nothing.
-#
-# Source of the above: manpage for perlrun
+
+# with the path of the perl executable adjusted for your system.
+
+
+use warnings;
# Delete #??!! when working
@@ -34,17 +28,21 @@ if 0;
# primary run. Ensure fdb and c. is updated enough etc.
# I may have it correct now: fdb_write in makeB
# See also routine rdb_update_files_for_rule, and who calls it
+# It appears to be unused. What is rationale?
# Apparently excess runs of latex after change in .tex file that entails
# change in bibliography.
-# Now I am missing diagnostics
-
-
## ???!!!!!!!!!!!!! Should I remove bibtex rule? NO
## ?? Need to set dependence of extra bibtex rules on .bib file
## ?? Put $pass as variable in rule.
+## ?? Issues with clean-up
+## List of aux files deleted is those read, not those generated.
+## Other files are generated by (pdf)latex; should they be deleted?
+## (I have hooks for this).
+
+
#=======================================
@@ -142,8 +140,8 @@ if 0;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.01';
-$version_details = "$My_name, John Collins, 24 September 2008";
+$version_num = '4.05b';
+$version_details = "$My_name, John Collins, 11 April 2009";
use Config;
@@ -210,8 +208,88 @@ else {
## 5. Parsing of log file instead of source file is used to
## obtain dependencies, by default.
##
-## Modification log for 28 Mar 2007 onwards in detail
+## Modification log for 24 Sep 2008 onwards in detail
##
+## 11 Apr 2009, John Collins Capture ctrl/C and ctrl/break during wait
+## loop in preview_continuous. Then
+## control stays within latexmk on break
+## from loop. It allows user to do
+## postprocessing, like
+## "latexmk -pvc file; cleanup;"
+## 10 Apr 2009, John Collins Safer use of % in placeholders in commands
+## 10 Apr 2009, John Collins V. 4.05
+## 3 Apr 2009, John Collins Change to a nicer #! line
+## 26 Mar 2009, John Collins Case independence for one item in
+## @file_not_found
+## 6 Mar 2009, John Collins Single %input_extensions variable
+## Correct bug in making cusdep for missing
+## extensionless file
+## 5 Mar 2009, John Collins Get rid of warning about variables used
+## only once.
+## 25 Feb 2009, John Collins Ensure viewed file type is made.
+## Configurable extensions for finding
+## cusdep.
+## 24 Feb 2009, John Collins V. 4.04
+## Fix problems when using both latex and pdflatex
+## 1. In fdb, keep primary rules that have been
+## run, even if they are not in use in
+## current invocation of latexmk.
+## 2. But don't write primary rules if they have
+## not been run (i.e., $run_time==0).
+## 3. If $run_time==0 for an in-use primary
+## rule, i.e., if the rule has not
+## been run, then run it
+## unconditionally.
+## 4. But don't let this apply to other
+## rules, since the time-stamp rule
+## will normally have been adequate.
+## Improved diagnostics on reason for rerun.
+## Corrected classify_rules call in pvc.
+## In rdb_set_from_logB: when setting
+## subsidiary rules after parsing log
+## file, this is now done only for the
+## currently-being-applied primary rule,
+## not for all primary rules.
+## 22 Dec 2008, John Collins V. 4.03
+## 22 Dec 2008, John Collins Fix possibility that unwrapping of lines
+## in log_file is done incorrectly
+## 5 Dec 2008, John Collins Correct treatment of -e option
+## 2 Dec 2008, John Collins For home directory (where user's .latexmkrc
+## is located, when $ENV{'HOME'} does
+## not exist, use $ENV{USERPROFILE}
+## (suitable for MS-Win).
+## Clean up code in rdb_set_rules
+## 1 Dec 2008, John Collins -c and -C now also delete fdb_latex file
+## 26 Nov 2008, John Collins Correct problem with invocation of MSWin
+## with cygwin
+## 25 Nov 2008, John Collins Correct problem with invocation of MSWin
+## start command
+## 15 Nov 2008, John Collins Make version # 4.02, for release
+## 12 Nov 2008, John Collins Deal with quoted filenames in log file
+## (as with MikTeX)
+## 10 Nov 2008, John Collins Start fixing bug about -ps -pdfps
+## running ps2pdf before dvips
+## 30 Sep 2008, John Collins V. 4.01a
+## Correct problem that aux files not of
+## same basename are not deleted on clean-up
+## Primary problem: fdb file was deleted before
+## being read
+## ?? Remaining issues on this:
+## List of aux files deleted is those read,
+## not those generated
+## Other files are generated by (pdf)latex
+## should they be deleted?
+## Solution of problem that if a source file
+## for (pdf)latex disappears, that is treated
+## as a change requiring a rerun. This gives
+## an infinite loop of unnecessary runs in
+## -pvc mode
+## Cleanup can also apply to all files
+## generated during (pdf)latex run,
+## as diagnosed by \openout lines,
+## and also to files generated from
+## these. Controlling variable
+## $cleanup_includes_generated.
## 24 Sep 2008, John Collins Release version 4.01.
##
## 1998-2008, John Collins. Many improvements and fixes.
@@ -328,7 +406,7 @@ $log_wrap = 79;
'^\\! LaTeX Error: File `([^\\\']*)\\\' not found\\.',
'.*?:\\d*: LaTeX Error: File `([^\\\']*)\\\' not found\\.',
'^LaTeX Warning: File `([^\\\']*)\\\' not found',
- '^Package .* file `([^\\\']*)\\\' not found',
+ '^Package .* [fF]ile `([^\\\']*)\\\' not found',
);
## Hash mapping file extension (w/o period, e.g., 'eps') to a single regexp,
@@ -360,6 +438,17 @@ $pdflatex = 'pdflatex %O %S';
$latex_silent_switch = '-interaction=batchmode';
$pdflatex_silent_switch = '-interaction=batchmode';
+# %input_extensions maps primary_rule_name to pointer to hash of file extensions
+# used for extensionless files specified in the source file by constructs
+# like \input{file} \includegraphics{file}
+# Could write
+#%input_extensions = ( 'latex' => { 'tex' => 1, 'eps' => 1 };,
+# 'pdflatex' => { 'tex' => 1, 'pdf' => 1, 'jpg' => 1, 'png' => 1 }; );
+# Instead we'll exercise the user-friendly access routines:
+add_input_ext( 'latex', 'tex', 'eps' );
+add_input_ext( 'pdflatex', 'tex', 'jpg', 'pdf' );
+#show_input_ext( 'latex' ); show_input_ext( 'pdflatex' );
+
## Command to invoke bibtex
$bibtex = 'bibtex %O %B';
# Switch(es) to make bibtex silent:
@@ -584,7 +673,7 @@ elsif ( $^O eq "cygwin" ) {
# NT-native start command of a cmd.exe is used.
# For a pdf-file, "start x.pdf" starts the pdf viewer associated with
# pdf files, so no program name is needed:
- $start_NT = "cmd /c start";
+ $start_NT = "cmd /c start \"\"";
$pdf_previewer = "$start_NT %O %S";
$ps_previewer = "$start_NT %O %S";
$ps_previewer_landscape = $ps_previewer;
@@ -840,6 +929,9 @@ $cleanup_mode = 0; # No cleanup of nonessential LaTex-related files.
# dviF, pdf, ps, & psF
$cleanup_fdb = 0; # No removal of file for latexmk's file-database
$cleanup_only = 0; # When doing cleanup, do not go-on to making files
+$cleanup_includes_generated = 0;
+ # Determines whether cleanup deletes files generated by
+ # (pdf)latex (found from \openout lines in log file).
$diagnostics = 0;
$dvi_filter = ''; # DVI filter command
$ps_filter = ''; # Postscript filter command
@@ -1003,8 +1095,7 @@ if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
# List of known rules. Rule types: primary,
# external (calls program), internal (calls routine), cusdep.
-%known_rules = ( 'latex' => 'primary', 'pdflatex' => 'primary',
- );
+%possible_primaries = ( 'latex' => 'primary', 'pdflatex' => 'primary' );
%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
@@ -1023,7 +1114,7 @@ if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
%rule_db = (); # Database of all rules:
# Hash: rulename -> [array of rule data]
# Rule data:
- # 0: [ cmd_type, ext_cmd, int_cmd, out_of_date-crit,
+ # 0: [ cmd_type, ext_cmd, int_cmd, test_kind,
# source, dest, base, out_of_date,
# out_of_date_user, time_of_last_run ]
# where
@@ -1043,7 +1134,7 @@ if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
# This variable intcmd is a reference to an array,
# $$intcmd[0] = internal routine
# $$intcmd[1...] = its arguments (if any)
- # out_of_date_crit specifies method of determining
+ # test_kind specifies method of determining
# whether a file is out-of-date:
# 0 for never
# 1 for usual: whether there is a source
@@ -1100,6 +1191,17 @@ if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
#==================================================
## Read rc files:
+# User's home directory
+$HOME = '';
+if (exists $ENV{'HOME'} ) {
+ $HOME = $ENV{'HOME'};
+}
+elsif (exists $ENV{'USERPROFILE'} ) {
+ $HOME = $ENV{'USERPROFILE'};
+}
+
+
+
sub read_first_rc_file_in_list {
foreach my $rc_file ( @_ ) {
#print "===Testing for rc file \"$rc_file\" ...\n";
@@ -1114,7 +1216,7 @@ sub read_first_rc_file_in_list {
# Read system rc file:
read_first_rc_file_in_list( @rc_system_files );
# Read user rc file.
-read_first_rc_file_in_list( "$ENV{'HOME'}/.latexmkrc" );
+read_first_rc_file_in_list( "$HOME/.latexmkrc" );
# Read rc file in current directory.
read_first_rc_file_in_list( "latexmkrc", ".latexmkrc" );
@@ -1133,9 +1235,8 @@ while ($_ = $ARGV[0])
# Make -- and - equivalent at beginning of option:
s/^--/-/;
shift;
- if (/^-c$/) { $cleanup_mode = 2; $cleanup_only = 1; }
- elsif (/^-C$/) { $cleanup_mode = 1; $cleanup_only = 1; }
- elsif (/^-CA$/) { $cleanup_mode = 1; $cleanup_fdb = 1; $cleanup_only = 1;}
+ if (/^-c$/) { $cleanup_mode = 2; $cleanup_fdb = 1; $cleanup_only = 1; }
+ elsif (/^-C$/ || /^-CA$/ ) { $cleanup_mode = 1; $cleanup_fdb = 1; $cleanup_only = 1; }
elsif (/^-CF$/) { $cleanup_fdb = 1; }
elsif (/^-cd$/) { $do_cd = 1; }
elsif (/^-cd-$/) { $do_cd = 0; }
@@ -1211,12 +1312,10 @@ while ($_ = $ARGV[0])
elsif (/^-view=ps$/) { $view = "ps";}
elsif (/^-view=pdf$/) { $view = "pdf"; }
elsif (/^-e$/) {
- if ( $ARGV[0] eq '' ) {
+ if ( $#ARGV < 0 ) {
&exit_help( "No code to execute specified after -e switch");
}
- else {
- execute_code_string( $ARGV[0] );
- }
+ execute_code_string( $ARGV[0] );
shift;
}
elsif (/^-r$/) {
@@ -1438,6 +1537,14 @@ if ( $view eq "default" ) {
if ( $pdf_mode ) { $view = "pdf"; }
}
+# Make sure we make the kind of file we want to view:
+if ($view eq 'dvi') { $dvi_mode = 1; }
+if ($view eq 'ps') { $postscript_mode = 1; }
+if ( ($view eq 'pdf') && ($pdf_mode == 0) ) {
+ $pdf_mode = 1;
+}
+
+# Make sure that we make something if all requests are turned off
if ( ! ( $dvi_mode || $pdf_mode || $postscript_mode || $printout_mode) ) {
print "No specific requests made, so default to dvi by latex\n";
$dvi_mode = 1;
@@ -1446,9 +1553,19 @@ if ( ! ( $dvi_mode || $pdf_mode || $postscript_mode || $printout_mode) ) {
# Set new-style requested rules:
if ( $dvi_mode ) { $requested_filerules{'latex'} = 1; }
if ( $pdf_mode == 1 ) { $requested_filerules{'pdflatex'} = 1; }
-elsif ( $pdf_mode == 2 ) { $requested_filerules{'ps2pdf'} = 1; }
-elsif ( $pdf_mode == 3 ) { $requested_filerules{'dvipdf'} = 1; }
-if ( $postscript_mode ) { $requested_filerules{'dvips'} = 1; }
+elsif ( $pdf_mode == 2 ) {
+ $requested_filerules{'latex'} = 1;
+ $requested_filerules{'dvips'} = 1;
+ $requested_filerules{'ps2pdf'} = 1;
+}
+elsif ( $pdf_mode == 3 ) {
+ $requested_filerules{'latex'} = 1;
+ $requested_filerules{'dvipdf'} = 1;
+}
+if ( $postscript_mode ) {
+ $requested_filerules{'latex'} = 1;
+ $requested_filerules{'dvips'} = 1;
+}
if ( $printout_mode ) { $one_time{'print'} = 1; }
if ( $preview_continuous_mode || $preview_mode ) { $one_time{'view'} = 1; }
if ( length($dvi_filter) != 0 ) { $requested_filerules{'dvi_filter'} = 1; }
@@ -1456,16 +1573,6 @@ if ( length($ps_filter) != 0 ) { $requested_filerules{'ps_filter'} = 1; }
if ( $banner ) { $requested_filerules{'dvips'} = 1; }
-%possible_primaries = ();
-foreach (&rdb_possible_primaries) {
- $possible_primaries{$_} = 1;
-}
-
-#print "POSSIBLE PRIMARIES: ";
-#foreach (keys %possible_primaries ) {print "$_, ";}
-#print "\n";
-
-
if ( $pdf_mode == 2 ) {
# We generate pdf from ps. Make sure we have the correct kind of ps.
add_option( \$dvips, " $dvips_pdf_switch" );
@@ -1504,7 +1611,6 @@ foreach $filename ( @file_list )
$failure = 0; # Set nonzero to indicate failure at some point of
# a make. Use value as exit code if I exit.
$failure_msg = ''; # Indicate reason for failure
-#?? Unneeded now: $bibtex_mode = $save_bibtex_mode;
if ( $do_cd ) {
($filename, $path) = fileparse( $filename );
@@ -1539,31 +1645,55 @@ foreach $filename ( @file_list )
$fdb_file = "$root_filename.$fdb_ext";
- if ($cleanup_fdb) { unlink $fdb_file; }
if ( $cleanup_mode > 0 ) {
- my @extra_generated = ();
+ # Use parse_logB to get names of generated files.
+ # It returns its results in the following variables:
+ local %dependents = (); # Maps files to status
+ local @bbl_files = ();
+ local %idx_files = (); # Maps idx_file to (ind_file, base)
+ local %generated_log = (); # Lists generated files
+ print "$My_name: Examining log file for generated files...\n";
+ &parse_logB;
+
+ my @index_bibtex_generated = ();
my @aux_files = ();
- rdb_read_generatedB( $fdb_file, \@extra_generated, \@aux_files );
+ my %other_generated = %generated_log;
+
+ rdb_read_generatedB( $fdb_file, \@index_bibtex_generated, \@aux_files,
+ \%other_generated );
if ( ($go_mode == 2) && !$silent ) {
warn "$My_name: Removing all generated files\n" unless $silent;
}
+ foreach (@index_bibtex_generated, @aux_files) {
+ delete( $other_generated{$_} );
+ }
if ($diagnostics) {
- show_array( "For deletion:\n Extra_generated:", @extra_generated );
+ show_array( "For deletion:\n"
+ ." Generated (from makeindex and bibtex):",
+ @index_bibtex_generated );
show_array( " Aux files:", @aux_files );
+ show_array( "Other generated files:\n"
+ ." (only deleted if \$cleanup_includes_generated is set): ",
+ keys %other_generated );
}
+
# Add to the generated files, some log file and some backup
# files used in previous versions of latexmk
- &cleanup1( 'blg', 'ilg', 'log', 'aux.bak', 'idx.bak',
+ &cleanup1( $fdb_ext, 'blg', 'ilg', 'log', 'aux.bak', 'idx.bak',
split(' ',$clean_ext),
@generated_exts
);
- unlink( 'texput.log', @extra_generated, "texput.aux", @aux_files );
+ unlink( 'texput.log', @index_bibtex_generated, "texput.aux", @aux_files );
+ if ($cleanup_includes_generated) {
+ unlink( keys %other_generated );
+ }
if ( $cleanup_mode == 1 ) {
&cleanup1( 'dvi', 'dviF', 'ps', 'psF', 'pdf',
split(' ', $clean_full_ext)
);
}
}
+ if ($cleanup_fdb) { unlink $fdb_file; }
if ($cleanup_only) { next FILE; }
# Initialize file and rule databases.
@@ -1832,11 +1962,10 @@ sub rdb_set_rules {
# Set up rule database from definitions
# Map of files to rules that MAKE them:
- local %from_rules = ();
%rule_db = ();
foreach my $Prule_list (@_) {
- foreach my $rule ( sort keys %$Prule_list) {
+ foreach my $rule ( keys %$Prule_list) {
my ( $cmd_type, $ext_cmd, $int_cmd, $source, $dest, $base, $test_kind ) = @{$$Prule_list{$rule}};
my $needs_making = 0;
# Substitute in the filename variables, since we will use
@@ -1854,21 +1983,7 @@ sub rdb_set_rules {
rdb_create_rule( $rule, $cmd_type, $ext_cmd, $int_cmd, $test_kind,
$source, $dest, $base,
$needs_making );
- if ($dest) { $from_rules{$dest} = $rule ; }
}
- rdb_for_all(
- 0,
- sub{
- # my ($base, $path, $ext) = fileparse( $file, '\.[^\.]*' );
- # if ( exists $from_rules{$file} && ! exists $generated_exts_all{$ext} ) {
- # # Show how to make this file. But don't worry about generated
- # # files.
- if ( exists $from_rules{$file} ) {
- $$Pfrom_rule = $from_rules{$file};
- }
- #?? print "$rule: $file, $$Pfrom_rule\n";
- }
- );
} # End arguments of subroutine
&rdb_make_links;
} # END rdb_set_rules
@@ -2158,7 +2273,9 @@ sub make_preview_continuousB {
local @changed = ();
local @disappeared = ();
local @no_dest = (); # Non-existent destination files
+ local @rules_never_run = ();
local @rules_to_apply = ();
+
local $failure = 0;
local $runs = 0;
local %rules_applied = ();
@@ -2282,15 +2399,18 @@ CHANGE:
print "\n=== Watching for updated files. Use ctrl/C to stop ...\n";
}
$waiting = 1; if ($diagnostics) { warn "WAITING\n"; }
+ &catch_break;
+ $have_break = 0;
WAIT: while (1) {
sleep($sleep_time);
+ if ($have_break) { last WAIT; }
&rdb_clear_change_record;
rdb_recurseA( [@targets], \&rdb_flag_changes_here );
- if ( &rdb_count_changes > 0) {
- &rdb_diagnose_changes
- unless $silent;
-#???
- warn "$My_name: File(s) changed or not used in previous run(s). Remake files.\n";
+ if ( &rdb_need_run ) {
+ if (!$silent) {
+ warn "$My_name: Need to remake files.\n";
+ &rdb_diagnose_changes( ' ' );
+ }
last WAIT;
}
# Does this do this job????
@@ -2300,8 +2420,14 @@ CHANGE:
warn "$My_name: New file(s) found.\n";
last WAIT;
}
+ if ($have_break) { last WAIT; }
} # end WAIT:
- $waiting = 0; if ($diagnostics) { warn "NOT WAITING\n"; }
+ &default_break;
+ if ($have_break) {
+ print "$Latexmk: User typed ctrl/C or ctrl/break. I'll stop.\n";
+ exit;
+ }
+ $waiting = 0; if ($diagnostics) { warn "NOT WAITING\n"; }
} #end infinite_loop CHANGE:
} #END sub make_preview_continuousB
@@ -2483,10 +2609,9 @@ sub print_help
" This and the other clean-ups are instead of a regular make.\n",
" -C - clean up (remove) all nonessential files\n",
" including aux, dep, dvi, postscript and pdf files\n",
- " But exclude file of database of file information\n",
- " -CA - clean up (remove) absolutely ALL nonessential files\n",
- " including aux, dep, dvi, postscript and pdf files,\n",
" and file of database of file information\n",
+ " -CA - clean up (remove) absolutely ALL nonessential files.\n",
+ " Now equivalent to -C option.\n",
" -CF - Remove file of database of file information before doing \n",
" other actions\n",
" -cd - Change to directory of source file when processing it\n",
@@ -2666,6 +2791,8 @@ sub parse_logB {
# Treat the following specially, since they have special rules
# @bbl_files to list of .bbl files.
# %idx_files to map from .idx files to .ind files.
+# %generated_log: keys give set of files written by (pdf)latex (e.g., aux, idx)
+# as determined by \openout = ... lines in log file.
# Also set
# $reference_changed, $bad_reference, $bad_citation
# Trivial or default values if log file does not exist/cannot be opened
@@ -2686,6 +2813,7 @@ sub parse_logB {
foreach (@default_includes) { $dependents{$_} = 4; }
@bbl_files = ();
%idx_files = (); # Maps idx_file to (ind_file, base)
+ %generated_log = ();
$reference_changed = 0;
$bad_reference = 0;
@@ -2697,21 +2825,30 @@ sub parse_logB {
return 0;
}
-LINE:
+# Collect lines of log file
+ my @lines = ();
while(<$log_file>) {
# Could use chomp here, but that fails if there is a mismatch
# between the end-of-line sequence used by latex and that
# used by perl. (Notably a problem with MSWin latex and
# cygwin perl!)
s/[\n\r]*$//;
- if ( $. == 1 ){
+ push @lines, $_;
+ }
+ close $log_file;
+
+ my $line = 0;
+LINE:
+ while( $line <= $#lines ) {
+ $_ = $lines[$line];
+ $line ++;
+ if ( $line == 1 ){
if ( /^This is / ) {
# 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";
- close $log_file;
$failure = 1;
$failure_msg = "Log file '$log_name' appears to have wrong format.";
return 0;
@@ -2720,10 +2857,16 @@ LINE:
# Handle wrapped lines:
# They are lines brutally broken at exactly $log_wrap chars
# excluding line-end.
+ # But a line can be of the length where the wrapping occurs, but
+ # there can be no wrapping. So for a long line, try parsing it
+ # as if it is wrapped, but leave the index variable $line as is,
+ # so that on the next loop over LINE, we also try parsing the
+ # succeeding line as if there was no wrapping:
my $len = length($_);
- while ($len == $log_wrap) {
- my $extra = <$log_file>;
- $extra =~ s/[\n\r]*$//;
+ my $next = $line;
+ while ( ($len == $log_wrap) && ($next <= $#lines) ) {
+ my $extra = $lines[$next];
+ $next++;
$len = length($extra);
$_ .= $extra;
}
@@ -2760,6 +2903,10 @@ LINE:
# Latex error/warning, etc.
next LINE;
}
+ if ( /^\\openout\d+\s*=\s*\`([^\']+)\'\.$/ ) {
+ $generated_log{$1} = 1;
+ next LINE;
+ }
# Test for writing of index file. The precise format of the message
# depends on which package (makeidx.sty , multind.sty or index.sty) and
# which version writes the message.
@@ -2895,19 +3042,22 @@ LINE:
# First step: replace $_ by whole of line after the '('
# Thus $_ is putative filename followed by other stuff.
$_ = $1;
- if ( /^([^\(^\)^\{]*?)\s\[/ ) {
+ if ( /^\"([^\(^\)^\"]+)\"/ ) {
+ # Quoted file name, as from MikTeX
+ }
+ elsif ( /^([^\(^\)]*?)\s\[/ ) {
# Terminator: space then '['
# Use *? in condition: to pick up first ' [' as terminator
# 'file [' should give good filename.
}
- elsif ( /^([^\(^\)^\{]*)\s(?=\()/ ) {
+ elsif ( /^([^\(^\)]*)\s(?=\()/ ) {
# Terminator is ' (', but '(' isn't in matched string,
# so we keep the '(' ready for the next match
}
- elsif ( /^([^\(^\)^\{]*)(\))/ ) {
+ elsif ( /^([^\(^\)]*)(\))/ ) {
# Terminator is ')'
}
- elsif ( /^([^\(^\)^\{]*?)\s*\{/ ) {
+ elsif ( /^([^\(^\)]*?)\s*\{/ ) {
# Terminator: arbitrary space then '{'
# Use *? in condition: to pick up first ' [' as terminator
# 'file [' should give good filename.
@@ -2926,6 +3076,10 @@ LINE:
# Part of font message
next INCLUDE_CANDIDATE;
}
+ # Remove quotes around filename, as for MikTeX. I've already
+ # treated this as a special case. For safety check here:
+ $include_candidate =~ s/^\"(.*)\"$/$1/;
+
# Make list of new include files; sometimes more than one.
my @new_includes = ($include_candidate);
if ( $include_candidate =~ /^(.+)\[([^\]]+)\]$/ ) {
@@ -2961,7 +3115,6 @@ LINE:
} # INCLUDE_NAME
} # INCLUDE_CANDIDATE
} # LINE
- close($log_file);
# Default includes are always definitive:
foreach (@default_includes) { $dependents{$_} = 4; }
@@ -3050,9 +3203,14 @@ CANDIDATE:
if ( $misparse > 0 ) {
print "$misparse\n";
- print "Apparent input files appearently from misunderstood lines in .log file:\n";
+ print "Apparent input files apparently from misunderstood lines in .log file:\n";
foreach ( @misparse ) { print " $_\n"; }
}
+ print "Log file shows the following generated files: ";
+ foreach (keys %generated_log) {
+ print "'$_' ";
+ }
+ print "\n";
}
return 1;
@@ -3364,13 +3522,20 @@ LINE:
#************************************************************
sub rdb_read_generatedB {
- # Call: rdb_read_generatedB( $in_name, \@extra_generated, \@aux_files )
+ # Call: rdb_read_generatedB( $in_name, \@generated1, \@aux_files.
+ # \%other_generated )
# From rule database in saved file, in format written by rdb_write,
- # finds the non-basic generated files that are to be deleted by a cleanup.
- # Returns an array of these files, or an empty array if the file
- # does not exist or cannot be opened.
- my ($in_name, $Pgenerated, $Paux_files) = @_;
- @$Pgenerated = ();
+ # finds the non-trivial generated files that are to be deleted by a cleanup.
+ # On entry:
+ # Keys of %other_generated: any detected generated files, from \openout
+ # lines log file, usually.
+ # At exit:
+ # Array @generated1: files associated with makeindex and bibtex
+ # Array @aux_files: aux files
+ # Added to keys of %other_generated: any files that are destinations of rules
+ # whose source is in %other_generated. (One stage only.)
+ my ($in_name, $Pgenerated1, $Paux_files, $Pother_generated) = @_;
+ @$Pgenerated1 = ();
@$Paux_files = ();
my $in_handle = new FileHandle;
@@ -3384,6 +3549,7 @@ sub rdb_read_generatedB {
my $ext = '';
my $path = '';
my $state = 0; # Outside a section
+ my @other_additions = ();
LINE:
while ( <$in_handle> ) {
# Remove leading and trailing white space.
@@ -3405,12 +3571,15 @@ LINE:
}
else { next LINE; }
if ( $rule =~ /^makeindex/ ) {
- push @$Pgenerated, $source, $dest, "$base.ilg";
+ push @$Pgenerated1, $source, $dest, "$base.ilg";
}
elsif ( $rule =~ /^bibtex/ ) {
- push @$Pgenerated, $dest, "$base.blg";
+ push @$Pgenerated1, $dest, "$base.blg";
push @$Paux_files, $source;
}
+ elsif ( exists ${$Pother_generated}{$source} ) {
+ push @other_additions, $dest;
+ }
$state = 1; #Reading a section
}
elsif ( /^\"([^\"]*)\"\s+(\S+)\s+(\S+)\s+(\S+)\s+\"([^\"]*)\"/ ) {
@@ -3433,7 +3602,9 @@ LINE:
}
} # LINE
undef $in_handle;
-
+ foreach (@other_additions) {
+ ${$Pother_generated}{$_} = 1;
+ }
} # END rdb_read_generatedB
#************************************************************
@@ -3463,13 +3634,25 @@ sub rdb_write {
&rdb_classify_rules( \%possible_primaries, keys %requested_filerules );
print $out_handle "# Fdb version $fdb_ver\n";
- my @rules = sort(
- rdb_accessible(
- uniq1( keys %known_rules, keys %current_primaries )));
+ my @rules = rdb_accessible( uniq1( keys %possible_primaries ) ) ;
+ # Separate call to sort. Otherwise rdb_accessible seems to get wrong argument.
+ @rules = sort( @rules );
rdb_for_some(
\@rules,
- sub { print $out_handle "[\"$rule\"] $$Prun_time \"$$Psource\" \"$$Pdest\" \"$$Pbase\" \n"; },
- sub { print $out_handle " \"$file\" $$Ptime $$Psize $$Pmd5 \"$$Pfrom_rule\"\n"; },
+ sub {
+ # Omit data on a unused and never-run primary rule:
+ if ( ($$Prun_time == 0)
+ && exists( $possible_primaries{$rule} )
+ && ! exists( $current_primaries{$rule} )
+ )
+ {
+ return;
+ }
+ print $out_handle "[\"$rule\"] $$Prun_time \"$$Psource\" \"$$Pdest\" \"$$Pbase\" \n";
+ rdb_do_files(
+ sub { print $out_handle " \"$file\" $$Ptime $$Psize $$Pmd5 \"$$Pfrom_rule\"\n"; }
+ );
+ }
);
undef $out_handle;
return 1;
@@ -3496,9 +3679,10 @@ sub rdb_set_from_logB {
# Parse log file to find relevant filenames
# Result in the following variables:
- local %dependents = (); # Maps files to status
+ local %dependents = (); # Maps files to status
local @bbl_files = ();
- local %idx_files = (); # Maps idx_file to (ind_file, base)
+ local %idx_files = (); # Maps idx_file to (ind_file, base)
+ local %generated_log = (); # Lists generated files found in log file
# The following are also returned, but are global, to be used by caller
# $reference_changed, $bad_reference $bad_citation
@@ -3514,11 +3698,9 @@ sub rdb_set_from_logB {
if ($diagnostics);
rdb_create_rule( $from_rule, 'external', $makeindex, '', 1,
$idx_file, $ind_file, $ind_base, 1, 0);
- foreach my $primary ( keys %primaries ) {
- print " ===Source file '$ind_file' for '$primary'\n"
+ print " ===Source file '$ind_file' for '$rule'\n"
if ($diagnostics > -1);
- rdb_ensure_file( $primary, $ind_file, $from_rule );
- }
+ rdb_ensure_file( $rule, $ind_file, $from_rule );
}
if ( ! -e $ind_file ) {
# Failure was non-existence of makable file
@@ -3545,24 +3727,22 @@ sub rdb_set_from_logB {
if ($diagnostics);
rdb_ensure_file( $from_rule, $source );
}
- foreach my $primary ( keys %primaries ) {
- print " ===Source file '$bbl_file' for '$primary'\n"
+ print " ===Source file '$bbl_file' for '$rule'\n"
if ($diagnostics);
- rdb_ensure_file( $primary, $bbl_file, $from_rule );
- if ( ! -e $bbl_file ) {
- # Failure was non-existence of makable file
- # Leave failure issue to other rules.
- $failure = 0;
- }
+ rdb_ensure_file( $rule, $bbl_file, $from_rule );
+ if ( ! -e $bbl_file ) {
+ # Failure was non-existence of makable file
+ # Leave failure issue to other rules.
+ $failure = 0;
}
}
}
NEW_SOURCE:
foreach my $new_source (keys %dependents) {
- foreach my $primary ( keys %primaries ) {
- rdb_ensure_file( $primary, $new_source );
- }
+ print " ===Source file for rule '$rule': '$new_source'\n"
+ if ($diagnostics);
+ rdb_ensure_file( $rule, $new_source );
}
my @more_sources = &rdb_set_dependentsA( $rule );
@@ -3750,7 +3930,12 @@ sub rdb_set_dependentsA {
# Call rdb_set_dependentsA( rules ...)
# Returns array (sorted), of new source files.
local @new_sources = ();
+ local @deletions = ();
rdb_recurseA( [@_], 0, \&rdb_one_depA );
+ foreach (@deletions) {
+ my ($rule, $file) = @$_;
+ rdb_remove_files( $rule, $file );
+ }
&rdb_make_links;
return uniqs( @new_sources );
} #END rdb_set_dependentsA
@@ -3764,6 +3949,7 @@ sub rdb_one_depA {
my ($base_name, $path, $toext) = fileparseA( $new_dest );
$base_name = $path.$base_name;
$toext =~ s/^\.//;
+ my $Pinput_extensions = $input_extensions{$rule};
DEP:
foreach my $dep ( @cus_dep_list ) {
my ($fromext,$proptoext,$must,$func_name) = split(' ',$dep);
@@ -3781,6 +3967,7 @@ DEP:
push @new_sources, $new_dest;
}
if (! rdb_rule_exists( $$Pfrom_rule ) ) {
+ print "=== Creating rule for '$$Pfrom_rule'\n";
rdb_create_rule( $$Pfrom_rule, 'cusdep', '', \@PAnew_cmd, 3,
$source, $new_dest, $base_name, 0 );
}
@@ -3810,7 +3997,11 @@ DEP:
}
}
}
- elsif ( ($toext eq '') && (! -e $file ) ) {
+ elsif ( ($toext eq '')
+ && (! -e $file )
+ && (! -e "$base_name.$proptoext" )
+ && exists $$Pinput_extensions{$proptoext}
+ ) {
# Empty extension and non-existent destination
# This normally results from \includegraphics{A}
# without graphics extension for file, when file does
@@ -3818,7 +4009,7 @@ DEP:
my $source = "$base_name.$fromext";
if ( -e $source ) {
$new_dest = "$base_name.$proptoext";
- my $from_rule = "cusdep $fromext $toext $base_name";
+ my $from_rule = "cusdep $fromext $proptoext $base_name";
push @new_sources, $new_dest;
print "Ensuring rule for '$from_rule', to make '$new_dest'\n"
if $diagnostics > -1;
@@ -3834,6 +4025,9 @@ DEP:
);
}
rdb_ensure_file( $rule, $new_dest, $from_rule );
+ # We've now got a spurious file in our rule. But don't mess
+ # with deleting an item we are in the middle of!
+ push @deletions, [$rule, $file];
return;
}
} # End of Rule found
@@ -3894,29 +4088,7 @@ sub rdb_accessible {
} #END rdb_accessible
#************************************************************
-
-sub rdb_possible_primaries {
- # Returns array of possible primaries
- my @rules = ();
- foreach my $rule ( keys %known_rules ) {
- if ( $known_rules{$rule} eq 'primary') {
- push @rules, $rule;
- }
- }
- return @rules;
-} #END rdb_possible_primaries
-
-#************************************************************
-#************************************************************
#************************************************************
-
-# Routines for makes. NEW VERSIONS ??
-
-#????????Debugging routines:
-sub R1 {print "===START $rule\n"}
-sub R2 {print "===END $rule\n"}
-sub F1 {print " ---START $file\n"}
-sub F2 {print " ---END $file\n"}
#************************************************************
sub rdb_makeB {
@@ -4071,6 +4243,7 @@ sub rdb_makeB {
local @changed = ();
local @disappeared = ();
local @no_dest = (); # Non-existent destination files
+ local @rules_never_run = ();
local @rules_to_apply = ();
&rdb_classify_rules( \%possible_primaries, @requested_targets );
@@ -4100,6 +4273,7 @@ sub rdb_makeB {
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 ) {
@@ -4132,7 +4306,10 @@ sub rdb_makeB {
continue {
# Re-evaluate rule classification and accessibility,
# but do not change primaries.
- &rdb_classify_rules( \%current_primaries, @requested_targets );
+ # Problem is that %current_primaries gets altered
+ my %old_curr_prim = %current_primaries;
+ &rdb_classify_rules( \%possible_primaries, @requested_targets );
+ %current_primaries = %old_curr_prim;
&rdb_make_links;
}
}
@@ -4174,11 +4351,14 @@ sub rdb_makeB1 {
if ($diagnostics) { print " MakeB1 $rule\n"; }
if ($failure & ! $force_mode) {return;}
&rdb_clear_change_record;
- &rdb_flag_changes_here;
-# if ($diagnostics>-1) { print " MakeB1.1 $rule $$Pout_of_date\n"; }
+ if ( ($$Prun_time == 0) && exists($possible_primaries{$rule}) ) {
+ push @rules_never_run, $rule;
+ $$Pout_of_date = 1;
+ }
+ else {
+ &rdb_flag_changes_here;
+ }
- my $return = 0; # Return code from called routine
-#?? print "makeB1: Trying '$rule' for '$$Pdest': ";
if (!$$Pout_of_date) {
#?? if ( ($$Pcmd_type eq 'primary') && (! $silent) ) {
# print "Rule '$rule' up to date\n";
@@ -4188,19 +4368,17 @@ sub rdb_makeB1 {
if ($diagnostics) { print " remake\n"; }
if (!$silent) {
print "$My_name: applying rule '$rule'...\n";
- &rdb_diagnose_changes( "Rule $rule: ");
+ &rdb_diagnose_changes( "Rule '$rule': ");
}
-##????????????????????????????????????: variable rules_applied not used
$rules_applied{$rule} = 1;
$runs++;
-#?? print "$rule: $$Pcmd_type\n";
# We are applying the rule, so its source file state for when it
# was last made is as of now:
# ??IS IT CORRECT TO DO NOTHING IN CURRENT VERSION?
# The actual run
- $return = 0;
+ my $return = 0; # Return code from called routine
# Rule may have been created since last run:
if ( ! defined $pass{$rule} ) {$pass{$rule} = 0; }
if ( $pass{$rule} ge $max_repeat ) {
@@ -4330,6 +4508,7 @@ sub rdb_classify_rules {
foreach ( @one_time ) { print " $_\n"; }
}
} #end diagnostics
+
} #END rdb_classify_rules
#-------------------
@@ -4338,7 +4517,7 @@ sub rdb_classify1 {
# Helper routine for rdb_classify_rules
# Applied as rule_act1 in recursion over rules
# Assumes rule context, and local variables from rdb_classify_rules
-# print "=========== '$rule' $depth ========== \n";
+ #print "??======= '$rule' $depth $state ========== \n";
push @classify_stack, [$state];
if ( exists $possible_one_time{$rule} ) {
# Normally, we will have already extracted the one_time rules,
@@ -4462,14 +4641,23 @@ sub rdb_ext_cmd1 {
#Set character to surround filenames:
my $q = $quote_filenames ? '"' : '';
- foreach ($ext_cmd) {
- s/%O/$options/g;
- s/%R/$q$root_filename$q/g;
- s/%B/$q$base$q/g;
- s/%T/$q$texfile_name$q/g;
- s/%S/$q$source$q/g;
- s/%D/$q$dest$q/g;
+
+ %subst = (
+ '%O' => $options,
+ '%R' => $q.$root_filename.$q,
+ '%B' => $q.$base.$q,
+ '%T' => $q.$texfile_name.$q,
+ '%S' => $q.$source.$q,
+ '%D' => $q.$dest.$q,
+ '%%' => '%' # To allow literal %B, %R, etc, by %%B.
+ );
+
+ my @tokens = split /(%.)/, $ext_cmd;
+ foreach (@tokens) {
+ if (exists($subst{$_})) { $_ = $subst{$_}; }
}
+ $ext_cmd = join '', @tokens;
+
# print "quote is '$q'; ext_cmd = '$ext_cmd'\n";
my ($pid, $return) = &Run_msg($ext_cmd);
return $return;
@@ -4553,13 +4741,14 @@ sub rdb_primary_run {
#************************************************************
sub rdb_clear_change_record {
+ # Initialize diagnostics for reasons for running rule.
@changed = ();
@disappeared = ();
@no_dest = ();
- @rules_to_apply = ();
-#??????????????? $failure = 0;
-##????????????????????????????????????: variable rules_applied not used
- $rules_applied = 0;
+ @rules_never_run = ();
+ @rules_to_apply = (); # This is used in recursive application
+ # of rdb_flag_changes_here, to list
+ # rules that were out-of-date for some reason.
} #END rdb_clear_change_record
#************************************************************
@@ -4607,12 +4796,19 @@ sub rdb_file_change1 {
#?? " New $new_time, $new_size, $new_md5\n";
my $ext = ext( $file );
if ( ($new_size < 0) && ($$Psize >= 0) ) {
- print "Disappeared '$file' in '$rule'\n";
+ # print "Disappeared '$file' in '$rule'\n";
push @disappeared, $file;
# No reaction is good.
#$$Pout_of_date = 1;
# ??? 1 Sep. 2008: I do NOT think so, for cusdep no-file-exists issue
- $$Pout_of_date = 1;
+ # ??? 30 Sep 2008: I think I have this fixed. There were other changes
+ # needed. No-change-flagged is correct. The array @disappeared flags
+ # files that have disappeared, if I need to know. But having a source
+ # file disappear is not a reason for a remake unless I know how to
+ # make the file. If the file is a destination of a rule, that rule
+ # will be rerun. It may be that the user is changing another source
+ # in such a way that the disappeared file won't be needed. Before the
+ # change is applied we get a superfluous infinite loop.
return;
}
if ( ($new_size < 0) && ($$Psize < 0) ) {
@@ -4638,9 +4834,9 @@ sub rdb_file_change1 {
#************************************************************
-sub rdb_count_changes {
- return $#changed + $#disappeared + $#no_dest + $#rules_to_apply + 4;
-} #END rdb_count_changes
+sub rdb_need_run {
+ return ($#changed >= 0) || ($#no_dest >= 0) || ($#rules_to_apply >= 0);
+} #END rdb_need_run
#************************************************************
@@ -4650,26 +4846,31 @@ sub rdb_diagnose_changes {
# Precede the message by the optional heading, else by "$My_name: "
my $heading = defined($_[0]) ? $_[0] : "$My_name: ";
- if ( &rdb_count_changes == 0 ) {
- warn "${heading}No changes\n";
- return;
- }
- warn "${heading}Changes:\n";
- if ( $#changed >= 0 ) {
- warn " Changed files, or newly in use since previous run(s):\n";
- foreach (uniqs(@changed)) { warn " '$_'\n"; }
+ if ($#rules_never_run >= 0) {
+ warn "${heading}Rules & subrules not known to be previously run:\n";
+ foreach (@rules_never_run) { warn " $_\n"; }
}
- if ( $#disappeared >= 0 ) {
- warn " No-longer-existing files:\n";
- foreach (uniqs(@disappeared)) { warn " '$_'\n"; }
+ if ( ($#changed >= 0) || ($#disappeared >= 0) || ($#no_dest >= 0) ) {
+ warn "${heading}File changes, etc:\n";
+ if ( $#changed >= 0 ) {
+ warn " Changed files, or newly in use since previous run(s):\n";
+ foreach (uniqs(@changed)) { warn " '$_'\n"; }
+ }
+ if ( $#disappeared >= 0 ) {
+ warn " No-longer-existing files:\n";
+ foreach (uniqs(@disappeared)) { warn " '$_'\n"; }
+ }
+ if ( $#no_dest >= 0 ) {
+ warn " Non-existent destination files:\n";
+ foreach (uniqs(@no_dest)) { warn " '$_'\n"; }
+ }
}
- if ( $#no_dest >= 0 ) {
- warn " Non-existent destination files:\n";
- foreach (uniqs(@no_dest)) { warn " '$_'\n"; }
+ elsif ($#rules_to_apply >=0) {
+ warn "${heading}The following rules & subrules became out-of-date:\n";
+ foreach (@rules_to_apply) { warn " '$_'\n"; }
}
- if ( $#rules_to_apply >= 0 ) {
- warn " Rules to apply:\n";
- foreach (uniqs(@rules_to_apply)) { warn " '$_'\n"; }
+ else {
+ warn "${heading}No file changes\n";
}
} #END rdb_diagnose_changes
@@ -4773,6 +4974,7 @@ sub rdb_recurseA {
# This routine sets a context for anything recursive, with @heads,
# %visited and $depth being set as local variables.
+
local @heads = ();
my $rules = shift;
@@ -5180,7 +5382,8 @@ sub show_array {
# Then print rest of @_, one item per line preceeded by some space
warn "$_[0]\n";
shift;
- foreach (@_){ warn " $_\n";}
+ if ($#_ >= 0) { foreach (@_){ warn " '$_'\n";} }
+ else { warn " NONE\n"; }
}
#************************************************************
@@ -5630,6 +5833,47 @@ sub show_cus_dep {
####################################################
+sub add_input_ext {
+ # Usage: add_input_ext( rule, ext, ... )
+ # Add extension(s) (specified without a leading period) to the
+ # list of input extensions for the given rule. The rule should be
+ # 'latex' or 'pdflatex'. These extensions are used when an input
+ # file without an extension is found by (pdf)latex, as in
+ # \input{file} or \includegraphics{figure}. When latexmk searches
+ # custom dependencies to make the missing file, it will assume that
+ # the file has one of the specified extensions.
+ my $rule = shift;
+ if ( ! exists $input_extensions{$rule} ) {
+ $input_extensions{$rule} = {};
+ }
+ my $Prule = $input_extensions{$rule};
+ foreach (@_) { $$Prule{$_} = 1; }
+}
+
+####################################################
+
+sub remove_input_ext {
+ # Usage: remove_input_ext( rule, ext, ... )
+ # Remove extension(s) (specified without a leading period) to the
+ # list of input extensions for the given rule. The rule should be
+ # 'latex' or 'pdflatex'. See sub add_input_ext for the use.
+ my $rule = shift;
+ if ( ! exists $input_extensions{$rule} ) { return; }
+ my $Prule = $input_extensions{$rule};
+ foreach (@_) { delete $$Prule{$_}; }
+}
+
+####################################################
+
+sub show_input_ext {
+ # Usage: show_input_ext( rule )
+ my $rule = shift;
+ show_array ("Input extensions for rule '$rule': ",
+ keys %{$input_extensions{$rule}} );
+}
+
+####################################################
+
sub find_dirs1 {
# Same as find_dirs, but argument is single string with directories
# separated by $search_path_separator
@@ -5909,7 +6153,9 @@ sub Run_Detached {
if ( "$^O" eq "MSWin32" ){
# Win95, WinNT, etc: Use MS's start command:
- return( 0, system( "start $cmd_line" ) );
+ # Need extra double quotes to deal with quoted filenames:
+ # MSWin start takes first quoted argument to be a Window title.
+ return( 0, system( "start \"\" $cmd_line" ) );
} else {
# Assume anything else is UNIX or clone
# For this purpose cygwin behaves like UNIX.
@@ -6023,9 +6269,38 @@ sub finish_dir_stack {
#************************************************************
#************************************************************
-#************************************************************
-#************************************************************
-#************************************************************
-#************************************************************
+# Break handling routines (for wait-loop in preview continuous)
+
+sub end_wait {
+ # Handler for break: Set global variable $have_break to 1.
+ $signal = shift;
+ # Some systems (e.g., MSWin reset) appear to reset the handler.
+ # So I'll re-enable it
+ &catch_break;
+ $have_break = 1;
+}
+
+#========================
+
+sub catch_break {
+# Capture ctrl/C and ctrl/break.
+# $SIG{INT} corresponds to ctrl/C on LINUX/?UNIX and MSWin
+# $SIG{BREAK} corresponds to ctrl/break on MSWin, doesn't exist on LINUX
+ $SIG{INT} = \&end_wait;
+ if ( exists $SIG{BREAK} ) {
+ $SIG{BREAK} = \&end_wait;
+ }
+}
+
+#========================
+
+sub default_break {
+# Arrange for ctrl/C and ctrl/break to give default behavior
+ $SIG{INT} = 'DEFAULT';
+ if ( exists $SIG{BREAK} ) {
+ $SIG{BREAK} = 'DEFAULT';
+ }
+}
+
#************************************************************
#************************************************************
diff --git a/Master/texmf-dist/doc/support/latexmk/CHANGES b/Master/texmf-dist/doc/support/latexmk/CHANGES
index 509b82fe299..b4b4422f3e5 100644
--- a/Master/texmf-dist/doc/support/latexmk/CHANGES
+++ b/Master/texmf-dist/doc/support/latexmk/CHANGES
@@ -50,3 +50,22 @@ From v. 3.07 to v. 4.01
Miscellaneous bug fixes, etc.
Improvements in parsing of log file
+From v. 4.01 to v. 4.05
+ Miscellaneous bug fixes
+ Fix bug that -ps -pdfps runs ps2pdf before dvips
+ Deal with quoted filenames in log file
+ Correct problem with invocation of MSWin start command
+ -c and -C now also delete fdb_latex file
+ For home directory (where user's .latexmkrc is located,
+ when $ENV{'HOME'} does not exist, use $ENV{USERPROFILE}
+ (suitable for MS-Win).
+ Correct treatment of -e option
+ Fix possibility that unwrapping of lines in log_file is done
+ incorrectly
+ Correct parsing of log file
+ Improve diagnostics of reasons for rerun of external program.
+ Fix problems when using both latex and pdflatex
+ Configurable extensions for finding cusdep
+ Change to a nicer #! line
+ Safer use of % in placeholders in commands
+
diff --git a/Master/texmf-dist/doc/support/latexmk/INSTALL b/Master/texmf-dist/doc/support/latexmk/INSTALL
index 225e1c6e6b5..d351b7165cd 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.00, 12 March 2008)
+ (Version 4.05, 11 April 2008)
John Collins
Physics Department
@@ -46,33 +46,51 @@ b. A working installation of TeX and LaTeX. (See http://www.ctan.org/ if
Installing on UNIX/LINUX
========================
+(Power users can modify these as appropriate.)
+
1. Make sure you have working installations of Perl and TeX/LaTeX.
2. Put the file latexmk.pl in a directory for executable files. For
example, for a system-wide installation, you could put it in
- /usr/local/bin.
+ /usr/local/bin. But if you are an ordinary user, you can put the
+ file somewhere where you have access.
3. Rename this file to latexmk.
4. Make sure latexmk is executable, e.g., by using chmod suitably.
+ [Special case, which you probably don't have to be concerned
+ with: You may also find it necessary to change the first line
+ of the script so that perl can be found to execute latexmk.
+ Currently the first line is #!/usr/bin/env perl, which uses
+ the program /usr/bin/env to find perl, provided only that the
+ perl executable can be found in the PATH for executables.
+ This insulates latexmk from the fact that the perl executable
+ has a very system dependent location. The program /usr/bin/env
+ is suppposed to be present on almost all modern UNIX/Linux
+ systems.]
5. (Optional) Copy the file latexmk.1 to an appropriate directory for man
pages, e.g., /usr/local/man/man1/.
-6. Check whether the commands used by latexmk for executing latex etc are
- correct. Normally the only one you have to worry about is $pscmd.
- This runs the command ps and is used in preview_continuous_mode to
- determine whether a previewer is already running. The format of the
- output of ps is highly system dependent. Latexmk should get it right
- under LINUX and Solaris. If latexmk does not get this or another
- command correct, put an override in a startup file.
+6. Check whether the commands used by latexmk for executing latex etc
+ are correct. The ones you have to worry about are those for
+ previewing files ($pdf_previewer, $ps_previewer, and
+ $dvi_previwer), and most importantly $pscmd, and its associated
+ variable $pid_position --- see below. The command $pscmd is the
+ least obvious: it runs the command ps and is used in
+ preview_continuous_mode to determine whether a previewer is
+ already running. The format of the output of ps is highly system
+ dependent. Latexmk should get it right under LINUX and Solaris.
+ If latexmk does not get this or another command correct, put an
+ override in a startup file.
a. For a system-wide installation, the correction should be in the
system startup file, which is any one of the files
/opt/local/share/latexmk/LatexMk,
/usr/local/share/latexmk/LatexMk,
/usr/local/lib/latexmk/LatexMk.
- (You get to choose which.)
+ (You get to choose which, but only one. If none of these
+ directories is appropriate you'll need to modify latexmk.pl.)
b. If you are installing latexmk as an ordinary user, the startup
file is the user startup file, which is the file .latexmkrc in
@@ -80,23 +98,43 @@ Installing on UNIX/LINUX
The startup files are written in perl, so possible overrides are like
- $latex = 'unusual_program_to_run_instead_of_normal_latex';
+ $latex = 'unusual_program_to_run_instead_of_normal_latex %O %S';
for changing the program to run latex, and
$pscmd = 'ps -aeg';
$pid_position = 1;
- for the ps command. Here, $pid_position = 1 indicates that the process
- ID number is in the first column of the output of the command ps.
+ for the ps command. Here, $pid_position = 1 indicates that the
+ process ID number is in the first column of the output of the
+ command ps. See the latexmk.pl file for some examples.
7. If you need any modifications on the commands for running previewers,
like gv, note that prefixing a command by start, as in
- $ps_previewer = 'start gv -watch';
+ $ps_previewer = 'start gv -watch %O %S';
ensures that the command is run detached, as is normally appropriate
- for a previewer.
+ for a previewer.
+
+ (In the examples above, there appear the strings %O and %S. See
+ the documenation for details. They are placeholders used when
+ latexmk constructs the command line. %O denotes any options
+ latexmk wants to add to the command invocation, and %S denotes the
+ source file.)
+
+8. You may also want to change the defaults on what kinds of output
+ file makes. By default latexmk makes dvi files, but not
+ postscript or pdf files. If you (or people on your system)
+ generally make pdf files using pdflatex, it would be a good idea
+ to put the following in an appropriate initialization file:
+
+ $pdf_mode = 1;
+ $postscript_mode = 0;
+ $dvi_mode = 0;
+
+ See step 6 for the locations of these files (under UNIX-like
+ systems). This change is likely to be particularly for Mac OS-X.
Installing on MS-Windows
@@ -153,11 +191,12 @@ Installing on MS-Windows
which is a pure ASCII text file, and latexmk.ps which is a postscript
file.
-6. Check whether perl is in the search path for executables. (E.g., from
- the MSDOS command-line prompt, try the command perl --version.) If
- perl is not in the search path, then modify the first line of
- latexmk.bat (which you installed at step 2) by replacing the command
- perl by the full path name for perl, e.g., C:\perl\bin\perl.exe.
+6. Check whether perl is in the search path for executables. (E.g.,
+ from the MS-Windows command-line prompt, try the command perl
+ --version.) If perl is not in the search path, then modify the
+ first line of latexmk.bat (which you installed at step 2) by
+ replacing the command perl by the full path name for perl, e.g.,
+ C:\perl\bin\perl.exe.
7. You may need to reboot, or at least logoff and log back in, if you
made any changes to the path at step 3. Test out the installation
@@ -199,12 +238,16 @@ Installing on MS-Windows
installation instructions for what to do. The only changes needed
from the UNIX instructions are:
- a. The system initialization file is C:\latexmk\LatexMk.
+ a. The system initialization file is C:\latexmk\LatexMk. (If
+ this is not suitable for some reason, you'll need to change
+ the latexmk.pl file where this filename appears.)
b. The user initialization file is .latexmkrc in the directory
specified by the environment variable HOME. If there is no HOME
- variable, then the file is in the root directory of the current
- drive.
+ variable, then the file is in the directory specified by the
+ environment variable USERPROFILE, which should have been set
+ by the MS-Windows operating system at login.
+
Other systems
@@ -265,7 +308,7 @@ Version 2 was modified by Evan McLean.
The current version is by John Collins (username collins at node
phys.psu.edu) -- other contact details at the top. It is copyright
-1998-2008 by John Collins, and the previous authors; see the copyright
+1998-2009 by John Collins, and the previous authors; see the copyright
notice in the latexmk.pl file, which gives permission to use, copy,
modify, and distribute this software and its documentation under the
terms of the GNU Public License.
diff --git a/Master/texmf-dist/doc/support/latexmk/README b/Master/texmf-dist/doc/support/latexmk/README
index 7a3b07a87c4..c6dd361df1e 100644
--- a/Master/texmf-dist/doc/support/latexmk/README
+++ b/Master/texmf-dist/doc/support/latexmk/README
@@ -88,7 +88,7 @@ I hope you find this useful.
John Collins
---------------------------- "latexmk -h" ----------------------------
-Latexmk 4.05: Automatic LaTeX document generation routine
+Latexmk 4.05b: Automatic LaTeX document generation routine
Usage: latexmk [latexmk_options] [filename ...]
diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.1 b/Master/texmf-dist/doc/support/latexmk/latexmk.1
index c50258b3f28..ec5c9245afa 100644
--- a/Master/texmf-dist/doc/support/latexmk/latexmk.1
+++ b/Master/texmf-dist/doc/support/latexmk/latexmk.1
@@ -532,6 +532,12 @@ 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 \fIPerl\fR
+programming language brings into play some special rules for
+interpolating variables into strings. People not fluent in \fIPerl\fR
+will want to avoid these complications.)
+
You can do much more complicated things, but for this you will need to
consult a manual for the \fIPerl\fR programming language.
@@ -582,6 +588,21 @@ to ps).
.B %T
The name of the primary tex file.
.PP
+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 of a postscript file to be viewed.
+.PP
+Appropriate quoting will be applied to the filename substitutions, so
+you mustn't supply them yourself even if you the names of your 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 \fI$quote_filenames\fR.
+.PP
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
@@ -1283,6 +1304,20 @@ The number of the signal that is sent to the pdf viewer when it is
updated by sending a signal -- see \fI$ps_update_method\fR. The
default value is the one appropriate for gv on a UNIX system.
.TP
+.B $quote_filenames [1]
+This specifies whether substitutions for placeholders in command
+specifications (as in \fI$pdflatex\fR) are surrounded by double
+quotes. If this variable is 1 (or any other value Perl regards as
+true), then quoting is done. Otherwise quoting is omitted.
+.PP
+The quoting method used by latexmk is tested to work correctly under
+UNIX systems (including Linux and Mac OS-X) and under MS-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 names contain spaces. Latexmk's
+quoting only ensures that such filenames are correctly treated by the
+operating system in passing arguments to programs.)
+.TP
.B $sleep_time [2]
The time to sleep (in seconds) between checking for source file
changes when running the \fB-pvc\fR option.
@@ -1539,7 +1574,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.05).
+(Version 4.05a).
Released version can be obtained from CTAN:
<http://www.tug.org/tex-archive/support/latexmk/>, and from the
diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.bat b/Master/texmf-dist/doc/support/latexmk/latexmk.bat
index f119082adac..48e01d6e5e1 100755
--- a/Master/texmf-dist/doc/support/latexmk/latexmk.bat
+++ b/Master/texmf-dist/doc/support/latexmk/latexmk.bat
@@ -1,5 +1,5 @@
-Rem Execute latexmk.pl, searching for it in the PATH
-Rem Assume perl is in the PATH. If not, you should replace 'perl' by
-Rem the full pathname of the perl executable, e.g., 'C:\perl\bin\perl.exe'
-
-perl -S latexmk.pl %1 %2 %3 %4 %5 %6 %7 %8 %9
+Rem Execute latexmk.pl, searching for it in the PATH
+Rem Assume perl is in the PATH. If not, you should replace 'perl' by
+Rem the full pathname of the perl executable, e.g., 'C:\perl\bin\perl.exe'
+
+perl -S latexmk.pl %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf
index d804f857a68..2fd1f26f1fc 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 2248a598c3e..3c6e7197147 100644
--- a/Master/texmf-dist/doc/support/latexmk/latexmk.txt
+++ b/Master/texmf-dist/doc/support/latexmk/latexmk.txt
@@ -611,6 +611,12 @@ LATEXMK(1L) LATEXMK(1L)
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
+ these complications.)
+
You can do much more complicated things, but for this you will need to
consult a manual for the Perl programming language.
@@ -655,11 +661,6 @@ FORMAT OF COMMAND SPECIFICATIONS
%T The name of the primary tex file.
- 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
@@ -672,73 +673,93 @@ FORMAT OF COMMAND SPECIFICATIONS
LATEXMK(1L) LATEXMK(1L)
- bibliography file, the setting for the bibtex command should therefore
+ 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
+ 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 you the names of your 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
+ 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
be
$bibtex = 'bibtex %O %B';
- 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.
+ 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
- problem.
+ 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
- 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';
- Using MS-Windows file associations: A useful trick under modern ver-
- sions of MS-Windows (e.g., WinXP) is to use just the command
+ 10 April 2009 11
- $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
- 10 April 2009 11
+LATEXMK(1L) LATEXMK(1L)
+ 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';
-LATEXMK(1L) LATEXMK(1L)
+ Using MS-Windows file associations: A useful trick under modern ver-
+ sions of MS-Windows (e.g., WinXP) is to use just the command
+ $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
for a postscript viewer and a pdf viewer.)
Not using a certain command: If a command is not to be run, the command
@@ -746,45 +767,55 @@ 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';
- 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, so that the
- two commands to be run are separated by the semicolon in the middle of
+ This definition assumes you are using a UNIX-like system, so that the
+ two commands to be run are separated by the semicolon in the middle of
the string.
+
+ 10 April 2009 12
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
Default values are indicated in brackets.
$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
@@ -793,19 +824,7 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
$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
-
-
-
- 10 April 2009 12
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
+ 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.
@@ -814,19 +833,19 @@ LATEXMK(1L) LATEXMK(1L)
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.
+ 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:
@@ -836,166 +855,155 @@ 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 current
+ Important note: This variable is now mostly obsolete in the current
version of latexmk, since it has a better method of searching 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 @BIBIN-
- PUTS.
+ without the kpsewhich command, you may need to set the variable
- $bibtex ["bibtex %O %S"]
- The BibTeX processing program.
- $bibtex_silent_switch ["-terse"]
- Switch(es) for the BibTeX processing program when silent mode is
- on.
- $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
- first generation generated files.
+ 10 April 2009 13
- 10 April 2009 13
+LATEXMK(1L) LATEXMK(1L)
+ @BIBINPUTS.
+ $bibtex ["bibtex %O %S"]
+ The BibTeX processing program.
-LATEXMK(1L) LATEXMK(1L)
+ $bibtex_silent_switch ["-terse"]
+ Switch(es) for the BibTeX processing program when silent mode is
+ on.
+ $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
+ 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, -c1, or -C
- options. But there should be no need to set this variable from an RC
+ This variable is equivalent to specifying one of the -c, -c1, 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, -c1, or -C) is selected. The value of
+ Extra extensions of files for latexmk to remove when any of the
+ clean-up options (-c, -c1, or -C) is selected. The value of
this variable is a string containing the extensions separated by
spaces.
$clean_full_ext [""]
- Extra extensions of files for latexmk to remove when the -C
+ 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.
@cus_dep_list [()]
- Custom dependency list -- see section on "Custom Dependencies".
+ Custom dependency list -- see section on "Custom Dependencies".
@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
+ 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:
- @default_files = ("paper_current");
- @default_files = ("paper1", "paper2.tex");
- @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
- are because @default_files is an array variable, i.e., a
- sequence of filename specifications is possible.
+ 10 April 2009 14
- $dvi_filter [empty]
- The dvi file filter to be run on the newly produced dvi file
- before other processing. Equivalent to specifying the -dF
- 10 April 2009 14
+LATEXMK(1L) LATEXMK(1L)
+ @default_files = ("paper_current");
+ @default_files = ("paper1", "paper2.tex");
-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
+ are because @default_files is an array variable, i.e., a
+ sequence of filename specifications is possible.
+ $dvi_filter [empty]
+ 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
+ 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
+ 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.]
$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.
$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
-
10 April 2009 15
@@ -1007,61 +1015,64 @@ 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
+ 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.
$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,
+ 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
+ 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
+ options), and (b) in the determination of whether a rerun of
@@ -1074,37 +1085,44 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ (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, only
- exited becaues latexmk has a limit on the number of runs to
+ 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, only
+ exited 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.
@@ -1113,22 +1131,18 @@ 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
+ 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
+ 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.
$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 the file, but not its path is known. The program
- specified by $kpsewhich is used to find it.
-
+ The program called to locate a source file when the name alone
+ is not sufficient. Most filenames used by latexmk have
@@ -1141,40 +1155,44 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- See also the @BIBINPUTS variable for another way that latexmk
+ sufficient path information to be found directly. But some-
+ times, notably when 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
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
+ 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
+ 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
+ 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
- (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
+ (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' );
@@ -1183,19 +1201,18 @@ 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
- on. Under MS-Windows, the default value is changed to "-inter-
- action=batchmode -c-style-errors", as used by MikTeX and fpTeX.
-
+ Switch(es) for the LaTeX processing program when silent mode is
+ on. Under MS-Windows, the default value is changed to "-inter-
+ action=batchmode -c-style-errors", as used by MikTeX and fpTeX.
@@ -1211,19 +1228,19 @@ 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-
+ 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.
@@ -1233,13 +1250,13 @@ LATEXMK(1L) LATEXMK(1L)
$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
+ 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.
@@ -1249,20 +1266,23 @@ LATEXMK(1L) LATEXMK(1L)
The index processing program.
$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
+ The maximum number of times latexmk will run latex/pdflatex
+ before deciding that there may be an infinite loop and that it
needs to bail out, rather than rerunning latex/pdflatex again to
- resolve cross-references, etc. The default value covers all
+ resolve cross-references, etc. The default value covers all
normal cases.
- (Note that the "etc" covers a lot of cases where one run of
+ (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.)
$new_viewer_always [0]
- This variable applies to latexmk only in continuous-preview
+ This variable applies to latexmk only in continuous-preview
mode. If $new_viewer_always is 0, latexmk will check for a pre-
- viously running previewer on the same file, and if one is run-
- ning will not start a new one. If $new_viewer_always is non-
+ viously running previewer on the same file, and if one is run-
+ ning will not start a new one. If $new_viewer_always is non-
+ zero, this check will be skipped, and latexmk will behave as if
+ no viewer is running.
+
@@ -1275,42 +1295,39 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- zero, this check will be skipped, and latexmk will behave as if
- no viewer is running.
-
$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-
+ 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
+ able. If equal to 3, generate a pdf version of the document
from the dvi file, by using the command specified by the $dvipdf
variable.
Equivalent to the -pdf-, -pdf, -pdfdvi, -pdfps options.
$pdflatex ["pdflatex %O %S"]
- The LaTeX processing program in the version that makes a pdf
+ The LaTeX processing program in the version that makes a pdf
file instead of a dvi file.
%pdflatex_input_extensions
- This variable specifies the extensions tried by latexmk when it
- finds that a pdfLaTeX 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
+ This variable specifies the extensions tried by latexmk when it
+ finds that a pdfLaTeX 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 %pdflatex_input_extensions. The
+ 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
default extensions are
- (For Perl experts: %pdflatex_input_extensions is a hash whose
- keys are the extensions. The values are irrelevant.) Two sub-
- routines are provided for manipulating this and the related
- variable %latex_input_extensions, add_input_ext and
- remove_input_ext. They are used as in the following examples
+ (For Perl experts: %pdflatex_input_extensions is a hash whose
+ keys are the extensions. The values are irrelevant.) Two sub-
+ routines are provided for manipulating this and the related
+ variable %latex_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( 'pdflatex', 'tex' );
@@ -1319,17 +1336,23 @@ LATEXMK(1L) LATEXMK(1L)
add_input_ext( 'pdflatex', 'asdf' );
- add the extension 'asdf to pdflatex_input_extensions. (Natu-
- rally with such an extension, you should have made an appropri-
+ 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
- appropriate programming in the LaTeX source file to enable the
- file to be read. The standard extensions are handled by pdfla-
+ appropriate programming in the LaTeX source file to enable the
+ file to be read. The standard extensions are handled by pdfla-
tex and its graphics/graphicx packages.)
$pdflatex_silent_switch ["-interaction=batchmode"]
- Switch(es) for the pdflatex program (specified in the variable
+ Switch(es) for the pdflatex program (specified in the variable
$pdflatex when silent mode is on. Under MS-Windows, the default
+ value is changed to "-interaction=batchmode -c-style-errors", as
+ used by MikTeX and fpTeX.
+
+ $pdf_previewer ["start acroread %O %S"]
+ The command to invoke a pdf-previewer. [Default is changed to
+ "start" on MS-WINDOWS; under more recent versions of Windows,
@@ -1342,34 +1365,28 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- value is changed to "-interaction=batchmode -c-style-errors", as
- used by MikTeX and fpTeX.
-
- $pdf_previewer ["start acroread %O %S"]
- The command to invoke a pdf-previewer. [Default is changed to
- "start" on MS-WINDOWS; under more recent versions of Windows,
- this will cause to be run whatever command the system has asso-
+ this will cause to be run whatever command the system has asso-
ciated with .pdf files.]
WARNING: Potential problem under MS-Windows: if acroread is used
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
+ previewer if you use latexmk's previous-continuous mode (option
+ -pvc) under MS-windows. This problem does not occur if
ghostview, gv or gsview is used to view pdf files.
$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
+ 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.
$pdf_update_method [1 under UNIX, 3 under MS-Windows]
- How the pdf viewer updates its display when the pdf file has
- changed. See the information on the variable $dvi_update_method
+ How the pdf viewer updates its display when the pdf file has
+ changed. See the information on the variable $dvi_update_method
for the codes. (Note that information needs be changed slightly
- so that for the value 4, to run a command to do the update, the
- command is specified by the variable $pdf_update_command, and
- for the value 2, to specify update by signal, the signal is
+ so that for the value 4, to run a command to do the update, the
+ command is specified by the variable $pdf_update_command, and
+ for the value 2, to specify update by signal, the signal is
specified by $pdf_update_signal.)
Note that acroread under MS-Windows (but not UNIX) locks the pdf
@@ -1382,23 +1399,31 @@ LATEXMK(1L) LATEXMK(1L)
$pdf_update_method = 4;
$pdf_update_command = "xpdf -remote %R -reload";
- The first setting arranges for the xpdf program to be used in
- its "remote server mode", with the server name specified as the
- rootname of the TeX file. The second setting arranges for
+ The first setting arranges for the xpdf program to be used in
+ its "remote server mode", with the server name specified as the
+ rootname of the TeX file. The second setting arranges for
updating to be done in response to a command, and the third set-
ting sets the update command.
- $pdf_update_signal [Under UNIX: SIGHUP, which is a system-dependent
+ $pdf_update_signal [Under UNIX: SIGHUP, which is a system-dependent
value]
- The number of the signal that is sent to the pdf viewer when it
- is updated by sending a signal -- see the information on the
- variable $pdf_update_method. The default value is the one
+ The number of the signal that is sent to the pdf viewer when it
+ is updated by sending a signal -- see the information on the
+ variable $pdf_update_method. The default value is the one
appropriate for gv on a UNIX system.
$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.
+ The variable $pid_position is used to specify which word in
+ lines of the output from $pscmd corresponds to the process ID.
+ 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
+ to be used.
+
+ $postscript_mode [0]
+ If nonzero, generate a postscript version of the document.
+ Equivalent to the -ps option.
@@ -1411,115 +1436,120 @@ LATEXMK(1L) LATEXMK(1L)
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
- to be used.
-
- $postscript_mode [0]
- If nonzero, generate a postscript version of the document.
- Equivalent to the -ps option.
-
- If some other request is made for which a postscript file is needed,
+ If some other request is made for which a postscript file is needed,
then $postscript_mode will be set to 1.
$preview_continuous_mode [0]
- If nonzero, run a previewer to view the document, and continue
+ If nonzero, run a previewer to view the document, and continue
running latexmk to keep .dvi up-to-date. Equivalent to the -pvc
- option. Which previewer is run depends on the other settings,
+ option. Which previewer is run depends on the other settings,
see the command line options -view=, and the variable $view.
$preview_mode [0]
If nonzero, run a previewer to preview the document. Equivalent
- to the -pv option. Which previewer is run depends on the other
- settings, see the command line options -view=, and the variable
+ to the -pv option. Which previewer is run depends on the other
+ settings, see the command line options -view=, and the variable
$view.
$printout_mode [0]
- If nonzero, print the document using lpr. Equivalent to the -p
+ If nonzero, print the document using lpr. Equivalent to the -p
option. This is recommended not to be set from an RC file, oth-
erwise you could waste lots of paper.
$print_type = ["ps"]
- Type of file to printout: possibilities are "dvi", "none",
+ Type of file to printout: possibilities are "dvi", "none",
"pdf", or "ps".
$pscmd Command used to get all the processes currently run by the user.
- The -pvc option uses the command specified by the variable
- $pscmd to determine if there is an already running previewer,
- and to find the process ID (needed if latexmk needs to signal
+ The -pvc option uses the command specified by the variable
+ $pscmd to determine if there is an already running previewer,
+ and to find the process ID (needed if latexmk needs to signal
the previewer about file changes).
Each line of the output of this command is assumed to correspond
to one process. See the $pid_position variable for how the pro-
cess number is determined.
- The default for pscmd is "NONE" under MS-Windows and cygwin
+ The default for pscmd is "NONE" under MS-Windows and cygwin
(i.e., the command is not used), "ps --width 200 -f -u
- $ENV{USER}" under linux, "ps -ww -u $ENV{USER}" under darwin
- (Macintosh OS-X), and "ps -f -u $ENV{USER}" under other operat-
- ing systems (including other flavors of UNIX). In these speci-
+ $ENV{USER}" under linux, "ps -ww -u $ENV{USER}" under darwin
+ (Macintosh OS-X), and "ps -f -u $ENV{USER}" under other operat-
+ ing systems (including other flavors of UNIX). In these speci-
fications "$ENV{USER}" is substituted by the username.
$ps2pdf ["ps2pdf %O %S %D"]
Command to convert ps to pdf file.
$ps_filter [empty]
- The postscript file filter to be run on the newly produced
+ The postscript file filter to be run on the newly produced
postscript file before other processing. Equivalent to specify-
ing the -pF option.
+ $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.)
+ Note that gv could be used with the -watch option updates its
+ display whenever the postscript file changes, whereas ghostview
+ does not. However, different versions of gv have slightly dif-
+ ferent ways of writing this option. You can configure this
+ variable apppropriately.
- 10 April 2009 22
+ 10 April 2009 22
-LATEXMK(1L) LATEXMK(1L)
- $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.)
+LATEXMK(1L) LATEXMK(1L)
- Note that gv could be used with the -watch option updates its
- display whenever the postscript file changes, whereas ghostview
- does not. However, different versions of gv have slightly dif-
- ferent ways of writing this option. You can configure this
- variable apppropriately.
WARNING: Linux systems may have installed one (or more) versions
- of gv under different names, e.g., ggv, kghostview, etc, but
+ of gv under different names, e.g., ggv, kghostview, etc, but
perhaps not one called gv.
- $ps_previewer_landscape ["start gv -swap %O %S", but "start %O %S"
+ $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 [""]
- When the postscript previewer is set to be updated by running a
- command, this is the command that is run. See the information
+ When the postscript previewer is set to be updated by running a
+ command, this is the command that is run. See the information
for the variable $ps_update_method.
$ps_update_method [0 under UNIX, 1 under MS-Windows]
- How the postscript viewer updates its display when the ps file
- has changed. See the information on the variable
- $dvi_update_method for the codes. (Note that information needs
+ How the postscript viewer updates its display when the ps file
+ has changed. See the information on the variable
+ $dvi_update_method for the codes. (Note that information needs
be changed slightly so that for the value 4, to run a command to
do the update, the command is specified by the variable
- $ps_update_command, and for the value 2, to specify update by
+ $ps_update_command, and for the value 2, to specify update by
signal, the signal is specified by $ps_update_signal.)
- $ps_update_signal [Under UNIX: SIGHUP, which is a system-dependent
+ $ps_update_signal [Under UNIX: SIGHUP, which is a system-dependent
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
+ 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
default value is the one appropriate for gv on a UNIX system.
+ $quote_filenames [1]
+ This specifies whether substitutions for placeholders in command
+ specifications (as in $pdflatex) are surrounded by double
+ quotes. If this variable is 1 (or any other value Perl regards
+ as true), then quoting is done. Otherwise quoting is omitted.
+
+ The quoting method used by latexmk is tested to work correctly under
+ UNIX systems (including Linux and Mac OS-X) and under MS-Windows. It
+ allows the use of filenames containing special characters, notably
+ spaces. (But note that many versions of LaTeX and PdfLaTeX cannot cor-
+ rectly deal with TeX files whose names contain spaces. Latexmk's quot-
+ ing only ensures that such filenames are correctly treated by the oper-
+ ating system in passing arguments to programs.)
+
$sleep_time [2]
The time to sleep (in seconds) between checking for source file
changes when running the -pvc option.
@@ -1539,7 +1569,6 @@ LATEXMK(1L) LATEXMK(1L)
-
10 April 2009 23
@@ -1606,6 +1635,8 @@ CUSTOM DEPENDENCIES
It is invoked whenever latexmk detects that a run of latex/pdflatex
needs to read a file, like a graphics file, whose extension is the to-
+ extension of a custom dependency. Then latexmk examines whether a file
+ exists with the same name, but with the corresponding from-extension,
@@ -1618,8 +1649,6 @@ CUSTOM DEPENDENCIES
LATEXMK(1L) LATEXMK(1L)
- extension of a custom dependency. Then latexmk examines whether a file
- exists with the same name, but with the corresponding from-extension,
as specified in the custom-dependency rule. If it does, then whenever
the destination file (the one with the to-extension) is out-of-date
with respect to the corresponding source file.
@@ -1676,6 +1705,10 @@ LATEXMK(1L) LATEXMK(1L)
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
+
10 April 2009 25
@@ -1687,9 +1720,6 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- 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
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.
@@ -1744,6 +1774,11 @@ LATEXMK(1L) LATEXMK(1L)
be perpetually out-of-date. This situation, of circular dependencies,
is endemic to latex, and latexmk in its current version works correctly
with circular dependencies. It examines the contents of the files (by
+ use of an md5 checksum), and only does a remake when the file contents
+ have actually changed.
+
+ 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.
@@ -1756,11 +1791,6 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- use of an md5 checksum), and only does a remake when the file contents
- have actually changed.
-
- 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.
For real experts: See the %hash_cal_ignore_pattern if you have to deal
with such problems.
@@ -1815,6 +1845,13 @@ BUGS
THANKS TO
Authors of previous versions. Many users with their feedback, and
especially David Coppit (username david at node coppit.org) who made
+ many useful suggestions that contributed to version 3, and Herbert
+ Schulz. (Please note that the e-mail addresses are not written in
+ their standard form to avoid being harvested by worms and viruses.)
+
+AUTHOR
+ Current version, by John Collins (username collins at node
+ phys.psu.edu). (Version 4.05a).
@@ -1827,14 +1864,6 @@ THANKS TO
LATEXMK(1L) LATEXMK(1L)
- many useful suggestions that contributed to version 3, and Herbert
- Schulz. (Please note that the e-mail addresses are not written in
- their standard form to avoid being harvested by worms and viruses.)
-
-AUTHOR
- Current version, by John Collins (username collins at node
- phys.psu.edu). (Version 4.05).
-
Released version can be obtained from CTAN: <http://www.tug.org/tex-
archive/support/latexmk/>, and from the author's website
<http://www.phys.psu.edu/~collins/software/latexmk/>.
@@ -1889,6 +1918,16 @@ AUTHOR
+
+
+
+
+
+
+
+
+
+
10 April 2009 28
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl
index 9e7beb249a1..1b122c7e975 100755
--- a/Master/texmf-dist/scripts/latexmk/latexmk.pl
+++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl
@@ -140,8 +140,8 @@ use warnings;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.05';
-$version_details = "$My_name, John Collins, 10 April 2009";
+$version_num = '4.05b';
+$version_details = "$My_name, John Collins, 11 April 2009";
use Config;
@@ -210,6 +210,13 @@ else {
##
## Modification log for 24 Sep 2008 onwards in detail
##
+## 11 Apr 2009, John Collins Capture ctrl/C and ctrl/break during wait
+## loop in preview_continuous. Then
+## control stays within latexmk on break
+## from loop. It allows user to do
+## postprocessing, like
+## "latexmk -pvc file; cleanup;"
+## 10 Apr 2009, John Collins Safer use of % in placeholders in commands
## 10 Apr 2009, John Collins V. 4.05
## 3 Apr 2009, John Collins Change to a nicer #! line
## 26 Mar 2009, John Collins Case independence for one item in
@@ -2392,8 +2399,11 @@ CHANGE:
print "\n=== Watching for updated files. Use ctrl/C to stop ...\n";
}
$waiting = 1; if ($diagnostics) { warn "WAITING\n"; }
+ &catch_break;
+ $have_break = 0;
WAIT: while (1) {
sleep($sleep_time);
+ if ($have_break) { last WAIT; }
&rdb_clear_change_record;
rdb_recurseA( [@targets], \&rdb_flag_changes_here );
if ( &rdb_need_run ) {
@@ -2410,8 +2420,14 @@ CHANGE:
warn "$My_name: New file(s) found.\n";
last WAIT;
}
+ if ($have_break) { last WAIT; }
} # end WAIT:
- $waiting = 0; if ($diagnostics) { warn "NOT WAITING\n"; }
+ &default_break;
+ if ($have_break) {
+ print "$Latexmk: User typed ctrl/C or ctrl/break. I'll stop.\n";
+ exit;
+ }
+ $waiting = 0; if ($diagnostics) { warn "NOT WAITING\n"; }
} #end infinite_loop CHANGE:
} #END sub make_preview_continuousB
@@ -4625,14 +4641,23 @@ sub rdb_ext_cmd1 {
#Set character to surround filenames:
my $q = $quote_filenames ? '"' : '';
- foreach ($ext_cmd) {
- s/%O/$options/g;
- s/%R/$q$root_filename$q/g;
- s/%B/$q$base$q/g;
- s/%T/$q$texfile_name$q/g;
- s/%S/$q$source$q/g;
- s/%D/$q$dest$q/g;
+
+ %subst = (
+ '%O' => $options,
+ '%R' => $q.$root_filename.$q,
+ '%B' => $q.$base.$q,
+ '%T' => $q.$texfile_name.$q,
+ '%S' => $q.$source.$q,
+ '%D' => $q.$dest.$q,
+ '%%' => '%' # To allow literal %B, %R, etc, by %%B.
+ );
+
+ my @tokens = split /(%.)/, $ext_cmd;
+ foreach (@tokens) {
+ if (exists($subst{$_})) { $_ = $subst{$_}; }
}
+ $ext_cmd = join '', @tokens;
+
# print "quote is '$q'; ext_cmd = '$ext_cmd'\n";
my ($pid, $return) = &Run_msg($ext_cmd);
return $return;
@@ -6244,3 +6269,38 @@ sub finish_dir_stack {
#************************************************************
#************************************************************
+# Break handling routines (for wait-loop in preview continuous)
+
+sub end_wait {
+ # Handler for break: Set global variable $have_break to 1.
+ $signal = shift;
+ # Some systems (e.g., MSWin reset) appear to reset the handler.
+ # So I'll re-enable it
+ &catch_break;
+ $have_break = 1;
+}
+
+#========================
+
+sub catch_break {
+# Capture ctrl/C and ctrl/break.
+# $SIG{INT} corresponds to ctrl/C on LINUX/?UNIX and MSWin
+# $SIG{BREAK} corresponds to ctrl/break on MSWin, doesn't exist on LINUX
+ $SIG{INT} = \&end_wait;
+ if ( exists $SIG{BREAK} ) {
+ $SIG{BREAK} = \&end_wait;
+ }
+}
+
+#========================
+
+sub default_break {
+# Arrange for ctrl/C and ctrl/break to give default behavior
+ $SIG{INT} = 'DEFAULT';
+ if ( exists $SIG{BREAK} ) {
+ $SIG{BREAK} = 'DEFAULT';
+ }
+}
+
+#************************************************************
+#************************************************************