summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/support/latexmk/README4
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.183
-rwxr-xr-xMaster/texmf-dist/doc/support/latexmk/latexmk.bat10
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.pdfbin148039 -> 155123 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.txt636
-rwxr-xr-xMaster/texmf-dist/scripts/latexmk/latexmk.pl336
6 files changed, 665 insertions, 404 deletions
diff --git a/Master/texmf-dist/doc/support/latexmk/README b/Master/texmf-dist/doc/support/latexmk/README
index aa1cc45a7e4..7a3b07a87c4 100644
--- a/Master/texmf-dist/doc/support/latexmk/README
+++ b/Master/texmf-dist/doc/support/latexmk/README
@@ -1,4 +1,4 @@
-Hi, and thanks for checking out latexmk. (Version 4.01, 24 September 2008)
+Hi, and thanks for checking out latexmk. (Version 4.05, 10 April 2009)
Latexmk completely automates the process of generating a LaTeX document.
Essentially, it is a highly specialized cousin of the general make
@@ -88,7 +88,7 @@ I hope you find this useful.
John Collins
---------------------------- "latexmk -h" ----------------------------
-Latexmk 4.03: Automatic LaTeX document generation routine
+Latexmk 4.05: Automatic LaTeX document generation routine
Usage: latexmk [latexmk_options] [filename ...]
diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.1 b/Master/texmf-dist/doc/support/latexmk/latexmk.1
index 25132b0cfee..c50258b3f28 100644
--- a/Master/texmf-dist/doc/support/latexmk/latexmk.1
+++ b/Master/texmf-dist/doc/support/latexmk/latexmk.1
@@ -1,4 +1,4 @@
-.TH LATEXMK 1L "22 December 2008" ""
+.TH LATEXMK 1L "10 April 2009" ""
.SH NAME
latexmk \- generate LaTeX document
.SH SYNOPSIS
@@ -14,6 +14,9 @@ source file for a document, and it issues the appropriate sequence of
commands to generate a .dvi, .ps, .pdf and/or hardcopy version of the
document.
.PP
+By default \fIlatexmk\fR will run the commands necessary to generate a
+.dvi file.
+.PP
\fILatexmk\fR can also be set to run continuously with a suitable
previewer. In that case the LaTeX program, etc, are rerun whenever
one of the source files is modified, and the previewer automatically
@@ -808,9 +811,14 @@ filename specifications is possible.
The dvi file filter to be run on the newly produced dvi file before
other processing. Equivalent to specifying the \fB-dF\fR option.
.TP
-.B $dvi_mode [0]
+.B $dvi_mode [See below for default]
If nonzero, generate a dvi version of the document.
Equivalent to the \fB-dvi\fR option.
+.PP
+The variable $dvi_mode defaults to 0, but if no explicit requests are
+made for other types of file (postscript, pdf), then $dvi_mode will be
+set to 1. In addition, if a request for a file for which a .dvi file
+is a prerequisite, then $dvi_mode will be set to 1.
.TP
.B $dvi_previewer ["start xdvi %O %S" under UNIX]
The command to invoke a dvi-previewer.
@@ -979,6 +987,39 @@ but also specify options to the program. E.g.,
$latex = "latex --src-specials";
.TP
+.B %latex_input_extensions
+This variable specifies the extensions tried by latexmk when it finds
+that a LaTeX run resulted in an error that a file has not been found,
+and the file is given without an extension. This typically happens when
+LaTeX commands of the form \input{file} or \includegraphics{figure},
+when the relevant source file does not exist.
+
+In this situation, latexmk searches for custom dependencies to make
+the missing file(s), but restricts it to the extensions specified by
+the variable %latex_input_extensions. The default extensions are
+'tex' and 'eps'.
+
+(For Perl experts: %latex_input_extensions is a hash whose keys are
+the extensions. The values are irrelevant.) Two subroutines are
+provided for manipulating this and the related variable
+%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' );
+
+removes the extension 'tex' from latex_input_extensions
+
+ add_input_ext( 'latex', 'asdf' );
+
+add the extension 'asdf to latex_input_extensions. (Naturally with
+such an extension, you should have made an appropriate 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 LaTeX and its graphics/graphicx
+packages.
+
+.TP
.B $latex_silent_switch ["-interaction=batchmode"]
Switch(es) for the LaTeX processing program when silent mode is on.
Under MS-Windows, the default value is changed to
@@ -1054,6 +1095,39 @@ Equivalent to the \fB-pdf-\fR, \fB-pdf\fR, \fB-pdfdvi\fR,
The LaTeX processing program in the version that makes a pdf file instead
of a dvi file.
.TP
+.B %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 \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 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 subroutines 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' );
+
+removes the extension 'tex' from pdflatex_input_extensions
+
+ add_input_ext( 'pdflatex', 'asdf' );
+
+add the extension 'asdf to pdflatex_input_extensions. (Naturally with
+such an extension, you should have made an appropriate 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 pdflatex and its graphics/graphicx
+packages.)
+
+.TP
.B $pdflatex_silent_switch ["-interaction=batchmode"]
Switch(es) for the pdflatex program (specified in the variable
\fI$pdflatex\fR when silent mode is on.
@@ -1121,6 +1195,9 @@ corresponds to the process ID. The first word in the line is numbered
.B $postscript_mode [0]
If nonzero, generate a postscript version of the document.
Equivalent to the \fB-ps\fR option.
+.PP
+If some other request is made for which a postscript file is needed,
+then $postscript_mode will be set to 1.
.TP
.B $preview_continuous_mode [0]
If nonzero, run a previewer to view the document, and
@@ -1462,7 +1539,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.03).
+(Version 4.05).
Released version can be obtained from CTAN:
<http://www.tug.org/tex-archive/support/latexmk/>, and from the
diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.bat b/Master/texmf-dist/doc/support/latexmk/latexmk.bat
index 48e01d6e5e1..f119082adac 100755
--- a/Master/texmf-dist/doc/support/latexmk/latexmk.bat
+++ b/Master/texmf-dist/doc/support/latexmk/latexmk.bat
@@ -1,5 +1,5 @@
-Rem Execute latexmk.pl, searching for it in the PATH
-Rem Assume perl is in the PATH. If not, you should replace 'perl' by
-Rem the full pathname of the perl executable, e.g., 'C:\perl\bin\perl.exe'
-
-perl -S latexmk.pl %1 %2 %3 %4 %5 %6 %7 %8 %9
+Rem Execute latexmk.pl, searching for it in the PATH
+Rem Assume perl is in the PATH. If not, you should replace 'perl' by
+Rem the full pathname of the perl executable, e.g., 'C:\perl\bin\perl.exe'
+
+perl -S latexmk.pl %1 %2 %3 %4 %5 %6 %7 %8 %9
diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf
index 1220cb0574e..d804f857a68 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 1e67ad04111..2248a598c3e 100644
--- a/Master/texmf-dist/doc/support/latexmk/latexmk.txt
+++ b/Master/texmf-dist/doc/support/latexmk/latexmk.txt
@@ -14,6 +14,8 @@ DESCRIPTION
and it issues the appropriate sequence of commands to generate a .dvi,
.ps, .pdf and/or hardcopy version of the document.
+ By default latexmk will run the commands necessary to generate a
+
Latexmk can also be set to run continuously with a suitable previewer.
In that case the LaTeX program, etc, are rerun whenever one of the
source files is modified, and the previewer automatically updates the
@@ -56,8 +58,6 @@ DESCRIPTION
Latexmk has the ability to print a banner in gray diagonally across
each page when making the postscript file. It can also, if needed,
call an external program to do other postprocessing on the generated
- files.
-
@@ -70,6 +70,8 @@ DESCRIPTION
LATEXMK(1L) LATEXMK(1L)
+ files.
+
Latexmk is highly configurable, both from the command line and in con-
figuration files, so that it can accommodate a wide variety of user
needs and system configurations. Default values are set according to
@@ -122,12 +124,10 @@ LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE
-bi <intensity>
How dark to print the banner message. A decimal number between
0 and 1. 0 is black and 1 is white. The default is 0.95, which
- is OK unless your toner cartridge is getting low.
-
- 22 December 2008 2
+ 10 April 2009 2
@@ -136,6 +136,8 @@ LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE
LATEXMK(1L) LATEXMK(1L)
+ is OK unless your toner cartridge is getting low.
+
-bs <scale>
A decimal number that specifies how large the banner message
will be printed. Experimentation is necessary to get the right
@@ -189,11 +191,10 @@ LATEXMK(1L) LATEXMK(1L)
-dF Dvi file filtering. The argument to this option is a filter
which will generate a filtered dvi file with the extension
- ".dviF". All extra processing (e.g. conversion to postscript,
- 22 December 2008 3
+ 10 April 2009 3
@@ -202,6 +203,7 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ ".dviF". All extra processing (e.g. conversion to postscript,
preview, printing) will then be performed on this filtered dvi
file.
@@ -259,7 +261,7 @@ LATEXMK(1L) LATEXMK(1L)
- 22 December 2008 4
+ 10 April 2009 4
@@ -322,10 +324,11 @@ LATEXMK(1L) LATEXMK(1L)
$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
- 22 December 2008 5
+ 10 April 2009 5
@@ -334,7 +337,6 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- This option is incompatible with the -pv and -pvc options, so it
turns them off.
-pdf Generate pdf version of document using pdflatex.
@@ -388,19 +390,19 @@ LATEXMK(1L) LATEXMK(1L)
viewer will be used. This option is incompatible with the -p
and -pvc options, so it turns them off.
+ -pv- Turn off -pv.
- 22 December 2008 6
+ 10 April 2009 6
-LATEXMK(1L) LATEXMK(1L)
+LATEXMK(1L) LATEXMK(1L)
- -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
@@ -454,21 +456,21 @@ LATEXMK(1L) LATEXMK(1L)
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
- 22 December 2008 7
+ 10 April 2009 7
-LATEXMK(1L) LATEXMK(1L)
+LATEXMK(1L) LATEXMK(1L)
- 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
@@ -521,20 +523,19 @@ EXAMPLES
keep running, watching for
source file changes.
+ % latexmk -c # remove .aux, .log, .bbl, .blg, .dvi,
+ .pdf, .ps & .bbl files
- 22 December 2008 8
-
+ 10 April 2009 8
-LATEXMK(1L) LATEXMK(1L)
- % latexmk -c # remove .aux, .log, .bbl, .blg, .dvi,
- .pdf, .ps & .bbl files
+LATEXMK(1L) LATEXMK(1L)
CONFIGURATION/INITIALIZATION (RC) FILES
@@ -587,21 +588,22 @@ HOW TO SET VARIABLES IN INITIALIZATION FILES
for the setting of a numeric variable, and
+ @default_files = ('paper', 'paper1');
+ for the setting of an array of strings. It is possible to append an
+ item to an array variable as follows:
- 22 December 2008 9
+ 10 April 2009 9
-LATEXMK(1L) LATEXMK(1L)
- @default_files = ('paper', 'paper1');
- for the setting of an array of strings. It is possible to append an
- item to an array variable as follows:
+LATEXMK(1L) LATEXMK(1L)
+
push @default_files, 'paper2';
@@ -653,10 +655,15 @@ FORMAT OF COMMAND SPECIFICATIONS
%T The name of the primary tex file.
+ The distinction between %B and %R needs a bit of care, since they are
+ often the same, but not always. For example on a simple document, the
+ basename of a bibtex run is the same as for the texfile. But in a doc-
+ ument with several bibliographies, the bibliography files will have a
+ variety of names. Since bibtex is invoked with the basename of the
- 22 December 2008 10
+ 10 April 2009 10
@@ -665,11 +672,6 @@ FORMAT OF COMMAND SPECIFICATIONS
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
@@ -721,21 +723,22 @@ LATEXMK(1L) LATEXMK(1L)
Using MS-Windows file associations: A useful trick under modern ver-
sions of MS-Windows (e.g., WinXP) is to use just the command
+ $dvi_previewer = 'start %S';
+ Under recent versions of MS-Windows, this will cause to be run whatever
+ program the system has associated with dvi files. (The same applies
- 22 December 2008 11
+ 10 April 2009 11
-LATEXMK(1L) LATEXMK(1L)
- $dvi_previewer = 'start %S';
+LATEXMK(1L) LATEXMK(1L)
+
- Under recent versions of MS-Windows, this will cause to be run whatever
- program the system has associated with dvi files. (The same applies
for a postscript viewer and a pdf viewer.)
Not using a certain command: If a command is not to be run, the command
@@ -788,9 +791,13 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
and the postscript file is always generated, even if it is newer
than the dvi file.
+ $banner_intensity [0.95]
+ Equivalent to the -bi option, this is a decimal number between 0
+ and 1 that specifies how dark to print the banner message. 0 is
- 22 December 2008 12
+
+ 10 April 2009 12
@@ -799,9 +806,6 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
LATEXMK(1L) LATEXMK(1L)
- $banner_intensity [0.95]
- Equivalent to the -bi option, this is a decimal number between 0
- and 1 that specifies how dark to print the banner message. 0 is
black, 1 is white. The default is just right if your toner car-
tridge isn't running too low.
@@ -854,20 +858,20 @@ LATEXMK(1L) LATEXMK(1L)
$cleanup_includes_generated [0]
If nonzero, specifies that cleanup also deletes files that are
detected in log file as being generated (see the \openout lines
+ in the log file). It will also include files made from these
+ first generation generated files.
- 22 December 2008 13
+ 10 April 2009 13
-LATEXMK(1L) LATEXMK(1L)
+LATEXMK(1L) LATEXMK(1L)
- in the log file). It will also include files made from these
- first generation generated files.
$cleanup_mode [0]
If nonzero, specifies cleanup mode: 1 for full cleanup, 2 for
@@ -921,10 +925,13 @@ LATEXMK(1L) LATEXMK(1L)
are because @default_files is an array variable, i.e., a
sequence of filename specifications is possible.
+ $dvi_filter [empty]
+ The dvi file filter to be run on the newly produced dvi file
+ before other processing. Equivalent to specifying the -dF
- 22 December 2008 14
+ 10 April 2009 14
@@ -933,65 +940,65 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- $dvi_filter [empty]
- The dvi file filter to be run on the newly produced dvi file
- before other processing. Equivalent to specifying the -dF
option.
- $dvi_mode [0]
+ $dvi_mode [See below for default]
If nonzero, generate a dvi version of the document. Equivalent
to the -dvi option.
+ The variable $dvi_mode defaults to 0, but if no explicit requests are
+ made for other types of file (postscript, pdf), then $dvi_mode will be
+ set to 1. In addition, if a request for a file for which a .dvi file
+ is a prerequisite, then $dvi_mode will be set to 1.
+
$dvi_previewer ["start xdvi %O %S" under UNIX]
- The command to invoke a dvi-previewer. [Default is "start"
- under MS-WINDOWS; under more recent versions of Windows, this
- will cause to be run whatever command the system has associated
+ The command to invoke a dvi-previewer. [Default is "start"
+ under MS-WINDOWS; under more recent versions of Windows, this
+ will cause to be run whatever command the system has associated
with .dvi files.]
$dvi_previewer_landscape ["start xdvi %O %S"]
The command to invoke a dvi-previewer in landscape mode.
[Default is "start" under MS-WINDOWS; under more recent versions
- of Windows, this will cause to be run whatever command the sys-
+ of Windows, this will cause to be run whatever command the sys-
tem has associated with .dvi files.]
$dvipdf ["dvipdf %O %S %D"]
Command to convert dvi to pdf file. A common reconfiguration is
- to use the dvipdfm command, which needs its arguments in a dif-
+ to use the dvipdfm command, which needs its arguments in a dif-
ferent order:
$dvipdf = "dvipdfm %O -o %D %S";
- WARNING: The default dvipdf script generates pdf files with
+ WARNING: The default dvipdf script generates pdf files with
bitmapped fonts, which do not look good when viewed by acroread.
- That script should be modified to give dvips the options "-P
+ That script should be modified to give dvips the options "-P
pdf" to ensure that type 1 fonts are used in the pdf file.
$dvips ["dvips %O -o %D %S"]
- The program to used as a filter to convert a .dvi file to a .ps
- file. If pdf is going to be generated from pdf, then the value
+ The program to used as a filter to convert a .dvi file to a .ps
+ file. If pdf is going to be generated from pdf, then the value
of the $dvips_pdf_switch -- see below -- will be included in the
options substituted for "%O".
$dvips_landscape ["dvips -tlandscape %O -o %D %S"]
- The program to used as a filter to convert a .dvi file to a .ps
+ The program to used as a filter to convert a .dvi file to a .ps
file in landscape mode.
$dvips_pdf_switch ["-P pdf"]
- Switch(es) for dvips program when pdf file is to be generated
+ Switch(es) for dvips program when pdf file is to be generated
from ps file.
$dvips_silent_switch ["-q"]
Switch(es) for dvips program when silent mode is on.
$dvi_update_command [""]
- When the dvi previewer is set to be updated by running a com-
- mand, this is the command that is run. See the information for
- the variable $dvi_update_method for further information, and see
- information on the variable $pdf_update_method for an example
+ When the dvi previewer is set to be updated by running a com-
+ mand, this is the command that is run. See the information for
- 22 December 2008 15
+ 10 April 2009 15
@@ -1000,65 +1007,65 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ the variable $dvi_update_method for further information, and see
+ information on the variable $pdf_update_method for an example
for the analogous case of a pdf previewer.
$dvi_update_method [2 under UNIX, 1 under MS-Windows]
- How the dvi viewer updates its display when the dvi file has
- changed. The values here apply equally to the
+ How the dvi viewer updates its display when the dvi file has
+ changed. The values here apply equally to the
$pdf_update_method and to the $ps_update_method variables.
0 => update is automatic,
1=> manual update by user, which may only mean a mouse click
on the viewer's window or may mean a more serious action.
- 2 => Send the signal, whose number is in the variable
- $dvi_update_signal. The default value under UNIX is suitable
+ 2 => Send the signal, whose number is in the variable
+ $dvi_update_signal. The default value under UNIX is suitable
for xdvi.
- 3 => Viewer cannot do an update, because it locks the file.
+ 3 => Viewer cannot do an update, because it locks the file.
(As with acroread under MS-Windows.)
- 4 => run a command to do the update. The command is speci-
+ 4 => run a command to do the update. The command is speci-
fied by the variable $dvi_update_command.
- See information on the variable $pdf_update_method for an exam-
+ See information on the variable $pdf_update_method for an exam-
ple of updating by command.
- $dvi_update_signal [Under UNIX: SIGUSR1, which is a system-dependent
+ $dvi_update_signal [Under UNIX: SIGUSR1, which is a system-dependent
value]
- The number of the signal that is sent to the dvi viewer when it
- is updated by sending a signal -- see the information on the
- variable $dvi_update_method. The default value is the one
+ The number of the signal that is sent to the dvi viewer when it
+ is updated by sending a signal -- see the information on the
+ variable $dvi_update_method. The default value is the one
appropriate for xdvi on a UNIX system.
$fdb_ext ["fdb_latexmk"]
- The extension of the file which latexmk generates to contain a
- database of information on source files. You will not normally
+ The extension of the file which latexmk generates to contain a
+ database of information on source files. You will not normally
need to change this.
$force_mode [0]
- If nonzero, continue processing past minor latex errors includ-
+ If nonzero, continue processing past minor latex errors includ-
ing unrecognized cross references. Equivalent to specifying the
-f option.
- @generated_exts [( aux , bbl , idx , ind , lof , lot , out , toc ,
+ @generated_exts [( aux , bbl , idx , ind , lof , lot , out , toc ,
$fdb_ext )]
- This contains a list of extensions for files that are generated
- during a LaTeX run and that are read in by LaTeX in later runs,
+ This contains a list of extensions for files that are generated
+ during a LaTeX run and that are read in by LaTeX in later runs,
either directly or indirectly.
- This list has two uses: (a) to set the kinds of file to be
+ This list has two uses: (a) to set the kinds of file to be
deleted in a cleanup operation (with the -c, -C, -CA, -g and -gg
- options), and (b) in the determination of whether a rerun of
+ options), and (b) in the determination of whether a rerun of
(pdf)LaTeX is needed after a run that gives an error.
(Normally, a change of a source file during a run should provoke
- a rerun. This includes a file generated by LaTeX, e.g., an aux
- file, that is read in on subsequent runs. But after a run that
- results in an error, a new run should occur until the user has
- made a change in the files. But the user may have corrected an
- error in a source .tex file during the run. So latexmk needs to
- distinguish user-generated and automatically generated files; it
+ a rerun. This includes a file generated by LaTeX, e.g., an aux
+ file, that is read in on subsequent runs. But after a run that
+ results in an error, a new run should occur until the user has
+ made a change in the files. But the user may have corrected an
- 22 December 2008 16
+ 10 April 2009 16
@@ -1067,35 +1074,37 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
- determines the automatically generated files as those with
+ error in a source .tex file during the run. So latexmk needs to
+ distinguish user-generated and automatically generated files; it
+ determines the automatically generated files as those with
extensions in the list in @generated_exts.)
- A convenient way to add an extra extension to the list, without
- losing the already defined ones is to use a push command in the
+ A convenient way to add an extra extension to the list, without
+ losing the already defined ones is to use a push command in the
line in an RC file. E.g.,
push @generated_exts, "end";
- adds the extension "end" to the list of predefined generated
- extensions. (This extension is used by the RevTeX package, for
+ adds the extension "end" to the list of predefined generated
+ extensions. (This extension is used by the RevTeX package, for
example.)
$go_mode [0]
- If nonzero, process files regardless of timestamps, and is then
+ If nonzero, process files regardless of timestamps, and is then
equivalent to the -g option.
%hash_calc_ignore_pattern
!!!This variable is for experts only!!!
- The general rule latexmk uses for determining when an extra run
- of some program is needed is that one of the source files has
- changed. But consider for example a latex package that causes
- an encapsulated postscript file (an "eps" file) to be made that
- is to be read in on the next run. The file contains a comment
- line giving its creation date and time. On the next run the
- time changes, latex sees that the eps file has changed, and
- therefore reruns latex. This causes an infinite loop, only
- exited becaues latexmk has a limit on the number of runs to
+ The general rule latexmk uses for determining when an extra run
+ of some program is needed is that one of the source files has
+ changed. But consider for example a latex package that causes
+ an encapsulated postscript file (an "eps" file) to be made that
+ is to be read in on the next run. The file contains a comment
+ line giving its creation date and time. On the next run the
+ time changes, latex sees that the eps file has changed, and
+ therefore reruns latex. This causes an infinite loop, only
+ exited becaues latexmk has a limit on the number of runs to
guard against pathological situations.
But the changing line has no real effect, since it is a comment.
@@ -1104,28 +1113,26 @@ LATEXMK(1L) LATEXMK(1L)
$hash_calc_ignore_pattern{'eps'} = '^%%CreationDate: ';
This creates a rule for files with extension .eps about lines to
- ignore. The left-hand side is a Perl idiom for setting an item
- in a hash. Note that the file extension is specified without a
+ ignore. The left-hand side is a Perl idiom for setting an item
+ in a hash. Note that the file extension is specified without a
period. The value, on the right-hand side, is a string contain-
- ing a regular expresssion. (See documentation on Perl for how
- they are to be specified in general.) This particular regular
- expression specifies that lines beginning with "%%CreationDate:
- " are to be ignored in deciding whether a file of the given
+ ing a regular expresssion. (See documentation on Perl for how
+ they are to be specified in general.) This particular regular
+ expression specifies that lines beginning with "%%CreationDate:
+ " are to be ignored in deciding whether a file of the given
extension .eps has changed.
$kpsewhich ["kpsewhich %S"]
- The program called to locate a source file when the name alone
- is not sufficient. Most filenames used by latexmk have suffi-
- cient path information to be found directly. But sometimes,
- notably when the file, but not its path is known. The program
+ The program called to locate a source file when the name alone
+ is not sufficient. Most filenames used by latexmk have suffi-
+ cient path information to be found directly. But sometimes,
+ notably when the file, but not its path is known. The program
specified by $kpsewhich is used to find it.
- See also the @BIBINPUTS variable for another way that latexmk
- also uses to try to locate files; it applies only in the case of
- 22 December 2008 17
+ 10 April 2009 17
@@ -1134,41 +1141,89 @@ LATEXMK(1L) LATEXMK(1L)
LATEXMK(1L) LATEXMK(1L)
+ See also the @BIBINPUTS variable for another way that latexmk
+ also uses to try to locate files; it applies only in the case of
.bib files.
$landscape_mode [0]
If nonzero, run in landscape mode, using the landscape mode pre-
- viewers and dvi to postscript converters. Equivalent to the -l
+ viewers and dvi to postscript converters. Equivalent to the -l
option. Normally not needed with current previewers.
$latex ["latex %O %S"]
The LaTeX processing program. Note that as with other programs,
- you can use this variable not just to change the name of the
+ you can use this variable not just to change the name of the
program used, but also specify options to the program. E.g.,
$latex = "latex --src-specials";
+ %latex_input_extensions
+ This variable specifies the extensions tried by latexmk when it
+ finds that a LaTeX run resulted in an error that a file has not
+ been found, and the file is given without an extension. This
+ typically happens when LaTeX commands of the form input{file} or
+ includegraphics{figure}, when the relevant source file does not
+ exist.
+
+ In this situation, latexmk searches for custom dependencies to
+ make the missing file(s), but restricts it to the extensions
+ specified by the variable %latex_input_extensions. The default
+ extensions are
+
+ (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' );
+
+ removes the extension 'tex' from latex_input_extensions
+
+ add_input_ext( 'latex', 'asdf' );
+
+ 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
+ its graphics/graphicx packages.
+
+
$latex_silent_switch ["-interaction=batchmode"]
- Switch(es) for the LaTeX processing program when silent mode is
- on. Under MS-Windows, the default value is changed to "-inter-
- action=batchmode -c-style-errors", as used by MikTeX and fpTeX.
+ Switch(es) for the LaTeX processing program when silent mode is
+ on. Under MS-Windows, the default value is changed to "-inter-
+ action=batchmode -c-style-errors", as used by MikTeX and fpTeX.
+
+
+
+
+ 10 April 2009 18
+
+
+
+
+
+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.
@@ -1178,108 +1233,143 @@ LATEXMK(1L) LATEXMK(1L)
$lpr_pdf ["NONE lpr_pdf"]
The printing program to print pdf files.
- Under MS-Windows you could set this to use gsview, if it is
+ Under MS-Windows you could set this to use gsview, if it is
installed, e.g.,
$lpr = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p';
- If gsview is installed in a different directory, you will need
- to make the appropriate change. Note the double quotes around
+ If gsview is installed in a different directory, you will need
+ to make the appropriate change. Note the double quotes around
the name: this is necessary because one part of the command name
("Program Files") contains a space which would otherwise be mis-
interpreted.
+ $makeindex ["makeindex %O -o %D %S"]
+ The index processing program.
+ $max_repeat [5]
+ The maximum number of times latexmk will run latex/pdflatex
+ before deciding that there may be an infinite loop and that it
+ needs to bail out, rather than rerunning latex/pdflatex again to
+ resolve cross-references, etc. The default value covers all
+ normal cases.
- 22 December 2008 18
+ (Note that the "etc" covers a lot of cases where one run of
+ latex/pdflatex generates files to be read in on a later run.)
+ $new_viewer_always [0]
+ This variable applies to latexmk only in continuous-preview
+ 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-
+ 10 April 2009 19
-LATEXMK(1L) LATEXMK(1L)
- $makeindex ["makeindex %O -o %D %S"]
- The index processing program.
- $max_repeat [5]
- The maximum number of times latexmk will run latex/pdflatex
- before deciding that there may be an infinite loop and that it
- needs to bail out, rather than rerunning latex/pdflatex again to
- resolve cross-references, etc. The default value covers all
- normal cases.
- (Note that the "etc" covers a lot of cases where one run of
- latex/pdflatex generates files to be read in on a later run.)
+LATEXMK(1L) LATEXMK(1L)
- $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
+
+ zero, this check will be skipped, and latexmk will behave as if
no viewer is running.
$pdf_mode [0]
- If zero, do NOT generate a pdf version of the document. If
- equal to 1, generate a pdf version of the document using pdfla-
+ If zero, do NOT generate a pdf version of the document. If
+ equal to 1, generate a pdf version of the document using pdfla-
tex. If equal to 2, generate a pdf version of the document from
the ps file, by using the command specified by the $ps2pdf vari-
- able. If equal to 3, generate a pdf version of the document
+ able. If equal to 3, generate a pdf version of the document
from the dvi file, by using the command specified by the $dvipdf
variable.
Equivalent to the -pdf-, -pdf, -pdfdvi, -pdfps options.
$pdflatex ["pdflatex %O %S"]
- The LaTeX processing program in the version that makes a pdf
+ The LaTeX processing program in the version that makes a pdf
file instead of a dvi file.
+ %pdflatex_input_extensions
+ This variable specifies the extensions tried by latexmk when it
+ finds that a pdfLaTeX run resulted in an error that a file has
+ not been found, and the file is given without an extension.
+ This typically happens when LaTeX commands of the form
+ 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
+ default extensions are
+
+ (For Perl experts: %pdflatex_input_extensions is a hash whose
+ keys are the extensions. The values are irrelevant.) Two sub-
+ routines are provided for manipulating this and the related
+ variable %latex_input_extensions, add_input_ext and
+ remove_input_ext. They are used as in the following examples
+ are possible lines in an initialization file:
+
+ remove_input_ext( 'pdflatex', 'tex' );
+
+ removes the extension 'tex' from pdflatex_input_extensions
+
+ 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-
+ 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-
+ tex and its graphics/graphicx packages.)
+
+
$pdflatex_silent_switch ["-interaction=batchmode"]
- Switch(es) for the pdflatex program (specified in the variable
+ Switch(es) for the pdflatex program (specified in the variable
$pdflatex when silent mode is on. Under MS-Windows, the default
- value is changed to "-interaction=batchmode -c-style-errors", as
- used by MikTeX and fpTeX.
- $pdf_previewer ["start acroread %O %S"]
- The command to invoke a pdf-previewer. [Default is changed to
- "start" on MS-WINDOWS; under more recent versions of Windows,
- this will cause to be run whatever command the system has asso-
- ciated with .pdf files.]
- WARNING: Potential problem under MS-Windows: if acroread is used
- as the pdf previewer, and it is actually viewing a pdf file, the
- pdf file cannot be updated. Thus makes acroread a bad choice of
- previewer if you use latexmk's previous-continuous mode (option
- -pvc) under MS-windows. This problem does not occur if
- ghostview, gv or gsview is used to view pdf files.
+ 10 April 2009 20
- 22 December 2008 19
+LATEXMK(1L) LATEXMK(1L)
+ value is changed to "-interaction=batchmode -c-style-errors", as
+ used by MikTeX and fpTeX.
-LATEXMK(1L) LATEXMK(1L)
+ $pdf_previewer ["start acroread %O %S"]
+ The command to invoke a pdf-previewer. [Default is changed to
+ "start" on MS-WINDOWS; under more recent versions of Windows,
+ this will cause to be run whatever command the system has asso-
+ ciated with .pdf files.]
+ WARNING: Potential problem under MS-Windows: if acroread is used
+ as the pdf previewer, and it is actually viewing a pdf file, the
+ pdf file cannot be updated. Thus makes acroread a bad choice of
+ previewer if you use latexmk's previous-continuous mode (option
+ -pvc) under MS-windows. This problem does not occur if
+ ghostview, gv or gsview is used to view pdf files.
$pdf_update_command [""]
- When the pdf previewer is set to be updated by running a com-
- mand, this is the command that is run. See the information for
+ When the pdf previewer is set to be updated by running a com-
+ mand, this is the command that is run. See the information for
the variable $pdf_update_method.
$pdf_update_method [1 under UNIX, 3 under MS-Windows]
- How the pdf viewer updates its display when the pdf file has
- changed. See the information on the variable $dvi_update_method
+ How the pdf viewer updates its display when the pdf file has
+ changed. See the information on the variable $dvi_update_method
for the codes. (Note that information needs be changed slightly
- so that for the value 4, to run a command to do the update, the
- command is specified by the variable $pdf_update_command, and
- for the value 2, to specify update by signal, the signal is
+ so that for the value 4, to run a command to do the update, the
+ command is specified by the variable $pdf_update_command, and
+ for the value 2, to specify update by signal, the signal is
specified by $pdf_update_signal.)
Note that acroread under MS-Windows (but not UNIX) locks the pdf
@@ -1292,48 +1382,52 @@ LATEXMK(1L) LATEXMK(1L)
$pdf_update_method = 4;
$pdf_update_command = "xpdf -remote %R -reload";
- The first setting arranges for the xpdf program to be used in
- its "remote server mode", with the server name specified as the
- rootname of the TeX file. The second setting arranges for
+ The first setting arranges for the xpdf program to be used in
+ its "remote server mode", with the server name specified as the
+ rootname of the TeX file. The second setting arranges for
updating to be done in response to a command, and the third set-
ting sets the update command.
- $pdf_update_signal [Under UNIX: SIGHUP, which is a system-dependent
+ $pdf_update_signal [Under UNIX: SIGHUP, which is a system-dependent
value]
- The number of the signal that is sent to the pdf viewer when it
- is updated by sending a signal -- see the information on the
- variable $pdf_update_method. The default value is the one
+ The number of the signal that is sent to the pdf viewer when it
+ is updated by sending a signal -- see the information on the
+ variable $pdf_update_method. The default value is the one
appropriate for gv on a UNIX system.
$pid_position[1 under UNIX, -1 under MS-Windows]
- The variable $pid_position is used to specify which word in
- lines of the output from $pscmd corresponds to the process ID.
- The 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.
+ The variable $pid_position is used to specify which word in
+ lines of the output from $pscmd corresponds to the process ID.
- $postscript_mode [0]
- If nonzero, generate a postscript version of the document.
- Equivalent to the -ps option.
- $preview_continuous_mode [0]
- If nonzero, run a previewer to view the document, and continue
- running latexmk to keep .dvi up-to-date. Equivalent to the -pvc
- option. Which previewer is run depends on the other settings,
- see the command line options -view=, and the variable $view.
+ 10 April 2009 21
- 22 December 2008 20
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ The first word in the line is numbered 0. The default value of
+ 1 (2nd word in line) is correct for Solaris 2.6 and Linux. Set-
+ ting the variable to -1 is used to indicate that $pscmd is not
+ to be used.
+ $postscript_mode [0]
+ If nonzero, generate a postscript version of the document.
+ Equivalent to the -ps option.
+
+ If some other request is made for which a postscript file is needed,
+ then $postscript_mode will be set to 1.
+
+ $preview_continuous_mode [0]
+ If nonzero, run a previewer to view the document, and continue
+ running latexmk to keep .dvi up-to-date. Equivalent to the -pvc
+ 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
@@ -1375,6 +1469,17 @@ LATEXMK(1L) LATEXMK(1L)
postscript file before other processing. Equivalent to specify-
ing the -pF option.
+
+
+ 10 April 2009 22
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
$ps_previewer ["start gv %O %S", but "start %O %S" under MS-WINDOWS]
The command to invoke a ps-previewer. (The default under MS-
WINDOWS will cause to be run whatever command the system has
@@ -1390,18 +1495,6 @@ LATEXMK(1L) LATEXMK(1L)
of gv under different names, e.g., ggv, kghostview, etc, but
perhaps not one called gv.
-
-
-
- 22 December 2008 21
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
$ps_previewer_landscape ["start gv -swap %O %S", but "start %O %S"
under MS-WINDOWS]
The command to invoke a ps-previewer in landscape mode.
@@ -1444,6 +1537,18 @@ LATEXMK(1L) LATEXMK(1L)
Directory to store temporary files that latexmk may generate
while running.
+
+
+
+ 10 April 2009 23
+
+
+
+
+
+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
@@ -1459,16 +1564,6 @@ LATEXMK(1L) LATEXMK(1L)
generated is to be used (among dvi, ps and pdf).
-
- 22 December 2008 22
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
CUSTOM DEPENDENCIES
In any RC file a set of custom dependencies can be set up to convert a
file with one extension to a file with another. An example use of this
@@ -1511,6 +1606,18 @@ CUSTOM DEPENDENCIES
It is invoked whenever latexmk detects that a run of latex/pdflatex
needs to read a file, like a graphics file, whose extension is the to-
+
+
+
+ 10 April 2009 24
+
+
+
+
+
+LATEXMK(1L) LATEXMK(1L)
+
+
extension of a custom dependency. Then latexmk examines whether a file
exists with the same name, but with the corresponding from-extension,
as specified in the custom-dependency rule. If it does, then whenever
@@ -1524,18 +1631,6 @@ CUSTOM DEPENDENCIES
those without knowledge of the Perl programming language. Of course,
experts could do something much more elaborate.
-
-
-
- 22 December 2008 23
-
-
-
-
-
-LATEXMK(1L) LATEXMK(1L)
-
-
One other item in each custom-dependency rule labelled "must" above
specifies how the rule should be applied when the source file fails to
exist.
@@ -1581,27 +1676,27 @@ LATEXMK(1L) LATEXMK(1L)
system("fig2dev -Lps '$_[0].fig' '$_[0].eps'");
}
- This causes the invocation of the fig2dev program to have quoted file-
- names; it should therefore work with filenames containing spaces. How-
- ever, not all software deals correctly with filenames that contain
- spaces. Moreover, the rules, if any, for quoting filenames vary
- between operating systems, command shells and individual pieces of
- software, so this code may not always work.
- If you use pdflatex instead of latex, then you will probably prefer to
- convert your graphics files to pdf format, in which case you would
- replace the above code in an initialization file by
+ 10 April 2009 25
- 22 December 2008 24
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ This causes the invocation of the fig2dev program to have quoted file-
+ names; it should therefore work with filenames containing spaces. How-
+ ever, not all software deals correctly with filenames that contain
+ spaces. Moreover, the rules, if any, for quoting filenames vary
+ between operating systems, command shells and individual pieces of
+ software, so this code may not always work.
+ If you use pdflatex instead of latex, then you will probably prefer to
+ convert your graphics files to pdf format, in which case you would
+ replace the above code in an initialization file by
add_cus_dep( 'fig', 'pdf, 0, 'fig2pdf' );
sub fig2pdf {
@@ -1649,25 +1744,27 @@ LATEXMK(1L) LATEXMK(1L)
be perpetually out-of-date. This situation, of circular dependencies,
is endemic to latex, and latexmk in its current version works correctly
with circular dependencies. It examines the contents of the files (by
- use of an md5 checksum), and only does a remake when the file contents
- have actually changed.
- Of course if you choose to write random data to the .nnd (or and .aux
- file, etc) that changes on each new run, then you will have a problem.
- For real experts: See the %hash_cal_ignore_pattern if you have to deal
- with such problems.
- Glossaries can be dealt with similarly.
+ 10 April 2009 26
- 22 December 2008 25
+LATEXMK(1L) LATEXMK(1L)
-LATEXMK(1L) LATEXMK(1L)
+ use of an md5 checksum), and only does a remake when the file contents
+ have actually changed.
+
+ Of course if you choose to write random data to the .nnd (or and .aux
+ file, etc) that changes on each new run, then you will have a problem.
+ For real experts: See the %hash_cal_ignore_pattern if you have to deal
+ with such problems.
+
+ Glossaries can be dealt with similarly.
OLD METHOD OF DEFINING CUSTOM DEPENDENCIES
@@ -1718,17 +1815,10 @@ BUGS
THANKS TO
Authors of previous versions. Many users with their feedback, and
especially David Coppit (username david at node coppit.org) who made
- many useful suggestions that contributed to version 3, and Herbert
- Schulz. (Please note that the e-mail addresses are not written in
- their standard form to avoid being harvested by worms and viruses.)
-
-AUTHOR
- Current version, by John Collins (username collins at node
- phys.psu.edu). (Version 4.03).
- 22 December 2008 26
+ 10 April 2009 27
@@ -1737,6 +1827,14 @@ AUTHOR
LATEXMK(1L) LATEXMK(1L)
+ many useful suggestions that contributed to version 3, and Herbert
+ Schulz. (Please note that the e-mail addresses are not written in
+ their standard form to avoid being harvested by worms and viruses.)
+
+AUTHOR
+ Current version, by John Collins (username collins at node
+ phys.psu.edu). (Version 4.05).
+
Released version can be obtained from CTAN: <http://www.tug.org/tex-
archive/support/latexmk/>, and from the author's website
<http://www.phys.psu.edu/~collins/software/latexmk/>.
@@ -1791,10 +1889,6 @@ LATEXMK(1L) LATEXMK(1L)
-
-
-
-
- 22 December 2008 27
+ 10 April 2009 28
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl
index 73dfcb48d49..9e7beb249a1 100755
--- a/Master/texmf-dist/scripts/latexmk/latexmk.pl
+++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl
@@ -1,22 +1,16 @@
-eval '(exit $?0)' && eval 'exec perl -x -S "$0" ${1+"$@"}' &&
-eval 'exec perl -x -S "$0" $argv:q'
-if 0;
+#!/usr/bin/env perl
+# On a UNIX-like system, the above enables latexmk to run independently
+# of the location of the perl executable. This line relies on the
+# existence of the program /usr/bin/env
+# If there is a problem for any reason, you can replace the first line of
+# this file by:
+
#!/usr/bin/perl -w
-#!/opt/local/bin/perl -w
-#!/usr/local/bin/perl -w
-# The above code allows this script to be run under UNIX/LINUX without
-# the need to adjust the path to the perl program in a "shebang" line.
-# (The location of perl changes between different installations, and
-# may even be different when several computers running different
-# flavors of UNIX/LINUX share a copy of latex or other scripts.) The
-# script is started under the default command interpreter sh, and the
-# evals in the first two lines restart the script under perl, and work
-# under various flavors of sh. The -x switch tells perl to start the
-# script at the first #! line containing "perl". The "if 0;" on the
-# 3rd line converts the first two lines into a valid perl statement
-# that does nothing.
-#
-# Source of the above: manpage for perlrun
+
+# with the path of the perl executable adjusted for your system.
+
+
+use warnings;
# Delete #??!! when working
@@ -34,13 +28,11 @@ if 0;
# primary run. Ensure fdb and c. is updated enough etc.
# I may have it correct now: fdb_write in makeB
# See also routine rdb_update_files_for_rule, and who calls it
+# It appears to be unused. What is rationale?
# Apparently excess runs of latex after change in .tex file that entails
# change in bibliography.
-# Now I am missing diagnostics
-
-
## ???!!!!!!!!!!!!! Should I remove bibtex rule? NO
## ?? Need to set dependence of extra bibtex rules on .bib file
## ?? Put $pass as variable in rule.
@@ -148,8 +140,8 @@ if 0;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.03';
-$version_details = "$My_name, John Collins, 22 December 2008";
+$version_num = '4.05';
+$version_details = "$My_name, John Collins, 10 April 2009";
use Config;
@@ -218,6 +210,39 @@ else {
##
## Modification log for 24 Sep 2008 onwards in detail
##
+## 10 Apr 2009, John Collins V. 4.05
+## 3 Apr 2009, John Collins Change to a nicer #! line
+## 26 Mar 2009, John Collins Case independence for one item in
+## @file_not_found
+## 6 Mar 2009, John Collins Single %input_extensions variable
+## Correct bug in making cusdep for missing
+## extensionless file
+## 5 Mar 2009, John Collins Get rid of warning about variables used
+## only once.
+## 25 Feb 2009, John Collins Ensure viewed file type is made.
+## Configurable extensions for finding
+## cusdep.
+## 24 Feb 2009, John Collins V. 4.04
+## Fix problems when using both latex and pdflatex
+## 1. In fdb, keep primary rules that have been
+## run, even if they are not in use in
+## current invocation of latexmk.
+## 2. But don't write primary rules if they have
+## not been run (i.e., $run_time==0).
+## 3. If $run_time==0 for an in-use primary
+## rule, i.e., if the rule has not
+## been run, then run it
+## unconditionally.
+## 4. But don't let this apply to other
+## rules, since the time-stamp rule
+## will normally have been adequate.
+## Improved diagnostics on reason for rerun.
+## Corrected classify_rules call in pvc.
+## In rdb_set_from_logB: when setting
+## subsidiary rules after parsing log
+## file, this is now done only for the
+## currently-being-applied primary rule,
+## not for all primary rules.
## 22 Dec 2008, John Collins V. 4.03
## 22 Dec 2008, John Collins Fix possibility that unwrapping of lines
## in log_file is done incorrectly
@@ -374,7 +399,7 @@ $log_wrap = 79;
'^\\! LaTeX Error: File `([^\\\']*)\\\' not found\\.',
'.*?:\\d*: LaTeX Error: File `([^\\\']*)\\\' not found\\.',
'^LaTeX Warning: File `([^\\\']*)\\\' not found',
- '^Package .* file `([^\\\']*)\\\' not found',
+ '^Package .* [fF]ile `([^\\\']*)\\\' not found',
);
## Hash mapping file extension (w/o period, e.g., 'eps') to a single regexp,
@@ -406,6 +431,17 @@ $pdflatex = 'pdflatex %O %S';
$latex_silent_switch = '-interaction=batchmode';
$pdflatex_silent_switch = '-interaction=batchmode';
+# %input_extensions maps primary_rule_name to pointer to hash of file extensions
+# used for extensionless files specified in the source file by constructs
+# like \input{file} \includegraphics{file}
+# Could write
+#%input_extensions = ( 'latex' => { 'tex' => 1, 'eps' => 1 };,
+# 'pdflatex' => { 'tex' => 1, 'pdf' => 1, 'jpg' => 1, 'png' => 1 }; );
+# Instead we'll exercise the user-friendly access routines:
+add_input_ext( 'latex', 'tex', 'eps' );
+add_input_ext( 'pdflatex', 'tex', 'jpg', 'pdf' );
+#show_input_ext( 'latex' ); show_input_ext( 'pdflatex' );
+
## Command to invoke bibtex
$bibtex = 'bibtex %O %B';
# Switch(es) to make bibtex silent:
@@ -1052,8 +1088,7 @@ if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
# List of known rules. Rule types: primary,
# external (calls program), internal (calls routine), cusdep.
-%known_rules = ( 'latex' => 'primary', 'pdflatex' => 'primary',
- );
+%possible_primaries = ( 'latex' => 'primary', 'pdflatex' => 'primary' );
%primaries = (); # Hash of rules for primary part of make. Keys are
# currently 'latex', 'pdflatex' or both. Value is
# currently irrelevant. Use hash for ease of lookup
@@ -1072,7 +1107,7 @@ if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
%rule_db = (); # Database of all rules:
# Hash: rulename -> [array of rule data]
# Rule data:
- # 0: [ cmd_type, ext_cmd, int_cmd, out_of_date-crit,
+ # 0: [ cmd_type, ext_cmd, int_cmd, test_kind,
# source, dest, base, out_of_date,
# out_of_date_user, time_of_last_run ]
# where
@@ -1092,7 +1127,7 @@ if (!$TEXINPUTS) { $TEXINPUTS = '.'; }
# This variable intcmd is a reference to an array,
# $$intcmd[0] = internal routine
# $$intcmd[1...] = its arguments (if any)
- # out_of_date_crit specifies method of determining
+ # test_kind specifies method of determining
# whether a file is out-of-date:
# 0 for never
# 1 for usual: whether there is a source
@@ -1495,6 +1530,14 @@ if ( $view eq "default" ) {
if ( $pdf_mode ) { $view = "pdf"; }
}
+# Make sure we make the kind of file we want to view:
+if ($view eq 'dvi') { $dvi_mode = 1; }
+if ($view eq 'ps') { $postscript_mode = 1; }
+if ( ($view eq 'pdf') && ($pdf_mode == 0) ) {
+ $pdf_mode = 1;
+}
+
+# Make sure that we make something if all requests are turned off
if ( ! ( $dvi_mode || $pdf_mode || $postscript_mode || $printout_mode) ) {
print "No specific requests made, so default to dvi by latex\n";
$dvi_mode = 1;
@@ -1522,15 +1565,6 @@ if ( length($dvi_filter) != 0 ) { $requested_filerules{'dvi_filter'} = 1; }
if ( length($ps_filter) != 0 ) { $requested_filerules{'ps_filter'} = 1; }
if ( $banner ) { $requested_filerules{'dvips'} = 1; }
-%possible_primaries = ();
-foreach (&rdb_possible_primaries) {
- $possible_primaries{$_} = 1;
-}
-
-#print "POSSIBLE PRIMARIES: ";
-#foreach (keys %possible_primaries ) {print "$_, ";}
-#print "\n";
-
if ( $pdf_mode == 2 ) {
# We generate pdf from ps. Make sure we have the correct kind of ps.
@@ -1570,7 +1604,6 @@ foreach $filename ( @file_list )
$failure = 0; # Set nonzero to indicate failure at some point of
# a make. Use value as exit code if I exit.
$failure_msg = ''; # Indicate reason for failure
-#?? Unneeded now: $bibtex_mode = $save_bibtex_mode;
if ( $do_cd ) {
($filename, $path) = fileparse( $filename );
@@ -2233,7 +2266,9 @@ sub make_preview_continuousB {
local @changed = ();
local @disappeared = ();
local @no_dest = (); # Non-existent destination files
+ local @rules_never_run = ();
local @rules_to_apply = ();
+
local $failure = 0;
local $runs = 0;
local %rules_applied = ();
@@ -2361,11 +2396,11 @@ CHANGE:
sleep($sleep_time);
&rdb_clear_change_record;
rdb_recurseA( [@targets], \&rdb_flag_changes_here );
- if ( &rdb_count_changes > 0) {
- &rdb_diagnose_changes
- unless $silent;
-#???
- warn "$My_name: File(s) changed or not used in previous run(s). Remake files.\n";
+ if ( &rdb_need_run ) {
+ if (!$silent) {
+ warn "$My_name: Need to remake files.\n";
+ &rdb_diagnose_changes( ' ' );
+ }
last WAIT;
}
# Does this do this job????
@@ -3152,7 +3187,7 @@ CANDIDATE:
if ( $misparse > 0 ) {
print "$misparse\n";
- print "Apparent input files appearently from misunderstood lines in .log file:\n";
+ print "Apparent input files apparently from misunderstood lines in .log file:\n";
foreach ( @misparse ) { print " $_\n"; }
}
print "Log file shows the following generated files: ";
@@ -3583,13 +3618,25 @@ sub rdb_write {
&rdb_classify_rules( \%possible_primaries, keys %requested_filerules );
print $out_handle "# Fdb version $fdb_ver\n";
- my @rules = sort(
- rdb_accessible(
- uniq1( keys %known_rules, keys %current_primaries )));
+ my @rules = rdb_accessible( uniq1( keys %possible_primaries ) ) ;
+ # Separate call to sort. Otherwise rdb_accessible seems to get wrong argument.
+ @rules = sort( @rules );
rdb_for_some(
\@rules,
- sub { print $out_handle "[\"$rule\"] $$Prun_time \"$$Psource\" \"$$Pdest\" \"$$Pbase\" \n"; },
- sub { print $out_handle " \"$file\" $$Ptime $$Psize $$Pmd5 \"$$Pfrom_rule\"\n"; },
+ sub {
+ # Omit data on a unused and never-run primary rule:
+ if ( ($$Prun_time == 0)
+ && exists( $possible_primaries{$rule} )
+ && ! exists( $current_primaries{$rule} )
+ )
+ {
+ return;
+ }
+ print $out_handle "[\"$rule\"] $$Prun_time \"$$Psource\" \"$$Pdest\" \"$$Pbase\" \n";
+ rdb_do_files(
+ sub { print $out_handle " \"$file\" $$Ptime $$Psize $$Pmd5 \"$$Pfrom_rule\"\n"; }
+ );
+ }
);
undef $out_handle;
return 1;
@@ -3635,11 +3682,9 @@ sub rdb_set_from_logB {
if ($diagnostics);
rdb_create_rule( $from_rule, 'external', $makeindex, '', 1,
$idx_file, $ind_file, $ind_base, 1, 0);
- foreach my $primary ( keys %primaries ) {
- print " ===Source file '$ind_file' for '$primary'\n"
+ print " ===Source file '$ind_file' for '$rule'\n"
if ($diagnostics > -1);
- rdb_ensure_file( $primary, $ind_file, $from_rule );
- }
+ rdb_ensure_file( $rule, $ind_file, $from_rule );
}
if ( ! -e $ind_file ) {
# Failure was non-existence of makable file
@@ -3666,24 +3711,22 @@ sub rdb_set_from_logB {
if ($diagnostics);
rdb_ensure_file( $from_rule, $source );
}
- foreach my $primary ( keys %primaries ) {
- print " ===Source file '$bbl_file' for '$primary'\n"
+ print " ===Source file '$bbl_file' for '$rule'\n"
if ($diagnostics);
- rdb_ensure_file( $primary, $bbl_file, $from_rule );
- if ( ! -e $bbl_file ) {
- # Failure was non-existence of makable file
- # Leave failure issue to other rules.
- $failure = 0;
- }
+ rdb_ensure_file( $rule, $bbl_file, $from_rule );
+ if ( ! -e $bbl_file ) {
+ # Failure was non-existence of makable file
+ # Leave failure issue to other rules.
+ $failure = 0;
}
}
}
NEW_SOURCE:
foreach my $new_source (keys %dependents) {
- foreach my $primary ( keys %primaries ) {
- rdb_ensure_file( $primary, $new_source );
- }
+ print " ===Source file for rule '$rule': '$new_source'\n"
+ if ($diagnostics);
+ rdb_ensure_file( $rule, $new_source );
}
my @more_sources = &rdb_set_dependentsA( $rule );
@@ -3871,7 +3914,12 @@ sub rdb_set_dependentsA {
# Call rdb_set_dependentsA( rules ...)
# Returns array (sorted), of new source files.
local @new_sources = ();
+ local @deletions = ();
rdb_recurseA( [@_], 0, \&rdb_one_depA );
+ foreach (@deletions) {
+ my ($rule, $file) = @$_;
+ rdb_remove_files( $rule, $file );
+ }
&rdb_make_links;
return uniqs( @new_sources );
} #END rdb_set_dependentsA
@@ -3885,6 +3933,7 @@ sub rdb_one_depA {
my ($base_name, $path, $toext) = fileparseA( $new_dest );
$base_name = $path.$base_name;
$toext =~ s/^\.//;
+ my $Pinput_extensions = $input_extensions{$rule};
DEP:
foreach my $dep ( @cus_dep_list ) {
my ($fromext,$proptoext,$must,$func_name) = split(' ',$dep);
@@ -3902,6 +3951,7 @@ DEP:
push @new_sources, $new_dest;
}
if (! rdb_rule_exists( $$Pfrom_rule ) ) {
+ print "=== Creating rule for '$$Pfrom_rule'\n";
rdb_create_rule( $$Pfrom_rule, 'cusdep', '', \@PAnew_cmd, 3,
$source, $new_dest, $base_name, 0 );
}
@@ -3931,7 +3981,11 @@ DEP:
}
}
}
- elsif ( ($toext eq '') && (! -e $file ) ) {
+ elsif ( ($toext eq '')
+ && (! -e $file )
+ && (! -e "$base_name.$proptoext" )
+ && exists $$Pinput_extensions{$proptoext}
+ ) {
# Empty extension and non-existent destination
# This normally results from \includegraphics{A}
# without graphics extension for file, when file does
@@ -3939,7 +3993,7 @@ DEP:
my $source = "$base_name.$fromext";
if ( -e $source ) {
$new_dest = "$base_name.$proptoext";
- my $from_rule = "cusdep $fromext $toext $base_name";
+ my $from_rule = "cusdep $fromext $proptoext $base_name";
push @new_sources, $new_dest;
print "Ensuring rule for '$from_rule', to make '$new_dest'\n"
if $diagnostics > -1;
@@ -3955,6 +4009,9 @@ DEP:
);
}
rdb_ensure_file( $rule, $new_dest, $from_rule );
+ # We've now got a spurious file in our rule. But don't mess
+ # with deleting an item we are in the middle of!
+ push @deletions, [$rule, $file];
return;
}
} # End of Rule found
@@ -4015,31 +4072,9 @@ sub rdb_accessible {
} #END rdb_accessible
#************************************************************
-
-sub rdb_possible_primaries {
- # Returns array of possible primaries
- my @rules = ();
- foreach my $rule ( keys %known_rules ) {
- if ( $known_rules{$rule} eq 'primary') {
- push @rules, $rule;
- }
- }
- return @rules;
-} #END rdb_possible_primaries
-
-#************************************************************
#************************************************************
#************************************************************
-# Routines for makes. NEW VERSIONS ??
-
-#????????Debugging routines:
-sub R1 {print "===START $rule\n"}
-sub R2 {print "===END $rule\n"}
-sub F1 {print " ---START $file\n"}
-sub F2 {print " ---END $file\n"}
-#************************************************************
-
sub rdb_makeB {
# Call: rdb_makeB( target, ... )
# Makes the targets and prerequisites.
@@ -4192,6 +4227,7 @@ sub rdb_makeB {
local @changed = ();
local @disappeared = ();
local @no_dest = (); # Non-existent destination files
+ local @rules_never_run = ();
local @rules_to_apply = ();
&rdb_classify_rules( \%possible_primaries, @requested_targets );
@@ -4254,7 +4290,10 @@ sub rdb_makeB {
continue {
# Re-evaluate rule classification and accessibility,
# but do not change primaries.
- &rdb_classify_rules( \%current_primaries, @requested_targets );
+ # Problem is that %current_primaries gets altered
+ my %old_curr_prim = %current_primaries;
+ &rdb_classify_rules( \%possible_primaries, @requested_targets );
+ %current_primaries = %old_curr_prim;
&rdb_make_links;
}
}
@@ -4296,11 +4335,14 @@ sub rdb_makeB1 {
if ($diagnostics) { print " MakeB1 $rule\n"; }
if ($failure & ! $force_mode) {return;}
&rdb_clear_change_record;
- &rdb_flag_changes_here;
-# if ($diagnostics>-1) { print " MakeB1.1 $rule $$Pout_of_date\n"; }
+ if ( ($$Prun_time == 0) && exists($possible_primaries{$rule}) ) {
+ push @rules_never_run, $rule;
+ $$Pout_of_date = 1;
+ }
+ else {
+ &rdb_flag_changes_here;
+ }
- my $return = 0; # Return code from called routine
-#?? print "makeB1: Trying '$rule' for '$$Pdest': ";
if (!$$Pout_of_date) {
#?? if ( ($$Pcmd_type eq 'primary') && (! $silent) ) {
# print "Rule '$rule' up to date\n";
@@ -4310,19 +4352,17 @@ sub rdb_makeB1 {
if ($diagnostics) { print " remake\n"; }
if (!$silent) {
print "$My_name: applying rule '$rule'...\n";
- &rdb_diagnose_changes( "Rule $rule: ");
+ &rdb_diagnose_changes( "Rule '$rule': ");
}
-##????????????????????????????????????: variable rules_applied not used
$rules_applied{$rule} = 1;
$runs++;
-#?? print "$rule: $$Pcmd_type\n";
# We are applying the rule, so its source file state for when it
# was last made is as of now:
# ??IS IT CORRECT TO DO NOTHING IN CURRENT VERSION?
# The actual run
- $return = 0;
+ my $return = 0; # Return code from called routine
# Rule may have been created since last run:
if ( ! defined $pass{$rule} ) {$pass{$rule} = 0; }
if ( $pass{$rule} ge $max_repeat ) {
@@ -4452,6 +4492,7 @@ sub rdb_classify_rules {
foreach ( @one_time ) { print " $_\n"; }
}
} #end diagnostics
+
} #END rdb_classify_rules
#-------------------
@@ -4460,7 +4501,7 @@ sub rdb_classify1 {
# Helper routine for rdb_classify_rules
# Applied as rule_act1 in recursion over rules
# Assumes rule context, and local variables from rdb_classify_rules
-# print "=========== '$rule' $depth ========== \n";
+ #print "??======= '$rule' $depth $state ========== \n";
push @classify_stack, [$state];
if ( exists $possible_one_time{$rule} ) {
# Normally, we will have already extracted the one_time rules,
@@ -4675,13 +4716,14 @@ sub rdb_primary_run {
#************************************************************
sub rdb_clear_change_record {
+ # Initialize diagnostics for reasons for running rule.
@changed = ();
@disappeared = ();
@no_dest = ();
- @rules_to_apply = ();
-#??????????????? $failure = 0;
-##????????????????????????????????????: variable rules_applied not used
- $rules_applied = 0;
+ @rules_never_run = ();
+ @rules_to_apply = (); # This is used in recursive application
+ # of rdb_flag_changes_here, to list
+ # rules that were out-of-date for some reason.
} #END rdb_clear_change_record
#************************************************************
@@ -4767,9 +4809,9 @@ sub rdb_file_change1 {
#************************************************************
-sub rdb_count_changes {
- return $#changed + $#no_dest + $#rules_to_apply + 3;
-} #END rdb_count_changes
+sub rdb_need_run {
+ return ($#changed >= 0) || ($#no_dest >= 0) || ($#rules_to_apply >= 0);
+} #END rdb_need_run
#************************************************************
@@ -4779,26 +4821,31 @@ sub rdb_diagnose_changes {
# Precede the message by the optional heading, else by "$My_name: "
my $heading = defined($_[0]) ? $_[0] : "$My_name: ";
- if ( &rdb_count_changes == 0 ) {
- warn "${heading}No changes\n";
- return;
- }
- warn "${heading}Changes:\n";
- if ( $#changed >= 0 ) {
- warn " Changed files, or newly in use since previous run(s):\n";
- foreach (uniqs(@changed)) { warn " '$_'\n"; }
+ if ($#rules_never_run >= 0) {
+ warn "${heading}Rules & subrules not known to be previously run:\n";
+ foreach (@rules_never_run) { warn " $_\n"; }
}
- if ( $#disappeared >= 0 ) {
- warn " No-longer-existing files:\n";
- foreach (uniqs(@disappeared)) { warn " '$_'\n"; }
+ if ( ($#changed >= 0) || ($#disappeared >= 0) || ($#no_dest >= 0) ) {
+ warn "${heading}File changes, etc:\n";
+ if ( $#changed >= 0 ) {
+ warn " Changed files, or newly in use since previous run(s):\n";
+ foreach (uniqs(@changed)) { warn " '$_'\n"; }
+ }
+ if ( $#disappeared >= 0 ) {
+ warn " No-longer-existing files:\n";
+ foreach (uniqs(@disappeared)) { warn " '$_'\n"; }
+ }
+ if ( $#no_dest >= 0 ) {
+ warn " Non-existent destination files:\n";
+ foreach (uniqs(@no_dest)) { warn " '$_'\n"; }
+ }
}
- if ( $#no_dest >= 0 ) {
- warn " Non-existent destination files:\n";
- foreach (uniqs(@no_dest)) { warn " '$_'\n"; }
+ elsif ($#rules_to_apply >=0) {
+ warn "${heading}The following rules & subrules became out-of-date:\n";
+ foreach (@rules_to_apply) { warn " '$_'\n"; }
}
- if ( $#rules_to_apply >= 0 ) {
- warn " Rules to apply:\n";
- foreach (uniqs(@rules_to_apply)) { warn " '$_'\n"; }
+ else {
+ warn "${heading}No file changes\n";
}
} #END rdb_diagnose_changes
@@ -4902,6 +4949,7 @@ sub rdb_recurseA {
# This routine sets a context for anything recursive, with @heads,
# %visited and $depth being set as local variables.
+
local @heads = ();
my $rules = shift;
@@ -5309,7 +5357,8 @@ sub show_array {
# Then print rest of @_, one item per line preceeded by some space
warn "$_[0]\n";
shift;
- foreach (@_){ warn " $_\n";}
+ if ($#_ >= 0) { foreach (@_){ warn " '$_'\n";} }
+ else { warn " NONE\n"; }
}
#************************************************************
@@ -5759,6 +5808,47 @@ sub show_cus_dep {
####################################################
+sub add_input_ext {
+ # Usage: add_input_ext( rule, ext, ... )
+ # Add extension(s) (specified without a leading period) to the
+ # list of input extensions for the given rule. The rule should be
+ # 'latex' or 'pdflatex'. These extensions are used when an input
+ # file without an extension is found by (pdf)latex, as in
+ # \input{file} or \includegraphics{figure}. When latexmk searches
+ # custom dependencies to make the missing file, it will assume that
+ # the file has one of the specified extensions.
+ my $rule = shift;
+ if ( ! exists $input_extensions{$rule} ) {
+ $input_extensions{$rule} = {};
+ }
+ my $Prule = $input_extensions{$rule};
+ foreach (@_) { $$Prule{$_} = 1; }
+}
+
+####################################################
+
+sub remove_input_ext {
+ # Usage: remove_input_ext( rule, ext, ... )
+ # Remove extension(s) (specified without a leading period) to the
+ # list of input extensions for the given rule. The rule should be
+ # 'latex' or 'pdflatex'. See sub add_input_ext for the use.
+ my $rule = shift;
+ if ( ! exists $input_extensions{$rule} ) { return; }
+ my $Prule = $input_extensions{$rule};
+ foreach (@_) { delete $$Prule{$_}; }
+}
+
+####################################################
+
+sub show_input_ext {
+ # Usage: show_input_ext( rule )
+ my $rule = shift;
+ show_array ("Input extensions for rule '$rule': ",
+ keys %{$input_extensions{$rule}} );
+}
+
+####################################################
+
sub find_dirs1 {
# Same as find_dirs, but argument is single string with directories
# separated by $search_path_separator