summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-11-22 00:03:01 +0000
committerKarl Berry <karl@freefriends.org>2013-11-22 00:03:01 +0000
commitf7eb2c6a23e6a15f86a636186d8bd77f16b2061d (patch)
tree64a683b7e93c8de9a577168e5d1be3c565adaed3
parent50936fcbf8d7c6fafc2b9e43b2b9ca4715d954f2 (diff)
latexmk (21nov13)
git-svn-id: svn://tug.org/texlive/trunk@32200 c570f23f-e606-0410-a88d-b1316a301751
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/glossaries/makeglossaries101
-rwxr-xr-xBuild/source/texk/texlive/linked_scripts/latexmk/latexmk.pl381
-rw-r--r--Master/texmf-dist/doc/man/man1/latexmk.133
-rw-r--r--Master/texmf-dist/doc/man/man1/latexmk.man1.pdfbin143313 -> 143562 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexmk/CHANGES26
-rw-r--r--Master/texmf-dist/doc/support/latexmk/INSTALL2
-rw-r--r--Master/texmf-dist/doc/support/latexmk/README6
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/clean_pattern_latexmkrc30
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc57
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/tex4ht-latexmkrc33
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.pdfbin131290 -> 131776 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.txt1117
-rwxr-xr-xMaster/texmf-dist/scripts/latexmk/latexmk.pl381
-rwxr-xr-xMaster/tlpkg/libexec/ctan2tds2
14 files changed, 1255 insertions, 914 deletions
diff --git a/Build/source/texk/texlive/linked_scripts/glossaries/makeglossaries b/Build/source/texk/texlive/linked_scripts/glossaries/makeglossaries
index 811848b5437..fc1082e176d 100755
--- a/Build/source/texk/texlive/linked_scripts/glossaries/makeglossaries
+++ b/Build/source/texk/texlive/linked_scripts/glossaries/makeglossaries
@@ -2,7 +2,7 @@
# File : makeglossaries
# Author : Nicola Talbot
-# Version : 2.07 (2013/06/17)
+# Version : 2.09 (2013/11/12)
# Description: simple Perl script that calls makeindex or xindy.
# Intended for use with "glossaries.sty" (saves having to remember
# all the various switches)
@@ -27,9 +27,13 @@
# glossary-super.sty, glossaries.perl.
# Also makeglossaries and makeglossaries.
-my $version="2.07 (2013-06-17)";
+my $version="2.09 (2013-11-12)";
# History:
+# v2.09 (2013-11-12):
+# * added check for -q switch when issuing warnings.
+# v2.08 (2013-10-14):
+# * added -x and -m options
# v2.07 (2013-06-17):
# * added check for success on chdir if -d used
# * added dialect map
@@ -84,8 +88,9 @@ use strict;
# v2.01 added the following line
use warnings;
# v2.05 added $opt_d
+# v2.08 added $opt_x and $opt_m
use vars qw($opt_q $opt_t $opt_o $opt_s $opt_p $opt_g $opt_c $opt_r
- $opt_l $opt_i $opt_L $opt_n $opt_C $opt_d);
+ $opt_l $opt_i $opt_L $opt_n $opt_C $opt_d $opt_x $opt_m);
$Getopt::Std::STANDARD_HELP_VERSION = 1;
@@ -94,7 +99,7 @@ $Getopt::Std::STANDARD_HELP_VERSION = 1;
# .tex file)
# v1.5 added -n (print the command that would be issued but
# don't actually run the command)
-getopts('s:o:t:p:L:C:ilqrcgnd:');
+getopts('s:o:t:p:L:C:ilqrcgnd:x:m:');
unless ($#ARGV == 0)
{
@@ -208,6 +213,11 @@ unless ($istfile)
"Did you remember to use \\makeglossaries?\n";
}
+# v2.08 added $xindyapp and $makeindexapp
+# By default assume they are on the operating system's path
+my $xindyapp = ($opt_x ? $opt_x :'xindy');
+my $makeindexapp = ($opt_m ? $opt_m :'makeindex');
+
# v1.5 save the general xindy switches
my $xdyopts = '';
@@ -371,12 +381,12 @@ if ($ext)
if ($usexindy)
{
&xindy("$name.$ext", $outfile, $transcript,$istfile,
- $thislang, $thiscodepage, $xdyopts, $opt_q, $opt_n);
+ $thislang, $thiscodepage, $xdyopts, $opt_q, $opt_n, $xindyapp);
}
else
{
&makeindex("$name.$ext",$outfile,$transcript,$istfile,
- $mkidxopts,$opt_q, $opt_n);
+ $mkidxopts,$opt_q, $opt_n, $makeindexapp);
}
}
else
@@ -406,15 +416,16 @@ else
# v1.6 added file existance test
unless (-e $inputfile)
{
+ # v2.09 suppress warning if -q switch in use
print "Warning: File '$inputfile' doesn't exist.\n",
- "*** Skipping glossary '$type'. ***\n";
+ "*** Skipping glossary '$type'. ***\n" unless ($opt_q);
next;
}
unless (-r $inputfile)
{
print "Warning: No read access for '$inputfile' $!\n",
- "*** Skipping glossary '$type'. ***\n";
+ "*** Skipping glossary '$type'. ***\n" unless ($opt_q);
next;
}
@@ -444,7 +455,8 @@ else
"don't want to use the main glossary.\n";
}
- warn $message;
+ # v2.09 suppress warning if -q switch in use
+ warn $message unless $opt_q;
# Write warning to transcript file.
@@ -480,12 +492,12 @@ else
{
&xindy($inputfile,$outfile,$transcript,$istfile,
$language{$type},$codepage{$type},
- $xdyopts,$opt_q,$opt_n);
+ $xdyopts,$opt_q,$opt_n, $xindyapp);
}
else
{
&makeindex($inputfile,$outfile,$transcript,
- $istfile,$mkidxopts,$opt_q,$opt_n);
+ $istfile,$mkidxopts,$opt_q,$opt_n, $makeindexapp);
}
}
}
@@ -661,15 +673,16 @@ sub run_app{
return ($status, $warnings, $errno);
}
+# v2.08 added $app parameter
sub makeindex{
- my($in,$out,$trans,$ist,$rest,$quiet,$dontexec) = @_;
+ my($in,$out,$trans,$ist,$rest,$quiet,$dontexec,$app) = @_;
my $args = "$rest -s \"$ist\" -t \"$trans\" -o \"$out\" \"$in\"";
# v2.01 replaced code with call to &run_app
my ($status, $warnings, $errno)
- = &run_app('makeindex', $args, $trans, $quiet, $dontexec);
+ = &run_app($app, $args, $trans, $quiet, $dontexec);
return if ($dontexec);
@@ -695,9 +708,10 @@ sub makeindex{
}
}
+# v2.08 added $app parameter
sub xindy{
my($in,$out,$trans,$ist,$language,$codepage,$rest,$quiet,
- $dontexec) = @_;
+ $dontexec, $app) = @_;
my($args, $langparam, $main, $retry);
my($module);
@@ -787,7 +801,7 @@ sub xindy{
# v2.01 replaced code with call to &run_app
my ($status, $warnings, $errno)
- = &run_app('xindy', $args, $trans, $quiet, $dontexec);
+ = &run_app($app, $args, $trans, $quiet, $dontexec);
return if ($dontexec);
@@ -935,30 +949,35 @@ sub xindy{
sub HELP_MESSAGE{
print "\nSyntax : makeglossaries [options] <filename>\n\n";
print "For use with the glossaries package to pass relevant\n";
- print "files to makeindex or xindy\n\n";
+ print "files to makeindex or xindy.\n\n";
print "<filename>\tBase name of glossary file(s). This should\n";
print "\t\tbe the name of your main LaTeX document without any\n";
print "\t\textension.\n";
- print "\n General Options:\n";
+ print "\nGeneral Options:\n\n";
print "-o <gls>\tUse <gls> as the output file.\n";
- print "-q\t\tQuiet mode\n";
- print "-s <sty>\tEmploy <sty> as the style file\n";
- print "-t <log>\tEmploy <log> as the transcript file\n";
- print "-d <directory>\tRun xindy/makeindex in <directory>\n";
+ print "-q\t\tQuiet mode.\n";
+ print "-s <sty>\tEmploy <sty> as the style file.\n";
+ print "-t <log>\tEmploy <log> as the transcript file.\n";
+ print "-d <directory>\tDirectory in which the .aux, .glo etc files are located.\n",
+ "\t\t(Default is the directory in which <filename> resides.)\n";
print "-n\t\tPrint the command that would normally be executed,\n",
- "\t\tbut don't execute it\n";
+ "\t\tbut don't execute it.\n";
- print "\n Xindy Options:\n";
+ print "\nXindy Options:\n\n";
print "-L <language>\tUse <language>.\n";
-
- print "\n Makeindex Options:\n";
- print "-c\t\tCompress intermediate blanks\n";
- print "-g\t\tEmploy German word ordering\n";
- print "-l\t\tLetter ordering\n";
- print "-p <num>\tSet the starting page number to be <num>\n";
- print "-r\t\tDisable implicit page range formation\n";
- print "\nSee makeindex documentation for further details on these ";
- print "options\n";
+ print "-x <file>\tFull path to xindy executable.\n",
+ "\t\t(Default assumes xindy is on the operating system's path.)\n";
+
+ print "\nMakeindex Options:\n";
+ print "(See makeindex documentation for further details on these ";
+ print "options.)\n\n";
+ print "-c\t\tCompress intermediate blanks.\n";
+ print "-g\t\tEmploy German word ordering.\n";
+ print "-l\t\tLetter ordering.\n";
+ print "-p <num>\tSet the starting page number to be <num>.\n";
+ print "-r\t\tDisable implicit page range formation.\n";
+ print "-m <file>\tFull path to makeindex executable.\n",
+ "\t\t(Default assumes makeindex is on the operating system's path.)\n";
}
sub VERSION_MESSAGE{
@@ -977,7 +996,8 @@ makeglossaries - Calls makeindex/xindy for LaTeX documents using glossaries pac
B<makeglossaries> [B<-o> I<file>] [B<-q>] [B<-s> I<file>]
[B<-t> I<file>] [B<-L> I<language>] [B<-c>] [B<-g>] [B<-l>]
-[B<-p> I<num>] [B<-r>] [B<--version>] [B<--help>] I<filename>
+[B<-p> I<num>] [B<-r>] [B<-d> I<aux dir>] [B<-m> I<file>] [B<-x> I<file>]
+[B<--version>] [B<--help>] I<filename>
=head1 DESCRIPTION
@@ -1039,6 +1059,21 @@ Sets the starting page number to be I<num> (B<makeindex> only).
Disable implicit page range formation (B<makeindex> only).
+=item B<-d> I<aux dir>
+
+Specify the directory the .aux, .glo etc files are located.
+Defaults to the parent directory of the base file I<filename>.
+
+=item B<-m> I<file>
+
+Specify the full path name for B<makeindex> to I<file> in the
+event that B<makeindex> isn't on the operating system's path.
+
+=item B<-x> I<file>
+
+Specify the full path name for B<xindy> to I<file> in the
+event that B<xindy> isn't on the operating system's path.
+
=item B<--version>
Prints version number and exits.
diff --git a/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl b/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
index e27ced4d9eb..95f302d82a1 100755
--- a/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
+++ b/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
@@ -111,12 +111,14 @@ use warnings;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.37';
-$version_details = "$My_name, John Collins, 2 July 2013";
+$version_num = '4.39';
+$version_details = "$My_name, John Collins, 10 Nov 2013";
use Config;
-use File::Copy;
use File::Basename;
+use File::Copy;
+use File::Glob ':glob'; # Better glob. Does not use space as item separator.
+use File::Path 2.08 qw( make_path );
use FileHandle;
use File::Find;
use List::Util qw( max );
@@ -135,7 +137,7 @@ use vars qw( $dvi_update_command $ps_update_command $pdf_update_command );
@signame = ();
if ( defined $Config{sig_name} ) {
$i = 0;
- foreach $name (split(' ', $Config{sig_name})) {
+ foreach $name (split('\s+', $Config{sig_name})) {
$signo{$name} = $i;
$signame[$i] = $name;
$i++;
@@ -182,131 +184,38 @@ else {
## Modification log from 9 Dec 2011 onwards in detail
##
## 12 Jan 2012 STILL NEED TO DOCUMENT some items below
-## 2 Jul 2013 John Collins V. 4.37
-## 1 Jul 2013 John Collins Correct bug that gave fatal error when the
-## name of current directory contains a
-## character with special meaning in a regexp.
-## 24 May 2013 John Collins Break in pvc returns to main program rather than
-## halting. Thus -rules option now works with -pvc.
-## 24 May 2013 John Collins File specifications in $clean_ext and
-## $clean_full_ext are allowed wildcards
-## 2 May 2013 John Collins TRY to fix problem when extension .bib in \bibliography,
-## as in \bibliography{references.bib}.
-## WHAT IS CORRECT BEHAVIOR OF sub find_file_list1?
-## Must test bibtex in all conditions on bst and bib files
-## regarding extensions
-## 28 Apr 2013 John Collins Warnings when rc file is a directory instead
-## of a file.
-## 24 Apr 2013 John Collins Add -lualatex option, like -xelatex
-## 9 Apr 2013 John Collins Correction of misleading variable names
-## in rdb_create_rule
-## 1 Apr 2013 John Collins Minor correction of misprint in comment
-## 26 Dec 2012 John Collins Correct diagnostics ("MakeB" --> "Make")
-## Rename @one_time to @unusual_one_time
-## to indicate this array is about inner-level
-## one_time rules, of which there are normally
-## none.
-## Fix diagnostics on one-time rules, to include
-## separately inner- and outer-level rules
-## Fix non-call of viewer when $force_mode on.
-## Remove some unused code
-## 14 Nov 2012 John Collins Correction on copying of fls (with MiKTeX)
-## 13 Nov 2012 John Collins V. 4.36
-## Remove redundant call to normalize_filename
-## in rdb_set_latex_deps
-## Set BIBINPUTS to include aux_dir.
-## This corrects a bug when
-## revtex4-1 is used with footnotes
-## in the bibliography: Previously
-## latexmk failed to run bibtex
-## because of a not-found bibfile
-## when the bibfile is in aux_dir
-## (or out_dir).
-## 11 Nov 2012 John Collins V. 4.35
-## Correct bug that under some combinations of
-## MS-Windows, cygwin and distributions of
-## TeX, line endings in fls file (CRLF v. LF)
-## were misparsed, resulting in source
-## filenames that incorrectly contained CR
-## characters.
-## Correct bug that when --gg mode is on, the
-## rule database contained items from the OLD
-## fdb file. Using --gg mode implies that
-## the rules in the OLD fdb file must be
-## ignored (since they may be wrong).
-## 1 Oct 2012 John Collins V. 4.34
-## Correct problem that if a file is read by
-## latex only after being written, it is
-## not a true source file.
-## 19 Aug 2012 John Collins V. 4.33c
-## Correct infinite loop when maximum passes
-## exceeded.
-## Improve error messages
-## 12 Aug 2012 John Collins V. 4.33b
-## Improve text displayed by -showextraoptions
-## 8 Aug 2012 John Collins V. 4.33a
-## Fix problem that with Cygwin,
-## latexmk runs very slowly, because
-## subroutine good_cwd() runs the
-## program cygpath on every
-## invocation. Solution: cach cwd.
-## 6 Aug 2012 John Collins Version number to 4.33
-## 4 Aug 2012 John Collins Further fixes of filename treatment:
-## normalize_filename routine to remove
-## string for current directory, and
-## convert '\' directory separator to '/'
-## (Note MiKTeX uses BOTH, see e.g., its
-## log file, so MSWin systems are NOT
-## guaranteed to be consistent. But latexmk
-## needs to treat filenames differing by
-## change of directory separator as equivalent.
-## Warning: SOME MWWin programs, e.g., current
-## cmd.exe (as tested yesterday on PSU computer
-## in library) do not accept '/' as directory
-## separator, so it may be worth allowing conversion
-## to '\' in executed files.)
-## Also improve running when $silent is on:
-## don't print warnings about undefined references
-## and citations, but simply display a summary, whose
-## criterion for being shown had to be fixed.
-## 3 Aug 2012 John Collins Fix finding of files in aux-dir
-## 1 Aug 2012 John Collins Handle aliasing of cwd in output file
-## to avoid unnecessary warnings about
-## actual o/p file .ne. expected with MiKTeX
-## Clean up subroutine names:
-## parse_logB to parse_log
-## make_preview_continuousB to make_preview_continuous
-## rdb_find_new_filesB to rdb_find_new_files
-## rdb_set_dependentsA to rdb_set_dependents
-## rdb_makeB to rdb_make
-## rdb_makeB1 to rdb_make1
-## rdb_one_depA to rdb_one_dep
-## rdb_recurseA to rdb_recurse
-## rdb_update_filesA to rdb_update_files
-## 28, 29, 30 Jul 2012 John Collins Try better file-name normalization in reading fls file.
-## 18 Jul 2012 John Collins Change ver. to 4.32d.
-## Merge changes from 29 June 2012:
-## Add $dvipdf_silent_switch
-## 17 Jul 2012 John Collins Try better fix for error/rerun and retest issue.
-## Now rdb_primary_run doesn't have so many complications
-## rdb_makeB's PASS loop is simpler
-## rdb_submakeB is unneeded.
-## See the lines starting #??
-## See comments nearby
-## Compare w/ v. 4.32a
-## V. 4.32b
-## 17 Jul 2012 John Collins Fix problem that after finding error in a run
-## of (pdf)latex, latexmk didn't check for
-## changed files before giving up.
-## To do that, I reverted some changes in
-## rdb_primary_run to pre v. 4.31
-## Remove unused code
-## v. 4.32a
-## 8 May 2012 John Collins Possibility to substitute backslashes for
-## forward slashes in file and directory
-## names in executed command line,
-## for MSWin
-## 5 May 2012 John Collins Comment on ctrl/C handling in WAIT loop
+## 10 Nov 2013 John Collins Change split / /, ... to split /\s*/, ...
+## so as to be immune from extra white space.
+## Clean up $clean_ext and $clean_full_ext by removing
+## superfluous white space.
+## 8 Nov 2013 John Collins Automatic creation of necessary
+## subdirectories of auxdir when
+## needed for writing aux files.
+## 3 Nov 2013 John Collins Correction to 1 Nov
+## 1 Nov 2013 John Collins Add error diagnostics to if_source.
+## Allow $print_type = 'auto', and make
+## this the default.
+## 30 Oct 2013 John Collins Do better fix for dealing with special
+## characters in directory names used in
+## regexes. Use \Q \E. There are three
+## occurences of the issue.
+## Fix potential problem with globbing when
+## a specified (i.e., non-wildcarded) part
+## of the pattern has glob metacharacters.
+## Use File::Glob to give glob that doesn't
+## take space character as item separator.
+## 16 Oct 2013 John Collins Use make_path from File::Path instead of
+## mkdir to give autocreation of intermediate
+## directories.
+## This gives dependency on File::Path
+## 19 Jul 2013 John Collins V. 4.39.
+## In output of dependencies, include pathname of
+## target file(s) in the rule.
+## 19 Jul 2013 John Collins V. 4.38.
+## In -pvc mode, writing of deps file (caused by
+## -M option) is per make not per overall run.
+## %extra_rule_spec variable as hook for templates
+## for new rules.
##
## 1998-2010, John Collins. Many improvements and fixes.
## See CHANGE-log.txt for full list, and CHANGES for summary
@@ -445,6 +354,13 @@ $log_wrap = 79;
# are of a fixed size (as with a date/time stamp).
%hash_calc_ignore_pattern =();
+
+# Specification of templates for extra rules.
+# See subroutine rdb_make_rule_list for examples of rule templates.
+# See subroutine rdb_set_rules for how they get used to construct rules.
+# (Documentation obviously needs to be improved!)
+%extra_rule_spec = ();
+
#########################################################################
## Default document processing programs, and related settings,
## These are mostly the same on all systems.
@@ -669,8 +585,10 @@ $kpsewhich = 'kpsewhich %S';
$make = 'make';
##Printing:
-$print_type = 'ps'; # When printing, print the postscript file.
- # Possible values: 'dvi', 'ps', 'pdf', 'none'
+$print_type = 'auto'; # When printing, print the postscript file.
+ # Possible values: 'dvi', 'ps', 'pdf', 'auto', 'none'
+ # 'auto' ==> set print type according to the printable
+ # file(s) being made: priority 'ps', 'pdf', 'dvi'
## Which treatment of default extensions and filenames with
## multiple extensions is used, for given filename on
@@ -691,6 +609,8 @@ $dvi_update_command = undef;
$ps_update_command = undef;
$pdf_update_command = undef;
+$allow_subdir_creation = 1;
+
$new_viewer_always = 0; # If 1, always open a new viewer in pvc mode.
# If 0, only open a new viewer if no previous
# viewer for the same file is detected.
@@ -1629,7 +1549,7 @@ while ($_ = $ARGV[0])
elsif (/^-pdfps$/) { $pdf_mode = 2; }
elsif (/^-print=(.*)$/) {
$value = $1;
- if ( $value =~ /^dvi$|^ps$|^pdf$/ ) {
+ if ( $value =~ /^dvi$|^ps$|^pdf$|^auto$/ ) {
$print_type = $value;
$printout_mode = 1;
}
@@ -1818,7 +1738,7 @@ if ($bibtex_use > 1) {
# Since $texfile_search is initialized to "", a nonzero value indicates
# that an initialization file has set it.
if ( $texfile_search ne "" ) {
- @default_files = split / /, "*.tex $texfile_search";
+ @default_files = split /\s+/, "*.tex $texfile_search";
}
#Glob the filenames command line if the script was not invoked under a
@@ -1966,7 +1886,7 @@ if ( $out_dir ) {
if ( ! -e $out_dir ) {
warn "$My_name: making output directory '$out_dir'\n"
if ! $silent;
- mkdir $out_dir;
+ make_path $out_dir;
}
elsif ( ! -d $out_dir ) {
warn "$My_name: you requested output directory '$out_dir',\n",
@@ -1983,7 +1903,7 @@ if ( $aux_dir && ($aux_dir ne $out_dir) ) {
if ( ! -e $aux_dir ) {
warn "$My_name: making auxiliary directory '$aux_dir'\n"
if ! $silent;
- mkdir $aux_dir;
+ make_path $aux_dir;
}
elsif ( ! -d $aux_dir ) {
warn "$My_name: you requested aux directory '$aux_dir',\n",
@@ -2036,7 +1956,18 @@ if ( $postscript_mode ) {
$requested_filerules{'latex'} = 1;
$requested_filerules{'dvips'} = 1;
}
-if ( $printout_mode ) { $one_time{'print'} = 1; }
+if ($print_type eq 'auto') {
+ if ( $postscript_mode ) { $print_type = 'ps'; }
+ elsif ( $pdf_mode ) { $print_type = 'pdf'; }
+ elsif ( $dvi_mode ) { $print_type = 'dvi'; }
+ else { $print_type = 'none'; }
+}
+if ( $printout_mode ) {
+ $one_time{'print'} = 1;
+ if ($print_type eq 'none'){
+ warn "$My_name: You have requested printout, but \$print_type is set to 'none'\n";
+ }
+}
if ( $preview_continuous_mode || $preview_mode ) { $one_time{'view'} = 1; }
if ( length($dvi_filter) != 0 ) { $requested_filerules{'dvi_filter'} = 1; }
if ( length($ps_filter) != 0 ) { $requested_filerules{'ps_filter'} = 1; }
@@ -2103,13 +2034,24 @@ if ($deps_file eq '' ) {
$deps_file = '-';
}
-if ( $dependents_list ) {
+# In non-pvc mode, the dependency list is global to all processed TeX files,
+# so we open a single file here, and add items to it after processing each file
+# But in -pvc mode, the dependency list should be written after round of
+# processing the single TeX file (as if each round were a separate run of
+# latexmk). There's undoubtedly some non-optimal structuring here!
+if ( $dependents_list && ! $preview_continuous_mode ) {
$deps_handle = new FileHandle "> $deps_file";
if (! defined $deps_handle ) {
die "Cannot open '$deps_file' for output of dependency information\n";
}
}
+# Remove leading and trailing space in the following space-separated lists,
+# and collapse multiple spaces to one,
+# to avoid getting incorrect blank items when they are split.
+foreach ($clean_ext, $clean_full_ext) { s/^\s+//; s/\s+$//; s/\s+/ /g; }
+
+
FILE:
foreach $filename ( @file_list )
{
@@ -2158,7 +2100,7 @@ foreach $filename ( @file_list )
# ?? Should I also initialize file database?
%rule_list = ();
&rdb_make_rule_list;
- &rdb_set_rules(\%rule_list);
+ &rdb_set_rules(\%rule_list, \%extra_rule_spec );
if ( $cleanup_mode > 0 ) {
# ?? MAY NEED TO FIX THE FOLLOWING IF $aux_dir or $out_dir IS SET.
@@ -2241,7 +2183,7 @@ foreach $filename ( @file_list )
keys %other_generated );
}
&cleanup1( $aux_dir1, $fdb_ext, 'blg', 'ilg', 'log', 'aux.bak', 'idx.bak',
- split(' ',$clean_ext),
+ split('\s+',$clean_ext),
keys %generated_exts_all
);
unlink_or_move( 'texput.log', "texput.aux",
@@ -2255,7 +2197,7 @@ foreach $filename ( @file_list )
}
if ( $cleanup_mode == 1 ) {
&cleanup1( $out_dir1, 'dvi', 'dviF', 'ps', 'psF', 'pdf',
- split(' ', $clean_full_ext)
+ split('\s+', $clean_full_ext)
);
}
}
@@ -2369,7 +2311,7 @@ foreach $filename ( @file_list )
if ($failure > 0) { next FILE; }
} # end FILE
continue {
- if ($dependents_list) { deps_list($deps_handle); }
+ if ($deps_handle) { deps_list($deps_handle); }
# If requested, print the list of rules. But don't do this in -pvc
# mode, since the rules list has already been printed.
if ($rules_list && ! $preview_continuous_mode) { rdb_list(); }
@@ -2481,6 +2423,7 @@ sub add_option {
#############################################################
sub rdb_make_rule_list {
+# Set up specifications for standard rules, adjusted to current conditions
# Substitutions: %S = source, %D = dest, %B = this rule's base
# %T = texfile, %R = root = base for latex.
# %Y for $aux_dir1, %Z for $out_dir1
@@ -2498,7 +2441,7 @@ sub rdb_make_rule_list {
}
my $print_file = '';
- my $print_cmd = '';
+ my $print_cmd = 'NONE';
if ( $print_type eq 'dvi' ) {
$print_file = $dvi_final;
$print_cmd = $lpr_dvi;
@@ -2511,6 +2454,9 @@ sub rdb_make_rule_list {
$print_file = $ps_final;
$print_cmd = $lpr;
}
+ elsif ( $print_type eq 'none' ) {
+ $print_cmd = 'NONE echo NO PRINTING CONFIGURED';
+ }
my $view_file = '';
my $viewer = '';
@@ -2798,6 +2744,7 @@ sub if_source {
return &Run_subst();
}
else {
+ warn "Needed source file '$$Psource' does not exist.\n";
return -1;
}
} #END if_source
@@ -3042,6 +2989,16 @@ CHANGE:
rdb_show_rule_errors();
if ($rules_list) { rdb_list(); }
if ($show_time && ! $first_time) { show_timing(); }
+ if ( $dependents_list && ($updated || $failure) ) {
+ my $deps_handle = new FileHandle "> $deps_file";
+ if ( defined $deps_handle ) {
+ deps_list($deps_handle);
+ close($deps_handle);
+ }
+ else {
+ warn "Cannot open '$deps_file' for output of dependency information\n";
+ }
+ }
if ( $first_time || $updated || $failure ) {
print "\n=== Watching for updated files. Use ctrl/C to stop ...\n";
}
@@ -3170,7 +3127,10 @@ sub execute_code_string {
sub cleanup1 {
# Usage: cleanup1( directory, exts_without_period, ... )
- my $dir = shift;
+ #
+ # The directory is a fixed name, so I must escape any glob metacharacters
+ # in it:
+ my $dir = fix_pattern( shift );
foreach (@_) {
(my $name = /%R/ ? $_ : "%R.$_") =~ s/%R/$dir$root_filename/;
unlink_or_move( glob( "$name" ) );
@@ -3408,8 +3368,8 @@ sub print_help
} #END print_help
#************************************************************
-sub print_commands
-{
+
+sub print_commands {
warn "Commands used by $my_name:\n",
" To run latex, I use \"$latex\"\n",
" To run pdflatex, I use \"$pdflatex\"\n",
@@ -3570,7 +3530,9 @@ sub check_biber_log {
sub run_bibtex {
my $return = 999;
if ( $aux_dir ) {
- if ( $$Psource =~ /^$aux_dir1/ ) {
+ # Use \Q and \E round directory name in regex to avoid interpretation
+ # of metacharacters in directory name:
+ if ( $$Psource =~ /^\Q$aux_dir1\E/ ) {
# Run bibtex in $aux_dir, fixing input search path
# to allow for finding files in original directory
my ( $base, $path, $ext ) = fileparseA( $$Psource );
@@ -3717,6 +3679,12 @@ sub parse_log {
# %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.
+# @missing_subdirs = list of needed subdirectories of aux_dir
+# These are needed for writing aux_files when an included file is in
+# a subdirectory relative to the directory of the main TeX file.
+# This variable is only set when the needed subdirectories don't exist,
+# and the aux_dir is non-trivial, which results in an error message in
+# the log file
# Also set
# $reference_changed, $bad_reference, $bad_citation
# Trivial or default values if log file does not exist/cannot be opened
@@ -3739,6 +3707,8 @@ sub parse_log {
%idx_files = (); # Maps idx_file to (ind_file, base)
%generated_log = ();
%conversions = ();
+ @missing_subdirs = ();
+
# $primary_out is actual output file (dvi or pdf)
# It is initialized before the call to this routine, to ensure
# a sensible default in case of misparsing
@@ -4012,6 +3982,24 @@ LINE:
if (/^\! LaTeX Error: / ) {
next LINE;
}
+ if ( m[^! I can't write on file `(.*)/([^/']*)'.\s*$] ) {
+ my $dir = $1;
+ my $file = $2;
+ my $full_dir = $aux_dir1.$dir;
+ if ( ($aux_dir ne '') && (! -e $full_dir) && ( $file =~ /\.aux$/) ) {
+ warn "$My_name: === There were problems writing to '$file' in '$full_dir'\n",
+ " I'll try to make the subdirectory later.\n"
+ if $diagnostics;
+ push @missing_subdirs, $full_dir;
+ }
+ else {
+ warn "$My_name: ====== There were problems writing to",
+ "----- '$file' in '$full_dir'.\n",
+ "----- But this is not the standard situation of\n",
+ "----- aux file to subdir of output directory, with\n",
+ "----- non-existent subdir\n",
+ }
+ }
INCLUDE_CANDIDATE:
while ( /\((.*$)/ ) {
# Filename found by
@@ -4392,13 +4380,10 @@ sub normalize_filename {
# Remove current directory string:
$file =~ s(^\./)();
- # It would be natural to use a regexp to do the replacement of cwd:
- # $file =~ s(^$cwd/)();
- # But the string in $cwd may contain characters that have special
- # meaning in a regexp. So we must do it the hard way:
- if ( substr( $file, 0, length($cwd)+1 ) eq $cwd.'/' ) {
- $file = substr( $file, length($cwd)+1 );
- }
+ # Remove initial component equal to current working directory.
+ # Use \Q and \E round directory name in regex to avoid interpretation
+ # of metacharacters in directory name:
+ $file =~ s(^\Q$cwd\E/)();
return $file;
}
@@ -4413,6 +4398,17 @@ sub normalize_clean_filename {
#************************************************************
+sub fix_pattern {
+ # Escape the characters [ and {, to give a pattern for use in glob
+ # with these characters taken literally.
+ my $pattern = shift;
+ $pattern =~ s/\[/\\\[/g;
+ $pattern =~ s/\{/\\\{/g;
+ return $pattern;
+}
+
+#************************************************************
+
sub OS_preferred_filename {
# Usage: OS_preferred_filename(name)
# Returns filename with directory separator '/' converted
@@ -4715,7 +4711,7 @@ LINE:
$dest = "$base.$toext";
my $PAnew_cmd = ['do_cusdep', ''];
foreach my $dep ( @cus_dep_list ) {
- my ($tryfromext,$trytoext,$must,$func_name) = split(' ',$dep);
+ my ($tryfromext,$trytoext,$must,$func_name) = split('\s+',$dep);
if ( ($tryfromext eq $fromext) && ($trytoext eq $toext) ) {
$$PAnew_cmd[1] = $func_name;
}
@@ -4924,10 +4920,49 @@ sub rdb_set_latex_deps {
local %conversions = (); # (pdf)latex-performed conversions.
# Maps output file created and read by (pdf)latex
# to source file of conversion.
+ local @missing_subdirs = (); # Missing subdirectories in aux_dir
+
# The following are also returned, but are global, to be used by caller
# $reference_changed, $bad_reference $bad_citation
&parse_log;
+ $missing_dirs = 'none'; # Status of missing directories
+ if (@missing_subdirs) {
+ $missing_dirs = 'success';
+ if ($allow_subdir_creation) {
+ foreach my $dir ( uniqs( @missing_subdirs ) ) {
+ if ( -d $dir ) {
+ $missing_dirs = 'failure';
+ warn "$My_name: ==== Directory '$dir' is said to be missing\n",
+ " But it exists!\n";
+ }
+ elsif ( (-e $dir) && (!-d $dir) ) {
+ $missing_dirs = 'failure';
+ warn "$My_name: ==== Directory '$dir' is said to be missing\n",
+ " But a non-directory file of this name exists!\n";
+ }
+ else {
+ if (mkdir $dir) {
+ warn "$My_name: Directory '$dir' created\n";
+ }
+ else {
+ $missing_dirs = 'failure';
+ warn "$My_name: Couldn't create directory '$dir'.\n",
+ " System error: '$!'\n";
+ }
+ }
+ }
+ }
+ else {
+ $missing_dirs = 'not allowed';
+ warn "$My_name: There are missing subdirectories, but their creation\n",
+ " is not allowed. The subdirectories are:\n";
+ foreach my $dir ( uniqs( @missing_subdirs ) ) {
+ warn " '$dir'\n";
+ }
+ }
+ }
+
my $fls_file = "$aux_dir1$root_filename.fls";
if ($recorder && test_gen_file($fls_file) ) {
parse_fls( $fls_file, \%source_fls, \%generated_fls, \%first_read_after_write );
@@ -5184,7 +5219,7 @@ MISSING_FILE:
}
if ( $ext ne "" ) {
foreach my $dep (@cus_dep_list){
- my ($fromext,$toext) = split(' ',$dep);
+ my ($fromext,$toext) = split('\s+',$dep);
if ( ( "$ext" eq "$toext" )
&& ( -e "$path$base.$fromext" )
) {
@@ -5203,7 +5238,7 @@ MISSING_FILE:
# $_ doesn't exist, $_.tex doesn't exist,
# and $_ doesn't have an extension
foreach my $dep (@cus_dep_list){
- my ($fromext,$toext) = split(' ',$dep);
+ my ($fromext,$toext) = split('\s+',$dep);
if ( -e "$path$base.$fromext" ) {
# Source file for the missing file exists
# So we have a real include file, and it will be made
@@ -5291,7 +5326,7 @@ sub rdb_one_dep {
my $Pinput_extensions = $input_extensions{$rule};
DEP:
foreach my $dep ( @cus_dep_list ) {
- my ($fromext,$proptoext,$must,$func_name) = split(' ',$dep);
+ my ($fromext,$proptoext,$must,$func_name) = split('\s+',$dep);
if ( $toext eq $proptoext ) {
my $source = "$base_name.$fromext";
# Found match of rule
@@ -5439,10 +5474,10 @@ sub deps_list {
# List dependent files to file open on fh
my $fh = $_[0];
print $fh "#===Dependents for $filename:\n";
- my @dest = ();
- if ($pdf_mode) {push @dest, '.pdf';}
- if ($dvi_mode) {push @dest, '.dvi';}
- if ($postscript_mode) {push @dest, '.ps';}
+ my @dest_exts = ();
+ if ($pdf_mode) {push @dest_exts, '.pdf';}
+ if ($dvi_mode) {push @dest_exts, '.dvi';}
+ if ($postscript_mode) {push @dest_exts, '.ps';}
my %source = ( $texfile_name => 1 );
my @generated = ();
my @accessible_all = rdb_accessible( keys %requested_filerules );
@@ -5461,11 +5496,11 @@ sub deps_list {
foreach (@generated) {
delete $source{$_};
}
- foreach my $dest (@dest) {
+ foreach my $ext (@dest_exts) {
if ($deps_file eq '-' ) {
- print $fh "$root_filename$dest :";
+ print $fh "${out_dir1}${root_filename}${ext} :";
} else {
- print $fh "$root_filename$dest $deps_file :";
+ print $fh "${out_dir1}${root_filename}${ext} $deps_file :";
}
foreach (sort keys %source) {
print $fh "\\\n $_";
@@ -7227,14 +7262,10 @@ sub glob_list1 {
my @globbed = ();
foreach my $file_spec (@_) {
# Problem, when the PATTERN contains spaces, the space(s) are
- # treated as pattern separaters (in MSWin at least).
- # MSWin: I can quote the pattern (is that MSWin native, or also
- # cygwin?)
- # Linux: Quotes in a pattern are treated as part of the filename!
- # So quoting a pattern is definitively wrong.
- # The following hack solves this partly, for the cases that there is no wildcarding
- # and the specified file exists possibly space-containing, and that there is wildcarding,
- # but spaces are prohibited.
+ # treated as pattern separaters.
+ # Solution: I now the glob from use File::Glob.
+ # The following hack avoids issues with glob in the case that a file exists
+ # with the specified name (possibly with extension .tex):
if ( -e $file_spec || -e "$file_spec.tex" ) {
# Non-globbed file exists, return the file_spec.
# Return $file_spec only because this is not a file-finding subroutine, but
@@ -7612,7 +7643,9 @@ sub remove_cus_dep {
my ($from_ext, $to_ext) = @_;
my $i = 0;
while ($i <= $#cus_dep_list) {
- if ( $cus_dep_list[$i] =~ /^$from_ext $to_ext / ) {
+ # Use \Q and \E round directory name in regex to avoid interpretation
+ # of metacharacters in directory name:
+ if ( $cus_dep_list[$i] =~ /^\Q$from_ext $to_ext \E/ ) {
splice @cus_dep_list, $i, 1;
}
else {
@@ -8064,7 +8097,7 @@ sub find_process_id {
shift(@ps_output); # Discard the header line from ps
foreach (@ps_output) {
next unless ( /$looking_for/ ) ;
- my @ps_line = split (' ');
+ my @ps_line = split ('\s+');
# OLD return($ps_line[$pid_position]);
push @found, $ps_line[$pid_position];
}
diff --git a/Master/texmf-dist/doc/man/man1/latexmk.1 b/Master/texmf-dist/doc/man/man1/latexmk.1
index 0a64141cebd..eba70f11923 100644
--- a/Master/texmf-dist/doc/man/man1/latexmk.1
+++ b/Master/texmf-dist/doc/man/man1/latexmk.1
@@ -1,4 +1,4 @@
-.TH LATEXMK 1L "2 July 2013" ""
+.TH LATEXMK 1L "10 November 2013" ""
.SH NAME
latexmk \- generate LaTeX document
.SH SYNOPSIS
@@ -563,14 +563,16 @@ directory names are suitable.
.TP
.B -p
-Print out the document. By default it is
-the generated postscript file that is printed. But you can use the
-\fB-print=...\fR option to print the dvi or pdf files instead, and you
+Print out the document. By default the file to be printed is
+the first in the list postscript, pdf, dvi that is being made.
+But you can use the
+\fB-print=...\fR option to change the type of file to be printed, and you
can configure this in a start up file (by setting the
\fI$print_type\fR variable).
However, printing is enabled by default only under UNIX/LINUX systems,
-where the default is to use the lpr command. In general, the correct
+where the default is to use the lpr command and only on postscript
+files. In general, the correct
behavior for printing very much depends on your system's software. In
particular, under MS-Windows you must have suitable program(s)
available, and you must have configured the print commands used by
@@ -634,10 +636,15 @@ Note that the effect of this option can also be achieved by using
the \fB-e\fR option with a suitable line of Perl code to set the
\fI$pdflatex\fR variable. See the explanation of the \fB-e\fR option.
.TP
-.B -print=dvi, -print=ps, -print=pdf
+.B -print=dvi, -print=ps, -print=pdf, -print=auto,
Define which kind of file is printed. This option also ensures that
-the requisite file is made, and turns on printing. The default is to
-print a postscript file.
+the requisite file is made, and turns on printing.
+
+The (default) case
+\fB-print=auto\fR determines the kind of print file automatically from
+the set of files that is being made. The first in the list
+postscript, pdf, dvi that is among the files to be made is the one
+used for print out.
.TP
.B -ps
Generate postscript version of document.
@@ -2080,8 +2087,10 @@ If nonzero, print the document using \fIlpr\fR. Equivalent to the
\fB-p\fR option. This is recommended \fBnot\fR to be set from an RC
file, otherwise you could waste lots of paper.
.TP
-.B $print_type = ["ps"]
-Type of file to printout: possibilities are "dvi", "none", "pdf", or "ps".
+.B $print_type = ["auto"]
+Type of file to printout: possibilities are "auto", "dvi", "none",
+"pdf", or "ps". See the option \fB-print=\fR for the meaning of the
+"auto" value.
.TP
.B $pscmd
Command used to get all the processes currently run by the user. The
@@ -2560,7 +2569,7 @@ following:
TARGETS = document1.pdf document2.pdf
DEPS_DIR = .deps
LATEXMK = latexmk -recorder -use-make -deps \\
- -e 'warn qq(In Makefile, turn off custom dependencies\n);' \\
+ -e 'warn qq(In Makefile, turn off custom dependencies\\n);' \\
-e '@cus_dep_list = ();' \\
-e 'show_cus_dep();'
all : $(TARGETS)
@@ -2641,7 +2650,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.37).
+(Version 4.39).
Released version can be obtained from CTAN:
<http://www.ctan.org/tex-archive/support/latexmk/>, and from the
diff --git a/Master/texmf-dist/doc/man/man1/latexmk.man1.pdf b/Master/texmf-dist/doc/man/man1/latexmk.man1.pdf
index 5b68a02a09e..8a5de50a71e 100644
--- a/Master/texmf-dist/doc/man/man1/latexmk.man1.pdf
+++ b/Master/texmf-dist/doc/man/man1/latexmk.man1.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/support/latexmk/CHANGES b/Master/texmf-dist/doc/support/latexmk/CHANGES
index d2607265011..7bcb1fa67d9 100644
--- a/Master/texmf-dist/doc/support/latexmk/CHANGES
+++ b/Master/texmf-dist/doc/support/latexmk/CHANGES
@@ -409,3 +409,29 @@ From v. 4.35 to 4.37
relevant bib file is not found.
Other minor corrections and code improvements.
Documentation updates and corrections.
+
+From v. 4.37 to 4.39
+ Automatic creation of necessary subdirectories of auxdir when needed
+ for writing aux files.
+ Add error diagnostics to if_source
+ Allow $print_type = 'auto', and make this the default, so that
+ when the -p option to latexmk is used to print the file, the
+ default is to determine the type of file to be printed, rather
+ than always requiring postscript.
+ Fix the failures when dealing with directories whose names contained
+ certain special characters in them (notably '[', ']' and space).
+ [Technical issue: these characters had special meaning when
+ previously interpreted as metacharacters in a glob operation.]
+ This gives dependency on Perl's File::Glob module, which is a
+ standard module in normal installations of Perl.
+ When an output directory is a subdirectory of a directory, ensure
+ that it is correctly created, if it has to be created.
+ Previously, the creation of the output directory when it does not
+ exist only worked for one level.
+ This gives dependency on Perl's File::Path module with v. >= 2.08,
+ which is a standard module in normal installations of Perl.
+ In output of dependencies, include pathname of target file(s) in the
+ rule.
+ In -pvc mode, writing of deps file (caused by the -M and related
+ options) is per make not per overall run.
+
diff --git a/Master/texmf-dist/doc/support/latexmk/INSTALL b/Master/texmf-dist/doc/support/latexmk/INSTALL
index 92fb994529a..a5d4b08ee36 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.37, 2 July 2013)
+ (Version 4.39, 10 November 2013)
John Collins
Physics Department
diff --git a/Master/texmf-dist/doc/support/latexmk/README b/Master/texmf-dist/doc/support/latexmk/README
index 3d9c51d3a3a..645f6ea20ca 100644
--- a/Master/texmf-dist/doc/support/latexmk/README
+++ b/Master/texmf-dist/doc/support/latexmk/README
@@ -1,5 +1,5 @@
-Latexmk, version 4.37, 2 July 2013
-----------------------------------
+Latexmk, version 4.39, 10 November 2013
+---------------------------------------
Latexmk completely automates the process of generating a LaTeX
document. Essentially, it is a highly specialized cousin of the
@@ -92,7 +92,7 @@ NOTES:-
John Collins
---------------------------- "latexmk -h" ----------------------------
-Latexmk 4.37: Automatic LaTeX document generation routine
+Latexmk 4.39: Automatic LaTeX document generation routine
Usage: latexmk [latexmk_options] [filename ...]
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/clean_pattern_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/clean_pattern_latexmkrc
new file mode 100644
index 00000000000..b15507c6238
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/clean_pattern_latexmkrc
@@ -0,0 +1,30 @@
+# To allow more general pattern in $clean_ext instead of just an
+# extension or something containing %R.
+# This is done by overriding latexmk's cleanup1 subroutine.
+
+# Here is an example of a usefule application:
+$clean_ext = "*-eps-converted-to.pdf";
+
+sub cleanup1 {
+ # Usage: cleanup1( directory, pattern_or_ext_without_period, ... )
+ #
+ # The directory is a fixed name, so I must escape any glob metacharacters
+ # in it:
+ print "========= MODIFIED cleanup1 cw latexmk v. 4.39 and earlier\n";
+ my $dir = fix_pattern( shift );
+
+ # Change extensions to glob patterns
+ foreach (@_) {
+ # If specified pattern is pure extension, without period,
+ # wildcard character (?, *) or %R,
+ # then prepend it with directory/root_filename and period to
+ # make a full file specification
+ # Else leave the pattern as is, to be used by glob.
+ # New feature: pattern is unchanged if it contains ., *, ?
+ (my $name = (/%R/ || /[\*\.\?]/) ? $_ : "%R.$_") =~ s/%R/$dir$root_filename/;
+ unlink_or_move( glob( "$name" ) );
+ }
+} #END cleanup1
+
+
+
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc
new file mode 100644
index 00000000000..19f046be6be
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/sweave_latexmkrc
@@ -0,0 +1,57 @@
+# This is to allow the use of Sweave with latexmk, and in addition to
+# make synctex work properly with it.
+# SEE THE IMPORTANT NOTES below.
+#
+# Sweave (http://www.stat.uni-muenchen.de/~leisch/Sweave/) is a tool
+# that allows to embed the R code for complete data analyses in latex
+# documents. The user edits a file with an extension like .Rnw, and
+# the .tex file is generated from this.
+#
+# Four problems are solved by the code below:
+# 1. Generate the .tex file automatically.
+# 2. Arrange not to re-run unmodified chunks of R code. (A pure
+# optimization.)
+# 3. Fix the execution environment for (pdf)latex.
+# 4. Deal with synctex: If the user wants to use synctex
+# (www.tug.org/TUGboat/tb29-3/tb93laurens.pdf) to synchronize the
+# pdf file with the source file, by default synctex does the
+# synchronization with the generated .tex file, not the original
+# source file. Postprocessing of the .synctex.gz file is necessary
+# to fix this.
+#
+# The following version was worked out and tested by a user (thanks
+# to Brian Beitzel) on MSWindows. It will need at least one change to
+# work on UNIX-like operating systems (which include Linux and OS-X).
+
+# N.B. ===> IMPORTANT NOTES <===
+#
+# 1. The patchDVI package for R needs to be installed from R-Forge, as
+# follows:
+#
+# install.packages("patchDVI", repos="http://R-Forge.R-project.org")
+#
+# 2. In all Sweave (.Rnw) documents, the following lines must be included:
+#
+# \usepackage{Sweave}
+# \SweaveOpts{concordance=TRUE}
+
+
+# Fix the pdflatex command to run Sweave first, and to postprocess the
+# .synctex.gz file:
+# !!!!! THIS IS THE VERSION FOR MS-WINDOWS, with && as a command
+# separator
+$pdflatex = "cmd /c "
+ . "Rscript -e \"library(cacheSweave); setCacheDir(getwd()); "
+ . "Sweave('%S', driver=cacheSweaveDriver)\""
+ . " && R CMD pdflatex -interaction=nonstopmode -synctex=1 %O %B.tex"
+ . " && Rscript -e "
+ . "\"library('patchDVI');patchSynctex('%B.synctex.gz')\"";
+#
+# !!!TO FIX THIS FOR Linux/OS-X/UNIX, try uncommenting the following:
+# (this version hasn't been tested).
+#$pdflatex = "Rscript -e \"library(cacheSweave); setCacheDir(getwd()); "
+# . "Sweave('%S', driver=cacheSweaveDriver)\""
+# . " ; R CMD pdflatex -interaction=nonstopmode -synctex=1 %O %B.tex"
+# . " ; Rscript -e "
+# . "\"library('patchDVI');patchSynctex('%B.synctex.gz')\"";
+
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/tex4ht-latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/tex4ht-latexmkrc
new file mode 100644
index 00000000000..de486d8d8be
--- /dev/null
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/tex4ht-latexmkrc
@@ -0,0 +1,33 @@
+# Sometime in the future, latexmk will directly support the use of
+# TeX4ht to obtain html from tex. Meanwhile, here is how to use
+# latexmk with TeX4ht. There is a script htlatex supplied by the
+# TeX4ht package: It simply runs latex a fixed number of times and
+# then the programs tex4ht and t4ht. To use latexmk to get optimal
+# processing use the following instructions (under UNIX-like operating
+# systems, e.g., OS-X and linux):
+#
+# 1. Put the scripts htlatexonly and myhtlatex2 somewhere in the PATH
+# for executables (and make sure they have excutable permissions
+# set).
+# 2. Set up an initialization file for latexmk like this one.
+#
+# 3. To process file.tex to make file.html, run
+#
+# myhtlatex2 file
+#
+
+# Since these instructions use scripts that are UNIX shell scripts,
+# the instructions work as written for UNIX-like operating
+# systems. Users of other operating systems will have to adjust them
+# and modify the scripts suitably.
+
+
+warn "latexmkrc for htlatex\n";
+
+$dvi_mode = 1;
+$pdf_mode = 0;
+$quote_filenames = 0;
+$latex = 'htlatexonly %S';
+
+$clean_ext .= ' 4ct 4tc idv lg tmp xref';
+$clean_full_ext .= ' css html';
diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf
index 08e59651c45..cc30baf150b 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 487c6c057a3..b7c096496a2 100644
--- a/Master/texmf-dist/doc/support/latexmk/latexmk.txt
+++ b/Master/texmf-dist/doc/support/latexmk/latexmk.txt
@@ -127,7 +127,7 @@ LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE
- 2 July 2013 2
+ 10 November 2013 2
@@ -195,7 +195,7 @@ LATEXMK(1L) LATEXMK(1L)
- 2 July 2013 3
+ 10 November 2013 3
@@ -263,7 +263,7 @@ LATEXMK(1L) LATEXMK(1L)
- 2 July 2013 4
+ 10 November 2013 4
@@ -332,7 +332,7 @@ LATEXMK(1L) LATEXMK(1L)
- 2 July 2013 5
+ 10 November 2013 5
@@ -403,7 +403,7 @@ LATEXMK(1L) LATEXMK(1L)
- 2 July 2013 6
+ 10 November 2013 6
@@ -474,7 +474,7 @@ LATEXMK(1L) LATEXMK(1L)
- 2 July 2013 7
+ 10 November 2013 7
@@ -545,7 +545,7 @@ LATEXMK(1L) LATEXMK(1L)
- 2 July 2013 8
+ 10 November 2013 8
@@ -616,7 +616,7 @@ LATEXMK(1L) LATEXMK(1L)
- 2 July 2013 9
+ 10 November 2013 9
@@ -634,21 +634,21 @@ LATEXMK(1L) LATEXMK(1L)
- -p Print out the document. By default it is the generated
- postscript file that is printed. But you can use the -print=...
- option to print the dvi or pdf files instead, and you can con-
- figure this in a start up file (by setting the $print_type vari-
- able).
+ -p Print out the document. By default the file to be printed is
+ the first in the list postscript, pdf, dvi that is being made.
+ But you can use the -print=... option to change the type of file
+ to be printed, and you can configure this in a start up file (by
+ setting the $print_type variable).
However, printing is enabled by default only under UNIX/LINUX
- systems, where the default is to use the lpr command. In gen-
- eral, the correct behavior for printing very much depends on
- your system's software. In particular, under MS-Windows you
- must have suitable program(s) available, and you must have con-
- figured the print commands used by latexmk. This can be non-
- trivial. See the documentation on the $lpr, $lpr_dvi, and
- $lpr_pdf configuration variables to see how to set the commands
- for printing.
+ systems, where the default is to use the lpr command and only on
+ postscript files. In general, the correct behavior for printing
+ very much depends on your system's software. In particular,
+ under MS-Windows you must have suitable program(s) available,
+ and you must have configured the print commands used by latexmk.
+ This can be non-trivial. See the documentation on the $lpr,
+ $lpr_dvi, and $lpr_pdf configuration variables to see how to set
+ the commands for printing.
This option is incompatible with the -pv and -pvc options, so it
turns them off.
@@ -687,7 +687,7 @@ LATEXMK(1L) LATEXMK(1L)
- 2 July 2013 10
+ 10 November 2013 10
@@ -717,10 +717,14 @@ LATEXMK(1L) LATEXMK(1L)
using the -e option with a suitable line of Perl code to set the
$pdflatex variable. See the explanation of the -e option.
- -print=dvi, -print=ps, -print=pdf
+ -print=dvi, -print=ps, -print=pdf, -print=auto,
Define which kind of file is printed. This option also ensures
- that the requisite file is made, and turns on printing. The
- default is to print a postscript file.
+ that the requisite file is made, and turns on printing.
+
+ The (default) case -print=auto determines the kind of print file
+ automatically from the set of files that is being made. The
+ first in the list postscript, pdf, dvi that is among the files
+ to be made is the one used for print out.
-ps Generate postscript version of document.
@@ -750,23 +754,23 @@ LATEXMK(1L) LATEXMK(1L)
select the kind of file to be previewed (dvi, ps or pdf). Oth-
erwise the viewer views the "highest" kind of file selected, by
the -dvi, -ps, -pdf, -pdfps options, in the order dvi, ps, pdf
- (low to high). If no file type has been selected, the dvi pre-
- viewer will be used. This option is incompatible with the -p
- and -pvc options, so it turns them off.
+ (low to high). If no file type has been selected, the dvi
- -pv- Turn off -pv.
+ 10 November 2013 11
- 2 July 2013 11
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ previewer will be used. This option is incompatible with the -p
+ and -pvc options, so it turns them off.
+ -pv- Turn off -pv.
-pvc Run a file previewer and continually update the .dvi, .ps,
and/or .pdf files whenever changes are made to source files (see
@@ -822,16 +826,10 @@ LATEXMK(1L) LATEXMK(1L)
line are acted on in the order they are given. Therefore if an
initialization file is specified by the -r option, it is read
during this second step. Thus an initialization file specified
- with the -r option can override both the standard initialization
- files and previously specified options. But all of these can be
- overridden by later options.
-
- The contents of the RC file just comprise a piece of code in the
- Perl programming language (typically a sequence of assignment
- 2 July 2013 12
+ 10 November 2013 12
@@ -840,6 +838,12 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ with the -r option can override both the standard initialization
+ files and previously specified options. But all of these can be
+ overridden by later options.
+
+ The contents of the RC file just comprise a piece of code in the
+ Perl programming language (typically a sequence of assignment
statements); they are executed when the -r option is encountered
during latexmk's parsing of its command line. See the -e option
for a way of giving initialization code directly on latexmk's
@@ -893,26 +897,26 @@ LATEXMK(1L) LATEXMK(1L)
itself as well as being passed in some form to the called latex
and pdflatex program, or that affect other programs as well.
These options do have entries in this documentation. These
- options are: -jobname=STRING, -aux-directory=dir, -output-direc-
- tory=DIR, -quiet, and -recorder.
- -silent
- Run commands silently, i.e., with options that reduce the amount
- of diagnostics generated. For example, with the default
+ 10 November 2013 13
- 2 July 2013 13
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ options are: -jobname=STRING, -aux-directory=dir, -output-direc-
+ tory=DIR, -quiet, and -recorder.
- settings, the command "latex -interaction=batchmode" is used for
+ -silent
+ Run commands silently, i.e., with options that reduce the amount
+ of diagnostics generated. For example, with the default set-
+ tings, the command "latex -interaction=batchmode" is used for
latex.
Also reduce the number of informational messages that latexmk
@@ -964,25 +968,26 @@ LATEXMK(1L) LATEXMK(1L)
to pdf (in place of pdflatex). This option is exactly equiva-
lent to specifying the following sequence of options:
- -pdflatex="xelatex %O %S" -pdf -dvi- -ps-
- Compatibility between options
- The preview-continuous option -pvc can only work with one file. So in
- this case you will normally only specify one filename on the command
- line.
+ 10 November 2013 14
- 2 July 2013 14
+LATEXMK(1L) LATEXMK(1L)
+ -pdflatex="xelatex %O %S" -pdf -dvi- -ps-
-LATEXMK(1L) LATEXMK(1L)
+ Compatibility between options
+
+ The preview-continuous option -pvc can only work with one file. So in
+ this case you will normally only specify one filename on the command
+ line.
Options -p, -pv and -pvc are mutually exclusive. So each of these
options turns the others off.
@@ -1035,19 +1040,9 @@ HOW TO CHANGE THE WAY LATEXMK BEHAVES, DEALING WITH PROBLEMS, ETC
if these examples don't do what you want, they may provide suitable
inspiration.
- e. There's a useful trick that can be used when you are lualatex
- instead of pdflatex (and in some related situations). The problem is
- that latexmk won't notice a dependency on a file, bar.baz say, that is
- input by the lua code in your document instead of by the LaTeX part.
- (Thus if you change bar.baz and rerun latexmk, then latexmk will think
- no files have changed and not rerun lualatex, whereas if you had
- '\input{bar.baz}' in the LaTeX part of the document, latexmk would
- notice the change.) One solution is just to put the following some-
- where in the LaTeX part of the document:
-
- 2 July 2013 15
+ 10 November 2013 15
@@ -1056,6 +1051,16 @@ HOW TO CHANGE THE WAY LATEXMK BEHAVES, DEALING WITH PROBLEMS, ETC
LATEXMK(1L) LATEXMK(1L)
+ e. There's a useful trick that can be used when you are lualatex
+ instead of pdflatex (and in some related situations). The problem is
+ that latexmk won't notice a dependency on a file, bar.baz say, that is
+ input by the lua code in your document instead of by the LaTeX part.
+ (Thus if you change bar.baz and rerun latexmk, then latexmk will think
+ no files have changed and not rerun lualatex, whereas if you had
+ '\input{bar.baz}' in the LaTeX part of the document, latexmk would
+ notice the change.) One solution is just to put the following some-
+ where in the LaTeX part of the document:
+
\typeout{(bar.baz)}
This puts a line in the log file that latexmk will treat as implying
@@ -1106,20 +1111,9 @@ CONFIGURATION/INITIALIZATION (RC) FILES
4) Any RC file(s) specified on the command line with the -r option.
- Each RC file is a sequence of Perl commands. Naturally, a user can use
- this in creative ways. But for most purposes, one simply uses a
- sequence of assignment statements that override some of the built-in
- settings of Latexmk. Straightforward cases can be handled without
- knowledge of the Perl language by using the examples in this document
- as templates. Comment lines are introduced by the "#" character.
-
- Note that command line options are obeyed in the order in which they
- are written; thus any RC file specified on the command line with the -r
- option can override previous options but can be itself overridden by
-
- 2 July 2013 16
+ 10 November 2013 16
@@ -1128,6 +1122,16 @@ CONFIGURATION/INITIALIZATION (RC) FILES
LATEXMK(1L) LATEXMK(1L)
+ Each RC file is a sequence of Perl commands. Naturally, a user can use
+ this in creative ways. But for most purposes, one simply uses a
+ sequence of assignment statements that override some of the built-in
+ settings of Latexmk. Straightforward cases can be handled without
+ knowledge of the Perl language by using the examples in this document
+ as templates. Comment lines are introduced by the "#" character.
+
+ Note that command line options are obeyed in the order in which they
+ are written; thus any RC file specified on the command line with the -r
+ option can override previous options but can be itself overridden by
later options on the command line. There is also the -e option, which
allows initialization code to be specified in latexmk's command line.
@@ -1178,28 +1182,27 @@ FORMAT OF COMMAND SPECIFICATIONS
view a postscript file. This section describes some important features
of how the commands are specified.
- Placeholders: Supposed you wanted latexmk to use the command elatex in
- place of the regular latex command, and suppose moreover that you
- wanted to give it the option "--shell-escape". You could do this by
- the following setting:
-
- $latex = 'elatex --shell-escape %O %S';
- The two items starting with the % character are placeholders. These
- are substituted by appropriate values before the command is run. Thus
- %S will be replaced by the source file that elatex will be applied to,
+ 10 November 2013 17
- 2 July 2013 17
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ Placeholders: Supposed you wanted latexmk to use the command elatex in
+ place of the regular latex command, and suppose moreover that you
+ wanted to give it the option "--shell-escape". You could do this by
+ the following setting:
+ $latex = 'elatex --shell-escape %O %S';
+ The two items starting with the % character are placeholders. These
+ are substituted by appropriate values before the command is run. Thus
+ %S will be replaced by the source file that elatex will be applied to,
and %O will be replaced by any options that latexmk has decided to use
for this command. (E.g., if you used the -silent option it would
replace %O by "-interaction=batchmode".)
@@ -1249,31 +1252,30 @@ LATEXMK(1L) LATEXMK(1L)
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
+ 10 November 2013 18
- 2 July 2013 18
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ 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';
- purposes, the name %T of the primary texfile is not a useful place-
- holder.
+ 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
usable in initialization files" for what is normally the most appropri-
@@ -1320,22 +1322,11 @@ LATEXMK(1L) LATEXMK(1L)
traPDF.exe" %O %S';
- (Note about the above example: Forward slashes are equivalent to back-
- slashes in filenames under MS-Windows, provided that the filename is
- inside double quotes. It is easier to use forward slashes in examples
- like the one above, since then one does not have to worry about the
- rules for dealing with forward slashes in strings in the Perl lan-
- guage.)
-
- Command names under Cygwin: If latexmk is executed by Cygwin's Perl,
- be particularly certain that pathnames in commands have forward slashes
- not the usual backslashes for the separator of pathname components.
- See the above examples. Backslashes often get misinterpreted by the
- Unix shell used by Cygwin's Perl to execute external commands. Forward
+ (Note about the above example: Forward slashes are equivalent to
- 2 July 2013 19
+ 10 November 2013 19
@@ -1344,6 +1335,17 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ backslashes in filenames under MS-Windows, provided that the filename
+ is inside double quotes. It is easier to use forward slashes in exam-
+ ples like the one above, since then one does not have to worry about
+ the rules for dealing with forward slashes in strings in the Perl lan-
+ guage.)
+
+ Command names under Cygwin: If latexmk is executed by Cygwin's Perl,
+ be particularly certain that pathnames in commands have forward slashes
+ not the usual backslashes for the separator of pathname components.
+ See the above examples. Backslashes often get misinterpreted by the
+ Unix shell used by Cygwin's Perl to execute external commands. Forward
slashes don't suffer from this problem, and (when quoted, as above) are
equally acceptable to MS-Windows.
@@ -1392,30 +1394,30 @@ LATEXMK(1L) LATEXMK(1L)
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
- extra processing, you could do something like:
- $pdflatex = 'pdflatex --shell-escape %O %S; pst2pdf_for_latexmk
- %B';
- This definition assumes you are using a UNIX-like system (which
+ 10 November 2013 20
- 2 July 2013 20
+LATEXMK(1L) LATEXMK(1L)
+ write a script (or batch file) to do the processing, and then configure
+ latexmk to use your script in place of the standard program.
-LATEXMK(1L) LATEXMK(1L)
+ 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
+ extra processing, you could do something like:
+ $pdflatex = 'pdflatex --shell-escape %O %S; pst2pdf_for_latexmk
+ %B';
+ This definition assumes you are using a UNIX-like system (which
includes Linux and OS-X), so that the two commands to be run are sepa-
rated by the semicolon in the middle of the string.
@@ -1464,6 +1466,17 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
on the command line by the -r option.
+
+
+ 10 November 2013 21
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
$aux_dir [""]
The directory in which auxiliary files (aux, log, etc) are to be
written by a run of (pdf)latex. If this variable is not set,
@@ -1476,18 +1489,6 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
(pdf)latex.
See also the documentation of $out_dir for some complications on
-
-
-
- 2 July 2013 21
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
what directory names are suitable.
@@ -1535,6 +1536,18 @@ LATEXMK(1L) LATEXMK(1L)
@BIBINPUTS = ( ".", "/usr/local/texmf/bibtex/bib" );
Note that under MS Windows, either a forward slash "/" or a
+
+
+
+ 10 November 2013 22
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
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
@@ -1549,18 +1562,6 @@ LATEXMK(1L) LATEXMK(1L)
$biber ["biber %O %S"]
The biber processing program.
-
-
-
- 2 July 2013 22
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
$biber_silent_switch ["--onlylog"]
Switch(es) for the biber processing program when silent mode is
on.
@@ -1606,6 +1607,18 @@ LATEXMK(1L) LATEXMK(1L)
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
+
+
+
+ 10 November 2013 23
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
variables.)
This variable is equivalent to specifying one of the -c or -C
@@ -1622,18 +1635,6 @@ LATEXMK(1L) LATEXMK(1L)
be deleted, by using the place holder %R, as in commands, and it
is also possible to use wildcards. Thus setting
-
-
-
- 2 July 2013 23
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
$clean_ext = "out %R-blx.bib %R-figures*.log";
in an initialization file will imply that when a clean-up opera-
@@ -1677,6 +1678,18 @@ LATEXMK(1L) LATEXMK(1L)
--name \"%D FAILURE\"";
These assume that the program xdotool is installed, that the
+
+
+
+ 10 November 2013 24
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
previewer is using an X-Window system for display, and that the
title of the window contains the name of the displayed file, as
it normally does. When the commands are executed, the place-
@@ -1697,17 +1710,6 @@ LATEXMK(1L) LATEXMK(1L)
Custom dependency list -- see section on "Custom Dependencies".
-
-
- 2 July 2013 24
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
@default_files [("*.tex")]
Default list of files to be processed.
@@ -1749,6 +1751,18 @@ LATEXMK(1L) LATEXMK(1L)
$do_cd [0]
Whether to change working directory to the directory specified
for the main source file before processing it. The default
+
+
+
+ 10 November 2013 25
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
behavior is not to do this, which is the same as the behavior of
latex and pdflatex programs. This variable is set by the -cd
and -cd- options on latexmk's command line.
@@ -1771,18 +1785,6 @@ LATEXMK(1L) LATEXMK(1L)
$dvi_previewer ["start xdvi %O %S" under UNIX]
The command to invoke a dvi-previewer. [Default is "start"
under MS-WINDOWS; under more recent versions of Windows, this
-
-
-
- 2 July 2013 25
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
will cause to be run whatever command the system has associated
with .dvi files.]
@@ -1822,6 +1824,18 @@ LATEXMK(1L) LATEXMK(1L)
silent switch has no effect, but is actually innocuous. But if
an alternative program is used, e.g., dvipdfmx, then the silent
switch has an effect. The default setting is correct for
+
+
+
+ 10 November 2013 26
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
dvipdfm and dvipdfmx.
$dvips ["dvips %O -o %D %S"]
@@ -1846,18 +1860,6 @@ LATEXMK(1L) LATEXMK(1L)
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
-
-
-
- 2 July 2013 26
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
for the analogous case of a pdf previewer.
$dvi_update_method [2 under UNIX, 1 under MS-Windows]
@@ -1896,6 +1898,18 @@ LATEXMK(1L) LATEXMK(1L)
$force_mode [0]
If nonzero, continue processing past minor latex errors includ-
ing unrecognized cross references. Equivalent to specifying the
+
+
+
+ 10 November 2013 27
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
-f option.
@generated_exts [( aux , bbl , idx , ind , lof , lot , out , toc ,
@@ -1921,18 +1935,6 @@ LATEXMK(1L) LATEXMK(1L)
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
-
-
-
- 2 July 2013 27
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
line in an RC file. E.g.,
push @generated_exts, "end";
@@ -1970,6 +1972,18 @@ LATEXMK(1L) LATEXMK(1L)
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
+
+
+
+ 10 November 2013 28
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
expression specifies that lines beginning with "%%CreationDate:
" are to be ignored in deciding whether a file of the given
extension .eps has changed.
@@ -1997,58 +2011,58 @@ LATEXMK(1L) LATEXMK(1L)
$kpsewhich ["kpsewhich %S"]
The program called to locate a source file when the name alone
- is not sufficient. Most filenames used by latexmk have
-
-
-
- 2 July 2013 28
-
+ is not sufficient. Most filenames used by latexmk have suffi-
+ cient path information to be found directly. But sometimes,
+ notably when .bib files are found from the log file of a bibtex
+ or biber run, the name of the file, but not its path is known.
+ The program specified by $kpsewhich is used to find it.
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
- sufficient path information to be found directly. But some-
- times, notably when .bib files are found from the log file of a
- bibtex or biber run, the name of the file, but not its path is
- known. The program specified by $kpsewhich is used to find it.
-
- See also the @BIBINPUTS variable for another way that latexmk
+ See also the @BIBINPUTS variable for another way that latexmk
also uses to try to locate files; it applies only in the case of
.bib files.
$landscape_mode [0]
If nonzero, run in landscape mode, using the landscape mode pre-
- viewers and dvi to postscript converters. Equivalent to the -l
+ viewers and dvi to postscript converters. Equivalent to the -l
option. Normally not needed with current previewers.
$latex ["latex %O %S"]
The LaTeX processing program. Note that as with other programs,
- you can use this variable not just to change the name of the
+ you can use this variable not just to change the name of the
program used, but also specify options to the program. E.g.,
$latex = "latex --src-specials";
%latex_input_extensions
- This variable specifies the extensions tried by latexmk when it
- finds that a LaTeX run resulted in an error that a file has not
- been found, and the file is given without an extension. This
- typically happens when LaTeX commands of the form \input{file}
- or \includegraphics{figure}, when the relevant source file does
+ This variable specifies the extensions tried by latexmk when it
+ finds that a LaTeX run resulted in an error that a file has not
+ been found, and the file is given without an extension. This
+ typically happens when LaTeX commands of the form \input{file}
+ or \includegraphics{figure}, when the relevant source file does
not exist.
- In this situation, latexmk searches for custom dependencies to
- make the missing file(s), but restricts it to the extensions
- specified by the variable %latex_input_extensions. The default
+ In this situation, latexmk searches for custom dependencies to
+ make the missing file(s), but restricts it to the extensions
+ specified by the variable %latex_input_extensions. The default
extensions are 'tex' and 'eps'.
- (For Perl experts: %latex_input_extensions is a hash whose keys
- are the extensions. The values are irrelevant.) Two subrou-
- tines are provided for manipulating this and the related vari-
- able %pdflatex_input_extensions, add_input_ext and
- remove_input_ext. They are used as in the following examples
+
+
+
+ 10 November 2013 29
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
+ (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' );
@@ -2057,52 +2071,42 @@ LATEXMK(1L) LATEXMK(1L)
add_input_ext( 'latex', 'asdf' );
- add the extension 'asdf to latex_input_extensions. (Naturally
+ add the extension 'asdf to latex_input_extensions. (Naturally
with such an extension, you should have made an appropriate cus-
tom dependency for latexmk, and should also have done the appro-
- priate programming in the LaTeX source file to enable the file
- to be read. The standard extensions are handled by LaTeX and
+ priate programming in the LaTeX source file to enable the file
+ to be read. The standard extensions are handled by LaTeX and
its graphics/graphicx packages.
$latex_silent_switch ["-interaction=batchmode"]
- Switch(es) for the LaTeX processing program when silent mode is
+ Switch(es) for the LaTeX processing program when silent mode is
on.
- If you use MikTeX, you may prefer the results if you configure
- the options to include -c-style-errors, e.g., by the following
+ If you use MikTeX, you may prefer the results if you configure
+ the options to include -c-style-errors, e.g., by the following
line in an initialization file
$latex_silent_switch = "-interaction=batchmode -c-style-
errors";
-
- 2 July 2013 29
-
-
-
-
-
-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.
@@ -2112,13 +2116,24 @@ 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
+
+
+ 10 November 2013 30
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
+ 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.
@@ -2132,91 +2147,92 @@ LATEXMK(1L) LATEXMK(1L)
The index processing program.
$makeindex_silent_switch ["-q"]
- Switch(es) for the index processing program when silent mode is
+ Switch(es) for the index processing program when silent mode is
on.
$max_repeat [5]
- The maximum number of times latexmk will run latex/pdflatex
- before deciding that there may be an infinite loop and that it
+ 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.)
$MSWin_back_slash [1]
- This configuration variable only has an effect when latexmk is
+ This configuration variable only has an effect when latexmk is
running under MS-Windows. It determines whether, when a command
- is executed under MS-Windows, there should be substituted "\"
- for the separator character between components of a directory
- name. Internally, latexmk uses "/" for the directory separator
+ is executed under MS-Windows, there should be substituted "\"
+ for the separator character between components of a directory
+ name. Internally, latexmk uses "/" for the directory separator
character, which is the character used by Unix-like systems.
+ For many programs under MS-Windows, both "\" and "/" are accept-
+ able as the directory separator character. But some programs
+ only accept "\". So for safety latexmk makes a translation, by
+ default. It is conceivable that under certain situations this
+ is undesirable, so the configuration can be changed. (A possi-
+ ble example might be when some of the software is implemented
+ using Cygwin, which provides an Unix-like environment inside MS-
+ Windows.)
- 2 July 2013 30
+ $new_viewer_always [0]
+ This variable applies to latexmk only in continuous-preview
+ mode. If $new_viewer_always is 0, latexmk will check for a pre-
+ 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.
+ $out_dir [""]
+ The directory in which output files are to be written by a run
+ of (pdf)latex. See also the variable $aux_dir.
+ The effect of this variable (when non-blank) is achieved by
+ using the -output-directory option of (pdf)latex. This exists
+ in the usual current (Dec. 2011) implementations of TeX, i.e.,
-LATEXMK(1L) LATEXMK(1L)
+ 10 November 2013 31
- For many programs under MS-Windows, both "\" and "/" are accept-
- able as the directory separator character. But some programs
- only accept "\". So for safety latexmk makes a translation, by
- default. It is conceivable that under certain situations this
- is undesirable, so the configuration can be changed. (A possi-
- ble example might be when some of the software is implemented
- using Cygwin, which provides an Unix-like environment inside MS-
- Windows.)
- $new_viewer_always [0]
- This variable applies to latexmk only in continuous-preview
- mode. If $new_viewer_always is 0, latexmk will check for a pre-
- 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.
- $out_dir [""]
- The directory in which output files are to be written by a run
- of (pdf)latex. See also the variable $aux_dir.
+LATEXMK(1L) LATEXMK(1L)
+
- The effect of this variable (when non-blank) is achieved by
- using the -output-directory option of (pdf)latex. This exists
- in the usual current (Dec. 2011) implementations of TeX, i.e.,
MiKTeX and TeXLive. But it may not be present in other versions.
- Commonly, the directory specified for output files is a subdi-
+ Commonly, the directory specified for output files is a subdi-
rectory of the current working directory. However, if you spec-
- ify some other directory, e.g., "/tmp/foo" or "../output", be
- aware that this could cause problems, e.g., with makeindex or
- bibtex. This is because modern versions of these programs, by
- default, will refuse to work when they find that they are asked
- to write to a file in a directory that appears not to be the
+ ify some other directory, e.g., "/tmp/foo" or "../output", be
+ aware that this could cause problems, e.g., with makeindex or
+ bibtex. This is because modern versions of these programs, by
+ default, will refuse to work when they find that they are asked
+ to write to a file in a directory that appears not to be the
current working directory or one of its subdirectories. This is
- part of security measures by the whole TeX system that try to
+ part of security measures by the whole TeX system that try to
prevent malicious or errant TeX documents from incorrectly mess-
ing with a user's files. If for $out_dir or $aux_dir you really
- do need to specify an absolute pathname (e.g., "/tmp/foo") or a
+ do need to specify an absolute pathname (e.g., "/tmp/foo") or a
path (e.g., "../output") that includes a higher-level directory,
- then you need to disable the security measures (and assume any
- risks). This can be done by temporarily setting the operating
- system's environment variable openout_any to "a" (as in "all"),
+ then you need to disable the security measures (and assume any
+ risks). This can be done by temporarily setting the operating
+ system's environment variable openout_any to "a" (as in "all"),
to override the default "paranoid" setting.
$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.
@@ -2224,26 +2240,14 @@ LATEXMK(1L) LATEXMK(1L)
$pdflatex ["pdflatex %O %S"]
- The LaTeX processing program in a version that makes a pdf file
+ The LaTeX processing program in a version that makes a pdf file
instead of a dvi file.
- An example of the use of this variable is to arrange for luala-
- tex, xelatex or some similar program to be used instead of
-
-
-
- 2 July 2013 31
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
- pdflatex. Note that lualatex and xelatex only produce .pdf
- files (and not .dvi), so to use them you will also need to turn
- on production of .pdf files, and to turn off the production of
+ An example of the use of this variable is to arrange for luala-
+ tex, xelatex or some similar program to be used instead of
+ pdflatex. Note that lualatex and xelatex only produce .pdf
+ files (and not .dvi), so to use them you will also need to turn
+ on production of .pdf files, and to turn off the production of
.dvi (and .ps) files, either by command line options or by suit-
able settings in a configuration file. Thus to use lualatex, the
following settings are appropriate:
@@ -2256,7 +2260,7 @@ LATEXMK(1L) LATEXMK(1L)
$pdflatex = "xelatex %O %S";
$pdf_mode = 1; $postscript_mode = $dvi_mode = 0;
- Another use of the same variable is to add certain options to
+ Another use of the same variable is to add certain options to
the command line for the program, e.g.,
$pdflatex = "pdflatex --shell-escape %O %S";
@@ -2264,23 +2268,35 @@ LATEXMK(1L) LATEXMK(1L)
%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
+
+
+
+ 10 November 2013 32
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
+ 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 'tex', 'pdf', 'jpg, and 'png'.
- (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' );
@@ -2289,82 +2305,82 @@ 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.
- If you use MikTeX, you may prefer the results if you configure
- the options to include -c-style-errors, e.g., by the following
+ If you use MikTeX, you may prefer the results if you configure
+ the options to include -c-style-errors, e.g., by the following
line in an initialization file
$latex_silent_switch = "-interaction=batchmode -c-style-
+ errors";
+ $pdf_previewer ["start acroread %O %S"]
+ The command to invoke a pdf-previewer.
- 2 July 2013 32
+ On MS-WINDOWS, the default is changed to "cmd /c start """;
+ under more recent versions of Windows, this will cause to be run
+ whatever command the system has associated with .pdf files. But
+ this may be undesirable if this association is to acroread --
+ see the notes in the explanation of the -pvc option.]
+ On OS-X the default is changed to "open %S", which results in
+ OS-X starting up (and detaching) the viewer associated with the
+ file. By default, for pdf files this association is to OS-X's
+ preview, which is quite satisfactory.
+ WARNING: 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, for
+ example, SumatraPDF or gsview is used to view pdf files.
-LATEXMK(1L) LATEXMK(1L)
+ 10 November 2013 33
- errors";
- $pdf_previewer ["start acroread %O %S"]
- The command to invoke a pdf-previewer.
- On MS-WINDOWS, the default is changed to "cmd /c start """;
- under more recent versions of Windows, this will cause to be run
- whatever command the system has associated with .pdf files. But
- this may be undesirable if this association is to acroread --
- see the notes in the explanation of the -pvc option.]
- On OS-X the default is changed to "open %S", which results in
- OS-X starting up (and detaching) the viewer associated with the
- file. By default, for pdf files this association is to OS-X's
- preview, which is quite satisfactory.
+LATEXMK(1L) LATEXMK(1L)
- WARNING: 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, for
- example, SumatraPDF or gsview is used to view pdf files.
- Important note: Normally you will want to have a previewer run
+ Important note: Normally you will want to have a previewer run
detached, so that latexmk doesn't wait for the previewer to ter-
- minate before continuing its work. So normally you should pre-
- fix the command by "start ", which flags to latexmk that it
- should do the detaching of the previewer itself (by whatever
- method is appropriate to the operating system). But sometimes
+ minate before continuing its work. So normally you should pre-
+ fix the command by "start ", which flags to latexmk that it
+ should do the detaching of the previewer itself (by whatever
+ method is appropriate to the operating system). But sometimes
letting latexmk do the detaching is not appropriate (for a vari-
- ety of non-trivial reasons), so you should put the "start " bit
+ ety of non-trivial reasons), so you should put the "start " bit
in yourself, whenever it is needed.
$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
@@ -2377,66 +2393,68 @@ 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
+ 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
+ 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 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.
- 2 July 2013 33
+ $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, then $postscript_mode will be set to 1.
-LATEXMK(1L) LATEXMK(1L)
+ 10 November 2013 34
- $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
- 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 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, then $postscript_mode will be set to 1.
+LATEXMK(1L) LATEXMK(1L)
+
$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",
- "pdf", or "ps".
+ $print_type = ["auto"]
+ Type of file to printout: possibilities are "auto", "dvi",
+ "none", "pdf", or "ps". See the option -print= for the meaning
+ of the "auto" value.
$pscmd Command used to get all the processes currently run by the user.
The -pvc option uses the command specified by the variable
@@ -2460,20 +2478,8 @@ LATEXMK(1L) LATEXMK(1L)
$ps_filter [empty]
The postscript file filter to be run on the newly produced
- postscript file before other processing. Equivalent to
-
-
-
- 2 July 2013 34
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
- specifying the -pF option.
+ 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-
@@ -2491,9 +2497,21 @@ LATEXMK(1L) LATEXMK(1L)
perhaps not one called gv.
Important note: Normally you will want to have a previewer run
- detached, so that latexmk doesn't wait for the previewer to ter-
- minate before continuing its work. So normally you should pre-
- fix the command by "start ", which flags to latexmk that it
+ detached, so that latexmk doesn't wait for the previewer to
+
+
+
+ 10 November 2013 35
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
+ terminate before continuing its work. So normally you should
+ prefix the command by "start ", which flags to latexmk that it
should do the detaching of the previewer itself (by whatever
method is appropriate to the operating system). But sometimes
letting latexmk do the detaching is not appropriate (for a vari-
@@ -2539,18 +2557,6 @@ LATEXMK(1L) LATEXMK(1L)
as true), then quoting is done. Otherwise quoting is omitted.
The quoting method used by latexmk is tested to work correctly
-
-
-
- 2 July 2013 35
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
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
@@ -2568,6 +2574,18 @@ LATEXMK(1L) LATEXMK(1L)
tex.
It is generally recommended to use this option (or to configure
+
+
+
+ 10 November 2013 36
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
the $recorder variable to be on.) But it only works if
(pdf)latex supports the -recorder option, which is true for most
current implementations
@@ -2620,17 +2638,6 @@ LATEXMK(1L) LATEXMK(1L)
This is an obsolete variable, replaced by the @default_files
variable.
-
-
- 2 July 2013 36
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
For backward compatibility, if you choose to set $tex-
file_search, it is a string of space-separated filenames, and
then latexmk replaces @default_files with the filenames in $tex-
@@ -2645,6 +2652,17 @@ LATEXMK(1L) LATEXMK(1L)
Directory to store temporary files that latexmk may generate
while running.
+
+
+ 10 November 2013 37
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
The default under MSWindows (including cygwin), is to set
$tmpdir to the value of the first of whichever of the system
environment variables TMPDIR or TEMP exists, otherwise to the
@@ -2701,26 +2719,27 @@ CUSTOM DEPENDENCIES
The extension of the file we are converting to (e.g. "eps"). It
is specified without a period.
+ must: If non-zero, the file from which we are converting must exist,
+ if it doesn't exist latexmk will give an error message and exit
+ unless the -f option is specified. If must is zero and the file
+ we are converting from doesn't exist, then no action is taken.
+ function:
+ The name of the subroutine that latexmk should call to perform
+ the file conversion. The first argument to the subroutine is
+ the base name of the file to be converted without any extension.
- 2 July 2013 37
+ 10 November 2013 38
-LATEXMK(1L) LATEXMK(1L)
- must: If non-zero, the file from which we are converting must exist,
- if it doesn't exist latexmk will give an error message and exit
- unless the -f option is specified. If must is zero and the file
- we are converting from doesn't exist, then no action is taken.
+LATEXMK(1L) LATEXMK(1L)
+
- function:
- The name of the subroutine that latexmk should call to perform
- the file conversion. The first argument to the subroutine is
- the base name of the file to be converted without any extension.
The subroutines are declared in the syntax of Perl. The func-
tion should return 0 if it was successful and a nonzero number
if it failed.
@@ -2781,10 +2800,15 @@ LATEXMK(1L) LATEXMK(1L)
add_cus_dep( 'fig', 'pdf, 0, 'fig2pdf' );
sub fig2pdf {
+ system( "fig2dev -Lpdf \"$_[0].fig\" \"$_[0].pdf\"" );
+ }
+ Note 1: In the command lines given in the system commands in the above
+ examples, double quotes have been inserted around the file names
- 2 July 2013 38
+
+ 10 November 2013 39
@@ -2793,11 +2817,6 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- system( "fig2dev -Lpdf \"$_[0].fig\" \"$_[0].pdf\"" );
- }
-
- Note 1: In the command lines given in the system commands in the above
- examples, double quotes have been inserted around the file names
(implemented by '\"' in the Perl language). They immunize the running
of the program against special characters in filenames. Very often
these quotes are not necessary, i.e., they can be omitted. But it is
@@ -2862,10 +2881,11 @@ LATEXMK(1L) LATEXMK(1L)
Of course if you choose to write random data to the .nnd (or and .aux
file, etc) that changes on each new run, then you will have a problem.
For real experts: See the %hash_cal_ignore_pattern if you have to deal
+ with such problems.
- 2 July 2013 39
+ 10 November 2013 40
@@ -2874,8 +2894,6 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- with such problems.
-
Glossaries can be dealt with similarly.
@@ -2941,12 +2959,10 @@ USING latexmk WITH make
OS-X systems. They may need modifications for other versions of make.
The simplest method is simply to delegate all the relevant tasks to
- latexmk, as is suitable for a straightforward LaTeX document. For this
- a suitable Makefile is like
- 2 July 2013 40
+ 10 November 2013 41
@@ -2955,6 +2971,9 @@ USING latexmk WITH make
LATEXMK(1L) LATEXMK(1L)
+ latexmk, as is suitable for a straightforward LaTeX document. For this
+ a suitable Makefile is like
+
.PHONY : FORCE_MAKE
all : try.pdf
%.pdf : %.tex FORCE_MAKE
@@ -2992,7 +3011,7 @@ LATEXMK(1L) LATEXMK(1L)
TARGETS = document1.pdf document2.pdf
DEPS_DIR = .deps
LATEXMK = latexmk -recorder -use-make -deps \
- -e 'warn qq(In Makefile, turn off custom dependencies0;' \
+ -e 'warn qq(In Makefile, turn off custom dependencies\n);' \
-e '@cus_dep_list = ();' \
-e 'show_cus_dep();'
all : $(TARGETS)
@@ -3005,29 +3024,22 @@ LATEXMK(1L) LATEXMK(1L)
%.pdf : %.fig
fig2dev -Lpdf $< $@
- (Again, the lines containing the commands for the rules should be
+ (Again, the lines containing the commands for the rules should be
started with tabs.) This example was inspired by how GNU automake han-
dles automatic dependency tracking of C source files.
- After each run of latexmk, dependency information is put in a file in
- the .deps subdirectory. The Makefile causes these dependency files to
+ After each run of latexmk, dependency information is put in a file in
+ the .deps subdirectory. The Makefile causes these dependency files to
be read by make, which now has the full dependency information for each
- target .pdf file. To make things less trivial it is specificed that
- two files document1.pdf and document2.pdf are the targets. The depen-
+ target .pdf file. To make things less trivial it is specificed that
+ two files document1.pdf and document2.pdf are the targets. The depen-
dency files are .deps/document1.pdfP and .deps/document2.pdfP.
- There is now no need for the phony prerequisite for the rule to make
- .pdf files from .tex files. But I have added a rule to make .pdf files
- from .fig files produced by the xfig program; these are commonly used
- for graphics insertions in LaTeX documents. Latexmk is arranged to
- output a dependency file after each run. It is given the -recorder
- option, which improves its detection of files generated during a run of
- pdflatex; such files should not be in the dependency list. The -e
- options are used to turn off all custom dependencies, and to document
+ There is now no need for the phony prerequisite for the rule to make
- 2 July 2013 41
+ 10 November 2013 42
@@ -3036,18 +3048,25 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- this. Instead the -use-make is used to delegate the making of missing
+ .pdf files from .tex files. But I have added a rule to make .pdf files
+ from .fig files produced by the xfig program; these are commonly used
+ for graphics insertions in LaTeX documents. Latexmk is arranged to
+ output a dependency file after each run. It is given the -recorder
+ option, which improves its detection of files generated during a run of
+ pdflatex; such files should not be in the dependency list. The -e
+ options are used to turn off all custom dependencies, and to document
+ this. Instead the -use-make is used to delegate the making of missing
files to make itself.
- Suppose in the LaTeX file there is a command \includegraphics{graph},
- and an xfig file "graph.fig" exists. On a first run, pdflatex reports
- a missing file, named "graph". Latexmk succeeds in making "graph.pdf"
+ Suppose in the LaTeX file there is a command \includegraphics{graph},
+ and an xfig file "graph.fig" exists. On a first run, pdflatex reports
+ a missing file, named "graph". Latexmk succeeds in making "graph.pdf"
by calling "make graph.pdf", and after completion of its work, it lists
"fig.pdf" among the dependents of the file latexmk is making. Then let
- "fig.fig" be updated, and then let make be run. Make first remakes
+ "fig.fig" be updated, and then let make be run. Make first remakes
"fig.pdf", and only then reruns latexmk.
- Thus we now have a method by which all the subsidiary processing is
+ Thus we now have a method by which all the subsidiary processing is
delegated to make.
@@ -3056,34 +3075,34 @@ SEE ALSO
BUGS
Sometimes a viewer (gv) tries to read an updated .ps or .pdf file after
- its creation is started but before the file is complete. Work around:
+ its creation is started but before the file is complete. Work around:
manually refresh (or reopen) display. Or use one of the other preview-
ers and update methods.
- (The following isn't really a bug, but concerns features of preview-
- ers.) Preview continuous mode only works perfectly with certain pre-
- viewers: Xdvi on UNIX/LINUX works for dvi files. Gv on UNIX/LINUX
- works for both postscript and pdf. Ghostview on UNIX/LINUX needs a
- manual update (reopen); it views postscript and pdf. Gsview under MS-
- Windows works for both postscript and pdf, but only reads the updated
- file when its screen is refreshed. Acroread under UNIX/LINUX views
- pdf, but the file needs to be closed and reopened to view an updated
- version. Under MS-Windows, acroread locks its input file and so the
- pdf file cannot be updated. (Remedy: configure latexmk to use suma-
+ (The following isn't really a bug, but concerns features of preview-
+ ers.) Preview continuous mode only works perfectly with certain pre-
+ viewers: Xdvi on UNIX/LINUX works for dvi files. Gv on UNIX/LINUX
+ works for both postscript and pdf. Ghostview on UNIX/LINUX needs a
+ manual update (reopen); it views postscript and pdf. Gsview under MS-
+ Windows works for both postscript and pdf, but only reads the updated
+ file when its screen is refreshed. Acroread under UNIX/LINUX views
+ pdf, but the file needs to be closed and reopened to view an updated
+ version. Under MS-Windows, acroread locks its input file and so the
+ pdf file cannot be updated. (Remedy: configure latexmk to use suma-
trapdf instead.)
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
+ 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.37).
+ Current version, by John Collins (username collins at node
+ phys.psu.edu). (Version 4.39).
- Released version can be obtained from CTAN: <http://www.ctan.org/tex-
+ Released version can be obtained from CTAN: <http://www.ctan.org/tex-
archive/support/latexmk/>, and from the author's website
<http://www.phys.psu.edu/~collins/software/latexmk/>.
Modifications and enhancements by Evan McLean (Version 2.0)
@@ -3097,6 +3116,72 @@ AUTHOR
+ 10 November 2013 43
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -3108,6 +3193,6 @@ AUTHOR
- 2 July 2013 42
+ 10 November 2013 44
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl
index e27ced4d9eb..95f302d82a1 100755
--- a/Master/texmf-dist/scripts/latexmk/latexmk.pl
+++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl
@@ -111,12 +111,14 @@ use warnings;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.37';
-$version_details = "$My_name, John Collins, 2 July 2013";
+$version_num = '4.39';
+$version_details = "$My_name, John Collins, 10 Nov 2013";
use Config;
-use File::Copy;
use File::Basename;
+use File::Copy;
+use File::Glob ':glob'; # Better glob. Does not use space as item separator.
+use File::Path 2.08 qw( make_path );
use FileHandle;
use File::Find;
use List::Util qw( max );
@@ -135,7 +137,7 @@ use vars qw( $dvi_update_command $ps_update_command $pdf_update_command );
@signame = ();
if ( defined $Config{sig_name} ) {
$i = 0;
- foreach $name (split(' ', $Config{sig_name})) {
+ foreach $name (split('\s+', $Config{sig_name})) {
$signo{$name} = $i;
$signame[$i] = $name;
$i++;
@@ -182,131 +184,38 @@ else {
## Modification log from 9 Dec 2011 onwards in detail
##
## 12 Jan 2012 STILL NEED TO DOCUMENT some items below
-## 2 Jul 2013 John Collins V. 4.37
-## 1 Jul 2013 John Collins Correct bug that gave fatal error when the
-## name of current directory contains a
-## character with special meaning in a regexp.
-## 24 May 2013 John Collins Break in pvc returns to main program rather than
-## halting. Thus -rules option now works with -pvc.
-## 24 May 2013 John Collins File specifications in $clean_ext and
-## $clean_full_ext are allowed wildcards
-## 2 May 2013 John Collins TRY to fix problem when extension .bib in \bibliography,
-## as in \bibliography{references.bib}.
-## WHAT IS CORRECT BEHAVIOR OF sub find_file_list1?
-## Must test bibtex in all conditions on bst and bib files
-## regarding extensions
-## 28 Apr 2013 John Collins Warnings when rc file is a directory instead
-## of a file.
-## 24 Apr 2013 John Collins Add -lualatex option, like -xelatex
-## 9 Apr 2013 John Collins Correction of misleading variable names
-## in rdb_create_rule
-## 1 Apr 2013 John Collins Minor correction of misprint in comment
-## 26 Dec 2012 John Collins Correct diagnostics ("MakeB" --> "Make")
-## Rename @one_time to @unusual_one_time
-## to indicate this array is about inner-level
-## one_time rules, of which there are normally
-## none.
-## Fix diagnostics on one-time rules, to include
-## separately inner- and outer-level rules
-## Fix non-call of viewer when $force_mode on.
-## Remove some unused code
-## 14 Nov 2012 John Collins Correction on copying of fls (with MiKTeX)
-## 13 Nov 2012 John Collins V. 4.36
-## Remove redundant call to normalize_filename
-## in rdb_set_latex_deps
-## Set BIBINPUTS to include aux_dir.
-## This corrects a bug when
-## revtex4-1 is used with footnotes
-## in the bibliography: Previously
-## latexmk failed to run bibtex
-## because of a not-found bibfile
-## when the bibfile is in aux_dir
-## (or out_dir).
-## 11 Nov 2012 John Collins V. 4.35
-## Correct bug that under some combinations of
-## MS-Windows, cygwin and distributions of
-## TeX, line endings in fls file (CRLF v. LF)
-## were misparsed, resulting in source
-## filenames that incorrectly contained CR
-## characters.
-## Correct bug that when --gg mode is on, the
-## rule database contained items from the OLD
-## fdb file. Using --gg mode implies that
-## the rules in the OLD fdb file must be
-## ignored (since they may be wrong).
-## 1 Oct 2012 John Collins V. 4.34
-## Correct problem that if a file is read by
-## latex only after being written, it is
-## not a true source file.
-## 19 Aug 2012 John Collins V. 4.33c
-## Correct infinite loop when maximum passes
-## exceeded.
-## Improve error messages
-## 12 Aug 2012 John Collins V. 4.33b
-## Improve text displayed by -showextraoptions
-## 8 Aug 2012 John Collins V. 4.33a
-## Fix problem that with Cygwin,
-## latexmk runs very slowly, because
-## subroutine good_cwd() runs the
-## program cygpath on every
-## invocation. Solution: cach cwd.
-## 6 Aug 2012 John Collins Version number to 4.33
-## 4 Aug 2012 John Collins Further fixes of filename treatment:
-## normalize_filename routine to remove
-## string for current directory, and
-## convert '\' directory separator to '/'
-## (Note MiKTeX uses BOTH, see e.g., its
-## log file, so MSWin systems are NOT
-## guaranteed to be consistent. But latexmk
-## needs to treat filenames differing by
-## change of directory separator as equivalent.
-## Warning: SOME MWWin programs, e.g., current
-## cmd.exe (as tested yesterday on PSU computer
-## in library) do not accept '/' as directory
-## separator, so it may be worth allowing conversion
-## to '\' in executed files.)
-## Also improve running when $silent is on:
-## don't print warnings about undefined references
-## and citations, but simply display a summary, whose
-## criterion for being shown had to be fixed.
-## 3 Aug 2012 John Collins Fix finding of files in aux-dir
-## 1 Aug 2012 John Collins Handle aliasing of cwd in output file
-## to avoid unnecessary warnings about
-## actual o/p file .ne. expected with MiKTeX
-## Clean up subroutine names:
-## parse_logB to parse_log
-## make_preview_continuousB to make_preview_continuous
-## rdb_find_new_filesB to rdb_find_new_files
-## rdb_set_dependentsA to rdb_set_dependents
-## rdb_makeB to rdb_make
-## rdb_makeB1 to rdb_make1
-## rdb_one_depA to rdb_one_dep
-## rdb_recurseA to rdb_recurse
-## rdb_update_filesA to rdb_update_files
-## 28, 29, 30 Jul 2012 John Collins Try better file-name normalization in reading fls file.
-## 18 Jul 2012 John Collins Change ver. to 4.32d.
-## Merge changes from 29 June 2012:
-## Add $dvipdf_silent_switch
-## 17 Jul 2012 John Collins Try better fix for error/rerun and retest issue.
-## Now rdb_primary_run doesn't have so many complications
-## rdb_makeB's PASS loop is simpler
-## rdb_submakeB is unneeded.
-## See the lines starting #??
-## See comments nearby
-## Compare w/ v. 4.32a
-## V. 4.32b
-## 17 Jul 2012 John Collins Fix problem that after finding error in a run
-## of (pdf)latex, latexmk didn't check for
-## changed files before giving up.
-## To do that, I reverted some changes in
-## rdb_primary_run to pre v. 4.31
-## Remove unused code
-## v. 4.32a
-## 8 May 2012 John Collins Possibility to substitute backslashes for
-## forward slashes in file and directory
-## names in executed command line,
-## for MSWin
-## 5 May 2012 John Collins Comment on ctrl/C handling in WAIT loop
+## 10 Nov 2013 John Collins Change split / /, ... to split /\s*/, ...
+## so as to be immune from extra white space.
+## Clean up $clean_ext and $clean_full_ext by removing
+## superfluous white space.
+## 8 Nov 2013 John Collins Automatic creation of necessary
+## subdirectories of auxdir when
+## needed for writing aux files.
+## 3 Nov 2013 John Collins Correction to 1 Nov
+## 1 Nov 2013 John Collins Add error diagnostics to if_source.
+## Allow $print_type = 'auto', and make
+## this the default.
+## 30 Oct 2013 John Collins Do better fix for dealing with special
+## characters in directory names used in
+## regexes. Use \Q \E. There are three
+## occurences of the issue.
+## Fix potential problem with globbing when
+## a specified (i.e., non-wildcarded) part
+## of the pattern has glob metacharacters.
+## Use File::Glob to give glob that doesn't
+## take space character as item separator.
+## 16 Oct 2013 John Collins Use make_path from File::Path instead of
+## mkdir to give autocreation of intermediate
+## directories.
+## This gives dependency on File::Path
+## 19 Jul 2013 John Collins V. 4.39.
+## In output of dependencies, include pathname of
+## target file(s) in the rule.
+## 19 Jul 2013 John Collins V. 4.38.
+## In -pvc mode, writing of deps file (caused by
+## -M option) is per make not per overall run.
+## %extra_rule_spec variable as hook for templates
+## for new rules.
##
## 1998-2010, John Collins. Many improvements and fixes.
## See CHANGE-log.txt for full list, and CHANGES for summary
@@ -445,6 +354,13 @@ $log_wrap = 79;
# are of a fixed size (as with a date/time stamp).
%hash_calc_ignore_pattern =();
+
+# Specification of templates for extra rules.
+# See subroutine rdb_make_rule_list for examples of rule templates.
+# See subroutine rdb_set_rules for how they get used to construct rules.
+# (Documentation obviously needs to be improved!)
+%extra_rule_spec = ();
+
#########################################################################
## Default document processing programs, and related settings,
## These are mostly the same on all systems.
@@ -669,8 +585,10 @@ $kpsewhich = 'kpsewhich %S';
$make = 'make';
##Printing:
-$print_type = 'ps'; # When printing, print the postscript file.
- # Possible values: 'dvi', 'ps', 'pdf', 'none'
+$print_type = 'auto'; # When printing, print the postscript file.
+ # Possible values: 'dvi', 'ps', 'pdf', 'auto', 'none'
+ # 'auto' ==> set print type according to the printable
+ # file(s) being made: priority 'ps', 'pdf', 'dvi'
## Which treatment of default extensions and filenames with
## multiple extensions is used, for given filename on
@@ -691,6 +609,8 @@ $dvi_update_command = undef;
$ps_update_command = undef;
$pdf_update_command = undef;
+$allow_subdir_creation = 1;
+
$new_viewer_always = 0; # If 1, always open a new viewer in pvc mode.
# If 0, only open a new viewer if no previous
# viewer for the same file is detected.
@@ -1629,7 +1549,7 @@ while ($_ = $ARGV[0])
elsif (/^-pdfps$/) { $pdf_mode = 2; }
elsif (/^-print=(.*)$/) {
$value = $1;
- if ( $value =~ /^dvi$|^ps$|^pdf$/ ) {
+ if ( $value =~ /^dvi$|^ps$|^pdf$|^auto$/ ) {
$print_type = $value;
$printout_mode = 1;
}
@@ -1818,7 +1738,7 @@ if ($bibtex_use > 1) {
# Since $texfile_search is initialized to "", a nonzero value indicates
# that an initialization file has set it.
if ( $texfile_search ne "" ) {
- @default_files = split / /, "*.tex $texfile_search";
+ @default_files = split /\s+/, "*.tex $texfile_search";
}
#Glob the filenames command line if the script was not invoked under a
@@ -1966,7 +1886,7 @@ if ( $out_dir ) {
if ( ! -e $out_dir ) {
warn "$My_name: making output directory '$out_dir'\n"
if ! $silent;
- mkdir $out_dir;
+ make_path $out_dir;
}
elsif ( ! -d $out_dir ) {
warn "$My_name: you requested output directory '$out_dir',\n",
@@ -1983,7 +1903,7 @@ if ( $aux_dir && ($aux_dir ne $out_dir) ) {
if ( ! -e $aux_dir ) {
warn "$My_name: making auxiliary directory '$aux_dir'\n"
if ! $silent;
- mkdir $aux_dir;
+ make_path $aux_dir;
}
elsif ( ! -d $aux_dir ) {
warn "$My_name: you requested aux directory '$aux_dir',\n",
@@ -2036,7 +1956,18 @@ if ( $postscript_mode ) {
$requested_filerules{'latex'} = 1;
$requested_filerules{'dvips'} = 1;
}
-if ( $printout_mode ) { $one_time{'print'} = 1; }
+if ($print_type eq 'auto') {
+ if ( $postscript_mode ) { $print_type = 'ps'; }
+ elsif ( $pdf_mode ) { $print_type = 'pdf'; }
+ elsif ( $dvi_mode ) { $print_type = 'dvi'; }
+ else { $print_type = 'none'; }
+}
+if ( $printout_mode ) {
+ $one_time{'print'} = 1;
+ if ($print_type eq 'none'){
+ warn "$My_name: You have requested printout, but \$print_type is set to 'none'\n";
+ }
+}
if ( $preview_continuous_mode || $preview_mode ) { $one_time{'view'} = 1; }
if ( length($dvi_filter) != 0 ) { $requested_filerules{'dvi_filter'} = 1; }
if ( length($ps_filter) != 0 ) { $requested_filerules{'ps_filter'} = 1; }
@@ -2103,13 +2034,24 @@ if ($deps_file eq '' ) {
$deps_file = '-';
}
-if ( $dependents_list ) {
+# In non-pvc mode, the dependency list is global to all processed TeX files,
+# so we open a single file here, and add items to it after processing each file
+# But in -pvc mode, the dependency list should be written after round of
+# processing the single TeX file (as if each round were a separate run of
+# latexmk). There's undoubtedly some non-optimal structuring here!
+if ( $dependents_list && ! $preview_continuous_mode ) {
$deps_handle = new FileHandle "> $deps_file";
if (! defined $deps_handle ) {
die "Cannot open '$deps_file' for output of dependency information\n";
}
}
+# Remove leading and trailing space in the following space-separated lists,
+# and collapse multiple spaces to one,
+# to avoid getting incorrect blank items when they are split.
+foreach ($clean_ext, $clean_full_ext) { s/^\s+//; s/\s+$//; s/\s+/ /g; }
+
+
FILE:
foreach $filename ( @file_list )
{
@@ -2158,7 +2100,7 @@ foreach $filename ( @file_list )
# ?? Should I also initialize file database?
%rule_list = ();
&rdb_make_rule_list;
- &rdb_set_rules(\%rule_list);
+ &rdb_set_rules(\%rule_list, \%extra_rule_spec );
if ( $cleanup_mode > 0 ) {
# ?? MAY NEED TO FIX THE FOLLOWING IF $aux_dir or $out_dir IS SET.
@@ -2241,7 +2183,7 @@ foreach $filename ( @file_list )
keys %other_generated );
}
&cleanup1( $aux_dir1, $fdb_ext, 'blg', 'ilg', 'log', 'aux.bak', 'idx.bak',
- split(' ',$clean_ext),
+ split('\s+',$clean_ext),
keys %generated_exts_all
);
unlink_or_move( 'texput.log', "texput.aux",
@@ -2255,7 +2197,7 @@ foreach $filename ( @file_list )
}
if ( $cleanup_mode == 1 ) {
&cleanup1( $out_dir1, 'dvi', 'dviF', 'ps', 'psF', 'pdf',
- split(' ', $clean_full_ext)
+ split('\s+', $clean_full_ext)
);
}
}
@@ -2369,7 +2311,7 @@ foreach $filename ( @file_list )
if ($failure > 0) { next FILE; }
} # end FILE
continue {
- if ($dependents_list) { deps_list($deps_handle); }
+ if ($deps_handle) { deps_list($deps_handle); }
# If requested, print the list of rules. But don't do this in -pvc
# mode, since the rules list has already been printed.
if ($rules_list && ! $preview_continuous_mode) { rdb_list(); }
@@ -2481,6 +2423,7 @@ sub add_option {
#############################################################
sub rdb_make_rule_list {
+# Set up specifications for standard rules, adjusted to current conditions
# Substitutions: %S = source, %D = dest, %B = this rule's base
# %T = texfile, %R = root = base for latex.
# %Y for $aux_dir1, %Z for $out_dir1
@@ -2498,7 +2441,7 @@ sub rdb_make_rule_list {
}
my $print_file = '';
- my $print_cmd = '';
+ my $print_cmd = 'NONE';
if ( $print_type eq 'dvi' ) {
$print_file = $dvi_final;
$print_cmd = $lpr_dvi;
@@ -2511,6 +2454,9 @@ sub rdb_make_rule_list {
$print_file = $ps_final;
$print_cmd = $lpr;
}
+ elsif ( $print_type eq 'none' ) {
+ $print_cmd = 'NONE echo NO PRINTING CONFIGURED';
+ }
my $view_file = '';
my $viewer = '';
@@ -2798,6 +2744,7 @@ sub if_source {
return &Run_subst();
}
else {
+ warn "Needed source file '$$Psource' does not exist.\n";
return -1;
}
} #END if_source
@@ -3042,6 +2989,16 @@ CHANGE:
rdb_show_rule_errors();
if ($rules_list) { rdb_list(); }
if ($show_time && ! $first_time) { show_timing(); }
+ if ( $dependents_list && ($updated || $failure) ) {
+ my $deps_handle = new FileHandle "> $deps_file";
+ if ( defined $deps_handle ) {
+ deps_list($deps_handle);
+ close($deps_handle);
+ }
+ else {
+ warn "Cannot open '$deps_file' for output of dependency information\n";
+ }
+ }
if ( $first_time || $updated || $failure ) {
print "\n=== Watching for updated files. Use ctrl/C to stop ...\n";
}
@@ -3170,7 +3127,10 @@ sub execute_code_string {
sub cleanup1 {
# Usage: cleanup1( directory, exts_without_period, ... )
- my $dir = shift;
+ #
+ # The directory is a fixed name, so I must escape any glob metacharacters
+ # in it:
+ my $dir = fix_pattern( shift );
foreach (@_) {
(my $name = /%R/ ? $_ : "%R.$_") =~ s/%R/$dir$root_filename/;
unlink_or_move( glob( "$name" ) );
@@ -3408,8 +3368,8 @@ sub print_help
} #END print_help
#************************************************************
-sub print_commands
-{
+
+sub print_commands {
warn "Commands used by $my_name:\n",
" To run latex, I use \"$latex\"\n",
" To run pdflatex, I use \"$pdflatex\"\n",
@@ -3570,7 +3530,9 @@ sub check_biber_log {
sub run_bibtex {
my $return = 999;
if ( $aux_dir ) {
- if ( $$Psource =~ /^$aux_dir1/ ) {
+ # Use \Q and \E round directory name in regex to avoid interpretation
+ # of metacharacters in directory name:
+ if ( $$Psource =~ /^\Q$aux_dir1\E/ ) {
# Run bibtex in $aux_dir, fixing input search path
# to allow for finding files in original directory
my ( $base, $path, $ext ) = fileparseA( $$Psource );
@@ -3717,6 +3679,12 @@ sub parse_log {
# %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.
+# @missing_subdirs = list of needed subdirectories of aux_dir
+# These are needed for writing aux_files when an included file is in
+# a subdirectory relative to the directory of the main TeX file.
+# This variable is only set when the needed subdirectories don't exist,
+# and the aux_dir is non-trivial, which results in an error message in
+# the log file
# Also set
# $reference_changed, $bad_reference, $bad_citation
# Trivial or default values if log file does not exist/cannot be opened
@@ -3739,6 +3707,8 @@ sub parse_log {
%idx_files = (); # Maps idx_file to (ind_file, base)
%generated_log = ();
%conversions = ();
+ @missing_subdirs = ();
+
# $primary_out is actual output file (dvi or pdf)
# It is initialized before the call to this routine, to ensure
# a sensible default in case of misparsing
@@ -4012,6 +3982,24 @@ LINE:
if (/^\! LaTeX Error: / ) {
next LINE;
}
+ if ( m[^! I can't write on file `(.*)/([^/']*)'.\s*$] ) {
+ my $dir = $1;
+ my $file = $2;
+ my $full_dir = $aux_dir1.$dir;
+ if ( ($aux_dir ne '') && (! -e $full_dir) && ( $file =~ /\.aux$/) ) {
+ warn "$My_name: === There were problems writing to '$file' in '$full_dir'\n",
+ " I'll try to make the subdirectory later.\n"
+ if $diagnostics;
+ push @missing_subdirs, $full_dir;
+ }
+ else {
+ warn "$My_name: ====== There were problems writing to",
+ "----- '$file' in '$full_dir'.\n",
+ "----- But this is not the standard situation of\n",
+ "----- aux file to subdir of output directory, with\n",
+ "----- non-existent subdir\n",
+ }
+ }
INCLUDE_CANDIDATE:
while ( /\((.*$)/ ) {
# Filename found by
@@ -4392,13 +4380,10 @@ sub normalize_filename {
# Remove current directory string:
$file =~ s(^\./)();
- # It would be natural to use a regexp to do the replacement of cwd:
- # $file =~ s(^$cwd/)();
- # But the string in $cwd may contain characters that have special
- # meaning in a regexp. So we must do it the hard way:
- if ( substr( $file, 0, length($cwd)+1 ) eq $cwd.'/' ) {
- $file = substr( $file, length($cwd)+1 );
- }
+ # Remove initial component equal to current working directory.
+ # Use \Q and \E round directory name in regex to avoid interpretation
+ # of metacharacters in directory name:
+ $file =~ s(^\Q$cwd\E/)();
return $file;
}
@@ -4413,6 +4398,17 @@ sub normalize_clean_filename {
#************************************************************
+sub fix_pattern {
+ # Escape the characters [ and {, to give a pattern for use in glob
+ # with these characters taken literally.
+ my $pattern = shift;
+ $pattern =~ s/\[/\\\[/g;
+ $pattern =~ s/\{/\\\{/g;
+ return $pattern;
+}
+
+#************************************************************
+
sub OS_preferred_filename {
# Usage: OS_preferred_filename(name)
# Returns filename with directory separator '/' converted
@@ -4715,7 +4711,7 @@ LINE:
$dest = "$base.$toext";
my $PAnew_cmd = ['do_cusdep', ''];
foreach my $dep ( @cus_dep_list ) {
- my ($tryfromext,$trytoext,$must,$func_name) = split(' ',$dep);
+ my ($tryfromext,$trytoext,$must,$func_name) = split('\s+',$dep);
if ( ($tryfromext eq $fromext) && ($trytoext eq $toext) ) {
$$PAnew_cmd[1] = $func_name;
}
@@ -4924,10 +4920,49 @@ sub rdb_set_latex_deps {
local %conversions = (); # (pdf)latex-performed conversions.
# Maps output file created and read by (pdf)latex
# to source file of conversion.
+ local @missing_subdirs = (); # Missing subdirectories in aux_dir
+
# The following are also returned, but are global, to be used by caller
# $reference_changed, $bad_reference $bad_citation
&parse_log;
+ $missing_dirs = 'none'; # Status of missing directories
+ if (@missing_subdirs) {
+ $missing_dirs = 'success';
+ if ($allow_subdir_creation) {
+ foreach my $dir ( uniqs( @missing_subdirs ) ) {
+ if ( -d $dir ) {
+ $missing_dirs = 'failure';
+ warn "$My_name: ==== Directory '$dir' is said to be missing\n",
+ " But it exists!\n";
+ }
+ elsif ( (-e $dir) && (!-d $dir) ) {
+ $missing_dirs = 'failure';
+ warn "$My_name: ==== Directory '$dir' is said to be missing\n",
+ " But a non-directory file of this name exists!\n";
+ }
+ else {
+ if (mkdir $dir) {
+ warn "$My_name: Directory '$dir' created\n";
+ }
+ else {
+ $missing_dirs = 'failure';
+ warn "$My_name: Couldn't create directory '$dir'.\n",
+ " System error: '$!'\n";
+ }
+ }
+ }
+ }
+ else {
+ $missing_dirs = 'not allowed';
+ warn "$My_name: There are missing subdirectories, but their creation\n",
+ " is not allowed. The subdirectories are:\n";
+ foreach my $dir ( uniqs( @missing_subdirs ) ) {
+ warn " '$dir'\n";
+ }
+ }
+ }
+
my $fls_file = "$aux_dir1$root_filename.fls";
if ($recorder && test_gen_file($fls_file) ) {
parse_fls( $fls_file, \%source_fls, \%generated_fls, \%first_read_after_write );
@@ -5184,7 +5219,7 @@ MISSING_FILE:
}
if ( $ext ne "" ) {
foreach my $dep (@cus_dep_list){
- my ($fromext,$toext) = split(' ',$dep);
+ my ($fromext,$toext) = split('\s+',$dep);
if ( ( "$ext" eq "$toext" )
&& ( -e "$path$base.$fromext" )
) {
@@ -5203,7 +5238,7 @@ MISSING_FILE:
# $_ doesn't exist, $_.tex doesn't exist,
# and $_ doesn't have an extension
foreach my $dep (@cus_dep_list){
- my ($fromext,$toext) = split(' ',$dep);
+ my ($fromext,$toext) = split('\s+',$dep);
if ( -e "$path$base.$fromext" ) {
# Source file for the missing file exists
# So we have a real include file, and it will be made
@@ -5291,7 +5326,7 @@ sub rdb_one_dep {
my $Pinput_extensions = $input_extensions{$rule};
DEP:
foreach my $dep ( @cus_dep_list ) {
- my ($fromext,$proptoext,$must,$func_name) = split(' ',$dep);
+ my ($fromext,$proptoext,$must,$func_name) = split('\s+',$dep);
if ( $toext eq $proptoext ) {
my $source = "$base_name.$fromext";
# Found match of rule
@@ -5439,10 +5474,10 @@ sub deps_list {
# List dependent files to file open on fh
my $fh = $_[0];
print $fh "#===Dependents for $filename:\n";
- my @dest = ();
- if ($pdf_mode) {push @dest, '.pdf';}
- if ($dvi_mode) {push @dest, '.dvi';}
- if ($postscript_mode) {push @dest, '.ps';}
+ my @dest_exts = ();
+ if ($pdf_mode) {push @dest_exts, '.pdf';}
+ if ($dvi_mode) {push @dest_exts, '.dvi';}
+ if ($postscript_mode) {push @dest_exts, '.ps';}
my %source = ( $texfile_name => 1 );
my @generated = ();
my @accessible_all = rdb_accessible( keys %requested_filerules );
@@ -5461,11 +5496,11 @@ sub deps_list {
foreach (@generated) {
delete $source{$_};
}
- foreach my $dest (@dest) {
+ foreach my $ext (@dest_exts) {
if ($deps_file eq '-' ) {
- print $fh "$root_filename$dest :";
+ print $fh "${out_dir1}${root_filename}${ext} :";
} else {
- print $fh "$root_filename$dest $deps_file :";
+ print $fh "${out_dir1}${root_filename}${ext} $deps_file :";
}
foreach (sort keys %source) {
print $fh "\\\n $_";
@@ -7227,14 +7262,10 @@ sub glob_list1 {
my @globbed = ();
foreach my $file_spec (@_) {
# Problem, when the PATTERN contains spaces, the space(s) are
- # treated as pattern separaters (in MSWin at least).
- # MSWin: I can quote the pattern (is that MSWin native, or also
- # cygwin?)
- # Linux: Quotes in a pattern are treated as part of the filename!
- # So quoting a pattern is definitively wrong.
- # The following hack solves this partly, for the cases that there is no wildcarding
- # and the specified file exists possibly space-containing, and that there is wildcarding,
- # but spaces are prohibited.
+ # treated as pattern separaters.
+ # Solution: I now the glob from use File::Glob.
+ # The following hack avoids issues with glob in the case that a file exists
+ # with the specified name (possibly with extension .tex):
if ( -e $file_spec || -e "$file_spec.tex" ) {
# Non-globbed file exists, return the file_spec.
# Return $file_spec only because this is not a file-finding subroutine, but
@@ -7612,7 +7643,9 @@ sub remove_cus_dep {
my ($from_ext, $to_ext) = @_;
my $i = 0;
while ($i <= $#cus_dep_list) {
- if ( $cus_dep_list[$i] =~ /^$from_ext $to_ext / ) {
+ # Use \Q and \E round directory name in regex to avoid interpretation
+ # of metacharacters in directory name:
+ if ( $cus_dep_list[$i] =~ /^\Q$from_ext $to_ext \E/ ) {
splice @cus_dep_list, $i, 1;
}
else {
@@ -8064,7 +8097,7 @@ sub find_process_id {
shift(@ps_output); # Discard the header line from ps
foreach (@ps_output) {
next unless ( /$looking_for/ ) ;
- my @ps_line = split (' ');
+ my @ps_line = split ('\s+');
# OLD return($ps_line[$pid_position]);
push @found, $ps_line[$pid_position];
}
diff --git a/Master/tlpkg/libexec/ctan2tds b/Master/tlpkg/libexec/ctan2tds
index 39a33c0cd51..3569e00f665 100755
--- a/Master/tlpkg/libexec/ctan2tds
+++ b/Master/tlpkg/libexec/ctan2tds
@@ -153,7 +153,7 @@ chomp ($Build = `cd $Master/../Build/source && pwd`);
'bengali', "&MAKEflatten",
'bengali-omega', "die 'skipping, duplicates odev.sty et al.'",
'bera', "&MAKEunzipandflatten",
- 'berenisadf', "&MAKEcopy",
+# 'berenisadf', "&MAKEcopy",
'babeltools', "die 'skipping, use bezos'",
'bg', "die 'skipping, nonfree license'",
'bgreek', "&MAKEcopy",