summaryrefslogtreecommitdiff
path: root/Master/texmf-dist
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r--Master/texmf-dist/doc/man/man1/latexmk.1110
-rw-r--r--Master/texmf-dist/doc/man/man1/latexmk.man1.pdfbin186720 -> 206548 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexmk/CHANGES60
-rw-r--r--Master/texmf-dist/doc/support/latexmk/INSTALL2
-rw-r--r--Master/texmf-dist/doc/support/latexmk/README7
-rw-r--r--Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc38
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.pdfbin186643 -> 191173 bytes
-rw-r--r--Master/texmf-dist/doc/support/latexmk/latexmk.txt2382
-rwxr-xr-xMaster/texmf-dist/scripts/latexmk/latexmk.pl483
9 files changed, 1763 insertions, 1319 deletions
diff --git a/Master/texmf-dist/doc/man/man1/latexmk.1 b/Master/texmf-dist/doc/man/man1/latexmk.1
index 0334565101f..2823348f536 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 1 "17 January 2018" ""
+.TH LATEXMK 1 "25 May 2018" ""
.SH NAME
latexmk \- generate LaTeX document
.SH SYNOPSIS
@@ -284,7 +284,7 @@ removed.
This cleanup is instead of a regular make. See the \fB-gg\fR option
if you want to do a cleanup then a make.
-\fITreatment of .bbl files:\fR If \fI$bibtex_use\fR is set to 0 or 1,
+\fITreatment of .bbl files: \fR If \fI$bibtex_use\fR is set to 0 or 1,
bbl files are always treated as non-regeneratable. If
\fI$bibtex_use\fR is set to 1.5, bbl files are counted as
non-regeneratable conditionally: If the bib file exists, then bbl
@@ -1023,6 +1023,18 @@ option, when you want \fIlatexmk\fR to do a compilation automatically
whenever source file(s) change, but do not want a previewer to be opened.
.TP
+.B -Werror
+This causes \fIlatexmk\fR to return a non-zero status code if any of
+the files processed gives a warning about problems with citations or
+references (i.e., undefined citations or references or about multiply
+defined references). This is \fBafter\fR \fIlatexmk\fR has completed
+all the runs it needs to try and resolve references and citations.
+Thus \fB-Werror\fR causes \fIlatexmk\fR to treat such warnings as
+errors, but only when they occur on the last run of (pdf)latex and
+only after processing is complete. Also can be set by the
+configuration variable \fI$warnings_as_errors\fR.
+
+.TP
.B -xelatex
Use \fIxelatex\fR. That is, use \fIxelatex\fR to process the source file(s) to
pdf. The generation of dvi and postscript files is turned off.
@@ -1160,9 +1172,12 @@ that of cygwin), \fIlatexmk\fR reads the first it finds of
"/opt/local/share/latexmk/LatexMk",
"/usr/local/share/latexmk/LatexMk",
"/usr/local/lib/latexmk/LatexMk".
-
+
In addition, it then tries the same set of locations, but with the
-file name replaced "LatexMk" replaced by "latexmkrc".
+file name replaced "LatexMk" replaced by "latexmkrc".
+
+If the environment variable LATEXMKRCSYS is set, its value is used as
+the name of the system RC file, instead of any of the above.
.PP
2) The user's RC file, if it exists. This can be in one of two
places. The traditional one is ".latexmkrc" in the user's home
@@ -1703,26 +1718,37 @@ option is selected, i.e., extensions of files to remove when the .dvi,
etc files are to be cleaned-up.
More general patterns are allowed, as for \fI$clean_ext\fR.
+
.TP
-.B $compiling_cmd [undefined], $failure_cmd [undefined], $success_cmd [undefined]
+.B $compiling_cmd [""], $failure_cmd [""], $warning_cmd [""], $success_cmd [""]
These variables specify commands that are executed at certain points
of compilations during preview-continuous mode. One motivation for
-their existance is to allow convenient visual indications of
+their existance is to allow very useful convenient visual indications of
compilation status even when the window receiving the screen output of
-the compilation is hidden.
+the compilation is hidden.
The commands are executed at the following points:
-$compiling_cmd at the start of compilation, $success_cmd at the end of
-a successful compilation, and $failure_cmd at the end of an
-unsuccessful compilation. If any of above variables is undefined (the
-default situation) or blank, then the corresponding command is not
-executed.
-
-An example of a typical setting of these variables is as follows
+\fI$compiling_cmd\fR at the start of compilation, \fI$success_cmd\fR
+at the end of a completely successful compilation, \fI$failure_cmd\fR
+at the end of an unsuccessful compilation, \fI$warning_cmd\fR at the
+of an otherwise successful compilation that gives warnings about
+undefined citations or references or about multiply defined
+references. If any of above variables is undefined or blank (the
+default situation), then the corresponding command is not executed.
+
+However, when \fI$warning_cmd\fR is not set, then in the case of a
+compilation with warnings about references or citations, but with no
+other error, one or other of \fI$success_cmd\fR or \fI$failure_cmd\fR
+is used (if it is set) according to the setting of
+\fI$warnings_as_errors\fR.
+
+An example of a simple setting of these variables is as follows
$compiling_cmd = "xdotool search --name \\"%D\\" set_window --name \\"%D compiling\\"";
$success_cmd = "xdotool search --name \\"%D\\" set_window --name \\"%D OK\\"";
+ $warning_cmd = "xdotool search --name \\"%D\\" ".
+ "set_window --name \\"%D CITE/REF ISSUE\\"";
$failure_cmd = "xdotool search --name \\"%D\\" set_window --name \\"%D FAILURE\\"";
These assume that the program \fIxdotool\fR is installed, that the
@@ -1739,6 +1765,17 @@ the title of the edit window. The visual indication in a window title
can useful, since the user does not have to keep shifting attention to
the (possibly hidden) compilation window to know the status of the
compilation.
+
+More complicated situations can best be handled by defining a Perl
+subroutine to invoke the necessary commands, and using the "internal"
+keyword in the definitions to get the subroutine to be invoked. (See
+the section Format of Command Specifications for how to do this.)
+
+Naturally, the above settings that invoke the \fIxdotool\fR program
+are only applicable when the X-Window system is used for the relevant
+window(s). For other cases, you will have to find what software
+solutions are available.
+
.TP
.B @cus_dep_list [()]
Custom dependency list -- see section on "Custom Dependencies".
@@ -2676,6 +2713,49 @@ Which kind of file is to be previewed if a previewer is used. The
possible values are "default", "dvi", "ps", "pdf". The value
of "default" means that the "highest" of the kinds of file generated is
to be used (among dvi, ps and pdf).
+
+.TP
+.B $warnings_as_errors [0]
+Normally \fIlatexmk\fR copies the behavior of \fIlatex\fR in treating
+undefined references and citations and multiply defined references as
+conditions that give a warning but not an error. The variable
+\fI$warnings_as_errors\fR controls whether this behavior is modified.
+
+When the variable is non-zero, \fIlatexmk\fR at the end of its run
+will return a non-zero status code to the operating system if any of
+the files processed gives a warning about problems with citations or
+references (i.e., undefined citations or references or multiply
+defined references). This is \fBafter\fR \fIlatexmk\fR has completed
+all the runs it needs to try and resolve references and citations.
+Thus \fI$warnings_as_errors\fR being nonzero causes \fIlatexmk\fR to
+treat such warnings as errors, but only when they occur on the last
+run of (pdf)latex and only after processing is complete. A non-zero
+value \fI$warnings_as_errors\fR can be set by the command-line option
+\fB-Werror\fR.
+
+The default behavior is normally satisfactory in the usual
+edit-compile-edit cycle. But, for example, \fIlatexmk\fR can also be
+used as part of a build process for some bigger project, e.g., for
+creating documentation in the build of a software application. Then
+it is often sensible to treat citation and reference warnings as
+errors that require the overall build process to be aborted. Of
+course, since multiple runs of (pdf)latex are generally needed to
+resolve references and citations, what matters is \fInot\fR the
+warnings on the first run, but the warnings on the \fIlast\fR run;
+\fIlatexmk\fR takes this into account appropriately.
+
+In addition, when preview-continuous mode is used, a non-zero value
+for \fI$warnings_as_errors\fR changes the use of the commands
+\fI$failure_cmd\fR, \fI$warning_cmd\fR, and \fI$success_cmd\fR after a
+compliation. If there are citation or reference warnings, but no
+other errors, the behavior is as follows. If \fI$warning_cmd\fR is
+set, it is used. If it is not set, then then if
+\fI$warnings_as_errors\fR is non-zero and \fI$failure_cmd\fR is set,
+then \fI$failure_cmd\fR. Otherwise \fI$success_cmd\fR is used, if it
+is set. (The foregoing explanation is rather complicated, because
+\fIlatexmk\fR has to deal with the case that one or more of the
+commands isn't set.)
+
.TP
.B $xdvipdfmx ["xdvipdfmx -o %D %O %S"]
@@ -3249,7 +3329,7 @@ e-mail addresses are not written in their standard form to avoid being
harvested too easily.)
.SH AUTHOR
Current version, by John Collins (username jcc8 at node psu.edu).
-(Version 4.55).
+(Version 4.56).
Released version can be obtained from CTAN:
<http://www.ctan.org/pkg/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 3bfcfb00a27..b5bcd1a74d5 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 7e7deb47667..775e879c8fb 100644
--- a/Master/texmf-dist/doc/support/latexmk/CHANGES
+++ b/Master/texmf-dist/doc/support/latexmk/CHANGES
@@ -573,21 +573,51 @@ From v. 4.52c to 4.54
Add a sample latexmkrc file for use with bib2gls and glossaries-extra.
From v. 4.54 to 4.54c
- Work-around for when bsd_glob is not available on old installations of
- Perl. (Note that with these old installations, clean-up operations
- may not work when file or directory names contain spaces.)
+ Work-around for when bsd_glob is not available on old installations of
+ Perl. (Note that with these old installations, clean-up operations
+ may not work when file or directory names contain spaces.)
From v. 4.54c to 4.55
- Correct bug that $search_path_separator wasn't defined under msys.
- Ensure that all configuration variables do have sensible default
- definitions (which wasn't always the case previously).
- Allow optional timeout in pvc mode after a period of inactivity.
- (See documentation for -pvctimeout option.)
- Compensate for problems caused by time offset between system time on
- system running latexmk and file times on remote file system.
- (It caused wrong behavior when a document uses biber, MiKTeX
- is used, the aux_dir is on a remote file system, and the system
- time on the host of the file system differs from the system time on
- the system running latexmk.)
-
+ Correct bug that $search_path_separator wasn't defined under msys.
+ Ensure that all configuration variables do have sensible default
+ definitions (which wasn't always the case previously).
+ Allow optional timeout in pvc mode after a period of inactivity.
+ (See documentation for -pvctimeout option.)
+ Compensate for problems caused by time offset between system time on
+ system running latexmk and file times on remote file system.
+ (It caused wrong behavior when a document uses biber, MiKTeX
+ is used, the aux_dir is on a remote file system, and the system
+ time on the host of the file system differs from the system time on
+ the system running latexmk.)
+
+From v. 4.55 to 4.55a
+ Add option that latexmk returns a non-zero status code when
+ the final run of (pdf)latex gives warnings about undefined
+ references or citations or about multiply defined references.
+ Implement $warning_cmd to allow a visual cue for these situations in
+ pvc mode (in addition to the current possibilities for
+ $compiling_cmd, $success_cmd and $failure_cmd).
+
+From v. 4.55a to 4.56
+ Correct parsing of biber's log file.
+ Implement $warning_cmd.
+ Deal correctly with situation that files reported in the .fls file
+ as INPUT or OUTPUT files no longer exist at end of run. These
+ files aren't true source files or generated files from latexmk's
+ point of view. Such cases can arise from a bug in the TeX
+ engine (as with lualatex in TeXLive 2016/2017). They can also
+ arise when temporary files are created, read and deleted during
+ a run (as with the minted package).
+ Update example latexmrc file for pythontex.
+ Better error message when .bib file(s) not found.
+ Better handling and diagnostics when names of expected and actual
+ names of .log disagree.
+ In particular, there is some automatic reconfiguration when .log
+ file is not in expected place (e.g., because $aux_dir is different
+ to $out_dir, but TeXLive is used, so -aux-directory option for TeX
+ engines isn't supported).
+ Fix problem of .bib files sometimes not being found by bibtex when
+ latexmk runs under msys and -outputdirectory is specified.
+ Add use of environment variable LATEXMKRCSYS to specify system rc
+ file.
diff --git a/Master/texmf-dist/doc/support/latexmk/INSTALL b/Master/texmf-dist/doc/support/latexmk/INSTALL
index a90fee4600c..ede38726136 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.55, 17 January 2018)
+ (Version 4.56, 25 May 2018)
John Collins
Physics Department
diff --git a/Master/texmf-dist/doc/support/latexmk/README b/Master/texmf-dist/doc/support/latexmk/README
index dea4aba12de..119b64d0f89 100644
--- a/Master/texmf-dist/doc/support/latexmk/README
+++ b/Master/texmf-dist/doc/support/latexmk/README
@@ -1,5 +1,5 @@
-Latexmk, version 4.55, 17 January 2018
---------------------------------------
+Latexmk, version 4.56, 25 May 2018
+----------------------------------
Latexmk completely automates the process of generating a LaTeX
document. Essentially, it is a highly specialized cousin of the
@@ -91,7 +91,7 @@ NOTES:-
John Collins
---------------------------- "latexmk -h" ----------------------------
-Latexmk 4.55: Automatic LaTeX document generation routine
+Latexmk 4.56: Automatic LaTeX document generation routine
Usage: latexmk [latexmk_options] [filename ...]
@@ -210,6 +210,7 @@ Usage: latexmk [latexmk_options] [filename ...]
-view=none - no viewer is used
-view=ps - viewer is for ps
-view=pdf - viewer is for pdf
+ -Werror - treat warnings from called programs as errors
-xelatex - use xelatex for processing files to pdf
and turn dvi/ps modes off
diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc
index 8a3d3f1ad26..b2743c698a7 100644
--- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc
+++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc
@@ -1,12 +1,35 @@
# This shows how to use the pythontex package with latexmk
+# This **present** version (1 April 2018) it only works when
+# the operating system and the file system support symbolic
+# links (e.g., linux, OS-X and other unix implementations with their
+# usual file systems). It is **not** tested on MS-Windows, but
+# **may** work on recent versions.
+# In the future, a version of latexmk may provide better support
+# without the restrictions.
-# This version has a fudge on the latex and pdflatex commands that
-# allows the pythontex custom dependency to work even when $out_dir
-# is used to set the output directory. Without the fudge (done by
-# trickery symbolic links) the custom dependency for using pythontex
-# will not be detected.
+# This version also has a restriction that on initial runs pythontex
+# is not invoked. Later runs after a modification of the source
+# file in the invoked python code do trigger the invocation of
+# pythontex. The planned future enhancements of latexmk should
+# remedy this.
+# This latexmkrc is an example of a style of configuration that may be
+# useful for other packages.
+
+# This version has a fudge on the latex and pdflatex commands that
+# allows the pythontex custom dependency to work even when $out_dir
+# is used to set the output directory. Without the fudge (done by
+# trickery with symbolic links) the custom dependency for using
+# pythontex will not be detected.
+
+push @generated_exts, 'pytxcode';
add_cus_dep('pytxcode', 'tex', 0, 'pythontex');
+
+$latex = 'internal mylatex %R %Z latex %O %S';
+$pdflatex = 'internal mylatex %R %Z pdflatex %O %S';
+$lualatex = 'internal mylatex %R %Z lualatex %O %S';
+$xelatex = 'internal mylatex %R %Z xelatex -no-pdf %O %S';
+
sub pythontex {
# This subroutine is a fudge, because it from latexmk's point of
# view, it makes the main .tex file depend on the .pytxcode file.
@@ -17,9 +40,6 @@ sub pythontex {
return system("pythontex.py \"$_[0]\"") ;
}
-
-$pdflatex = 'internal mylatex %R %Z pdflatex %O %S';
-$latex = 'internal mylatex %R %Z latex %O %S';
sub mylatex {
my $root = shift;
my $dir_string = shift;
@@ -44,5 +64,3 @@ sub mylatex {
}
return system @_;
}
-
-
diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf
index d39a263bc4b..9d22eb8a023 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 772e2924ab0..5bf1c69056c 100644
--- a/Master/texmf-dist/doc/support/latexmk/latexmk.txt
+++ b/Master/texmf-dist/doc/support/latexmk/latexmk.txt
@@ -61,7 +61,7 @@ DESCRIPTION
- 17 January 2018 1
+ 25 May 2018 1
@@ -127,7 +127,7 @@ LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE
- 17 January 2018 2
+ 25 May 2018 2
@@ -193,7 +193,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 3
+ 25 May 2018 3
@@ -259,7 +259,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 4
+ 25 May 2018 4
@@ -325,7 +325,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 5
+ 25 May 2018 5
@@ -334,7 +334,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
LATEXMK(1) General Commands Manual LATEXMK(1)
- Treatment of .bbl files: If $bibtex_use is set to 0 or 1, bbl
+ Treatment of .bbl files: If $bibtex_use is set to 0 or 1, bbl
files are always treated as non-regeneratable. If $bibtex_use
is set to 1.5, bbl files are counted as non-regeneratable condi-
tionally: If the bib file exists, then bbl files are regenerat-
@@ -391,7 +391,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 6
+ 25 May 2018 6
@@ -457,7 +457,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 7
+ 25 May 2018 7
@@ -523,7 +523,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 8
+ 25 May 2018 8
@@ -589,7 +589,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 9
+ 25 May 2018 9
@@ -655,7 +655,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 10
+ 25 May 2018 10
@@ -721,7 +721,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 11
+ 25 May 2018 11
@@ -787,7 +787,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 12
+ 25 May 2018 12
@@ -853,7 +853,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 13
+ 25 May 2018 13
@@ -919,7 +919,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 14
+ 25 May 2018 14
@@ -985,7 +985,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 15
+ 25 May 2018 15
@@ -1051,7 +1051,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 16
+ 25 May 2018 16
@@ -1117,7 +1117,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
- 17 January 2018 17
+ 25 May 2018 17
@@ -1174,16 +1174,16 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
be opened.
- -xelatex
- Use xelatex. That is, use xelatex to process the source file(s)
- to pdf. The generation of dvi and postscript files is turned
- off.
-
- This option is equivalent to using the following set of options
+ -Werror
+ This causes latexmk to return a non-zero status code if any of
+ the files processed gives a warning about problems with cita-
+ tions or references (i.e., undefined citations or references or
+ about multiply defined references). This is after latexmk has
+ completed all the runs it needs to try and resolve references
- 17 January 2018 18
+ 25 May 2018 18
@@ -1192,6 +1192,19 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
LATEXMK(1) General Commands Manual LATEXMK(1)
+ and citations. Thus -Werror causes latexmk to treat such warn-
+ ings as errors, but only when they occur on the last run of
+ (pdf)latex and only after processing is complete. Also can be
+ set by the configuration variable $warnings_as_errors.
+
+
+ -xelatex
+ Use xelatex. That is, use xelatex to process the source file(s)
+ to pdf. The generation of dvi and postscript files is turned
+ off.
+
+ This option is equivalent to using the following set of options
+
-pdfxe -dvi- -ps-
[Note: Note that the method of implementation of this option,
@@ -1233,32 +1246,32 @@ EXAMPLES
source file changes.
% latexmk -c # remove .aux, .log, .bbl, .blg, .dvi,
- .pdf, .ps & .bbl files
-DEALING WITH ERRORS, PROBLEMS, ETC
- Some possibilities:
+ 25 May 2018 19
- a. If you get a strange error, do look carefully at the output that is
- on the screen and in log files. While there is much that is notori-
- ously verbose in the output of latex (and that is added to by latexmk),
- the verbosity is there for a reason: to enable the user to diagnose
- problems. Latexmk does repeat some messages at the end of a run that
- it thinks would otherwise be easy to miss in the middle of other
- 17 January 2018 19
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ .pdf, .ps & .bbl files
-LATEXMK(1) General Commands Manual LATEXMK(1)
+DEALING WITH ERRORS, PROBLEMS, ETC
+ Some possibilities:
- output.
+ a. If you get a strange error, do look carefully at the output that is
+ on the screen and in log files. While there is much that is notori-
+ ously verbose in the output of latex (and that is added to by latexmk),
+ the verbosity is there for a reason: to enable the user to diagnose
+ problems. Latexmk does repeat some messages at the end of a run that
+ it thinks would otherwise be easy to miss in the middle of other out-
+ put.
b. Generally, remember that latexmk does its work by running other pro-
grams. Your first priority in dealing with errors should be to examine
@@ -1299,29 +1312,31 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
This puts a line in the log file that latexmk will treat as implying
that the file bar.baz was read. (At present I don't know a way of
doing this automatically.) Of course, if the file has a different
- name, change bar.baz to the name of your file.
- g. See also the section ADVANCED CONFIGURATION: Some extra resources.
- h. Look on tex.stackexchange, i.e., at http://tex.stackex-
- change.com/questions/tagged/latexmk Someone may have already solved
- your problem.
- i. Ask a question at tex.stackexchange.com.
+ 25 May 2018 20
- j. Or ask me (the author of latexmk). My e-mail is at the end of this
- documentation.
- 17 January 2018 20
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ name, change bar.baz to the name of your file.
+ g. See also the section ADVANCED CONFIGURATION: Some extra resources.
+ h. Look on tex.stackexchange, i.e., at http://tex.stackex-
+ change.com/questions/tagged/latexmk Someone may have already solved
+ your problem.
+
+ i. Ask a question at tex.stackexchange.com.
+
+ j. Or ask me (the author of latexmk). My e-mail is at the end of this
+ documentation.
-LATEXMK(1) General Commands Manual LATEXMK(1)
CONFIGURATION/INITIALIZATION (RC) FILES
@@ -1345,68 +1360,70 @@ CONFIGURATION/INITIALIZATION (RC) FILES
In addition, it then tries the same set of locations, but with the file
name replaced "LatexMk" replaced by "latexmkrc".
+ If the environment variable LATEXMKRCSYS is set, its value is used as
+ the name of the system RC file, instead of any of the above.
+
2) The user's RC file, if it exists. This can be in one of two places.
- The traditional one is ".latexmkrc" in the user's home directory. The
- other possibility is "latexmk/latexmkrc" in the user's XDG configura-
- tion home directory. The actual file read is the first of "$XDG_CON-
- FIG_HOME/latexmk/latexmkrc" or "$HOME/.latexmkrc" which exists. (See
+ The traditional one is ".latexmkrc" in the user's home directory. The
+ other possibility is "latexmk/latexmkrc" in the user's XDG configura-
+ tion home directory. The actual file read is the first of "$XDG_CON-
+ FIG_HOME/latexmk/latexmkrc" or "$HOME/.latexmkrc" which exists. (See
https://specifications.freedesktop.org/basedir-spec/basedir-spec-lat-
est.html for details on the XDG Base Directory Specification.)
- Here $HOME is the user's home directory. [Latexmk determines the
- user's home directory as follows: It is the value of the environment
- variable HOME, if this variable exists, which normally is the case on
- UNIX-like systems (including Linux and OS-X). Otherwise the environ-
- ment variable USERPROFILE is used, if it exists, which normally is the
+ Here $HOME is the user's home directory. [Latexmk determines the
+ user's home directory as follows: It is the value of the environment
+ variable HOME, if this variable exists, which normally is the case on
+ UNIX-like systems (including Linux and OS-X). Otherwise the environ-
+ ment variable USERPROFILE is used, if it exists, which normally is the
case on MS-Windows systems. Otherwise a blank string is used instead of
$HOME, in which case latexmk does not look for an RC file in it.]
- $XDG_CONFIG_HOME is the value of the environment variable XDG_CON-
- FIG_HOME if it exists. If this environment variable does not exist,
- but $HOME is non-blank, then $XDG_CONFIG_HOME is set to the default
- value of $HOME/.config. Otherwise $XDG_CONFIG_HOME is blank, and
- latexmk does not look for an RC file under it.
-
- 3) The RC file in the current working directory. This file can be
- named either "latexmkrc" or ".latexmkrc", and the first of these to be
- found is used, if any.
- 4) Any RC file(s) specified on the command line with the -r option.
+ 25 May 2018 21
- 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
- 17 January 2018 21
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ $XDG_CONFIG_HOME is the value of the environment variable XDG_CON-
+ FIG_HOME if it exists. If this environment variable does not exist,
+ but $HOME is non-blank, then $XDG_CONFIG_HOME is set to the default
+ value of $HOME/.config. Otherwise $XDG_CONFIG_HOME is blank, and
+ latexmk does not look for an RC file under it.
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ 3) The RC file in the current working directory. This file can be
+ named either "latexmkrc" or ".latexmkrc", and the first of these to be
+ found is used, if any.
+ 4) Any RC file(s) specified on the command line with the -r option.
- knowledge of the Perl language by using the examples in this document
+ 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
+ Note that command line options are obeyed in the order in which they
are written; thus any RC file specified on the command line with the -r
- option can override previous options but can be itself overridden by
- later options on the command line. There is also the -e option, which
+ option can override previous options but can be itself overridden by
+ later options on the command line. There is also the -e option, which
allows initialization code to be specified in latexmk's command line.
- For possible examples of code for in an RC file, see the directory
- example_rcfiles in the distribution of latexmk (e.g., at http://mir-
+ For possible examples of code for in an RC file, see the directory
+ example_rcfiles in the distribution of latexmk (e.g., at http://mir-
ror.ctan.org/support/latexmk/example_rcfiles).
HOW TO SET VARIABLES IN INITIALIZATION FILES
- The important variables that can be configured are described in the
- section "List of configuration variables usable in initialization
+ The important variables that can be configured are described in the
+ section "List of configuration variables usable in initialization
files". Syntax for setting these variables is of the following forms:
$bibtex = 'bibtex %O %B';
@@ -1419,240 +1436,242 @@ HOW TO SET VARIABLES IN INITIALIZATION FILES
@default_files = ('paper', 'paper1');
- for the setting of an array of strings. It is possible to append an
+ for the setting of an array of strings. It is possible to append an
item to an array variable as follows:
push @default_files, 'paper2';
- Note that simple "scalar" variables have names that begin with a $
+ Note that simple "scalar" variables have names that begin with a $
character and array variables have names that begin with a @ character.
Each statement ends with a semicolon.
- Strings should be enclosed in single quotes. (You could use double
- quotes, as in many programming languages. But then the Perl program-
- ming language brings into play some special rules for interpolating
- variables into strings. People not fluent in Perl will want to avoid
- these complications.)
-
- You can do much more complicated things, but for this you will need to
- consult a manual for the Perl programming language.
+ 25 May 2018 22
-FORMAT OF COMMAND SPECIFICATIONS
- Some of the variables set the commands that latexmk uses for carrying
- out its work, for example to generate a dvi file from a tex file or to
- view a postscript file. This section describes some important features
- 17 January 2018 22
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ Strings should be enclosed in single quotes. (You could use double
+ quotes, as in many programming languages. But then the Perl program-
+ ming language brings into play some special rules for interpolating
+ variables into strings. People not fluent in Perl will want to avoid
+ these complications.)
+ You can do much more complicated things, but for this you will need to
+ consult a manual for the Perl programming language.
-LATEXMK(1) General Commands Manual LATEXMK(1)
- of how the commands are specified. (Note that some of the possibili-
+FORMAT OF COMMAND SPECIFICATIONS
+ Some of the variables set the commands that latexmk uses for carrying
+ out its work, for example to generate a dvi file from a tex file or to
+ view a postscript file. This section describes some important features
+ of how the commands are specified. (Note that some of the possibili-
ties listed here do not apply to the $kpsewhich variable; see its docu-
mentation.)
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
+ 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
+ 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 in the invoca-
- tion of latexmk, it results in the replacement of %O by "-interac-
+ tion of latexmk, it results in the replacement of %O by "-interac-
tion=batchmode".)
The available placeholders are:
- %B base of filename for current command. E.g., if a postscript
- file document.ps is being made from the dvi file document.dvi,
+ %B base of filename for current command. E.g., if a postscript
+ file document.ps is being made from the dvi file document.dvi,
then the basename is document.
- %D destination file (e.g., the name of the postscript file when
+ %D destination file (e.g., the name of the postscript file when
converting a dvi file to postscript).
%O options
%R root filename. This is the base name for the main tex file.
- %S source file (e.g., the name of the dvi file when converting a
+ %S source file (e.g., the name of the dvi file when converting a
dvi file to ps).
%T The name of the primary tex file.
- %Y Name of directory for auxiliary output files (see the configura-
- tion variable $aux_dir). A directory separation character ('/')
- is appended if $aux_dir is non-empty and does not end in a suit-
- able character, with suitable characters being those appropriate
- to UNIX and MS-Windows, i.e., ':', '/' and '\'. Note that if
- after initialization, $out_dir is set, but $aux_dir is not set
- (i.e., it is blank), then latexmk sets $aux_dir to the same
- value $out_dir.
+ %Y
- %Z Name of directory for output files (see the configuration vari-
- able $out_dir). A directory separation character ('/') is
- appended if $out_dir is non-empty and does not end in a suitable
- character, with suitable characters being those appropriate to
- UNIX and MS-Windows, i.e., ':', '/' and '\'.
- If for some reason you need a literal % character in your string not
- subject to the above rules, use "%%".
+ 25 May 2018 23
- 17 January 2018 23
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ Name of directory for auxiliary output files (see the configura-
+ tion variable $aux_dir). A directory separation character ('/')
+ is appended if $aux_dir is non-empty and does not end in a suit-
+ able character, with suitable characters being those appropriate
+ to UNIX and MS-Windows, i.e., ':', '/' and '\'. Note that if
+ after initialization, $out_dir is set, but $aux_dir is not set
+ (i.e., it is blank), then latexmk sets $aux_dir to the same
+ value $out_dir.
+ %Z Name of directory for output files (see the configuration vari-
+ able $out_dir). A directory separation character ('/') is
+ appended if $out_dir is non-empty and does not end in a suitable
+ character, with suitable characters being those appropriate to
+ UNIX and MS-Windows, i.e., ':', '/' and '\'.
+
+ If for some reason you need a literal % character in your string not
+ subject to the above rules, use "%%".
- Appropriate quoting will be applied to the filename substitutions, so
- you mustn't supply them yourself even if the names of your files have
+ Appropriate quoting will be applied to the filename substitutions, so
+ you mustn't supply them yourself even if the names of your files have
spaces in them. (But if your TeX filenames have spaces in them, beware
that many versions of the TeX program cannot correctly handle filenames
- containing spaces.) In case latexmk's quoting does not work correctly
- on your system, you can turn it off -- see the documentation for the
+ containing spaces.) In case latexmk's quoting does not work correctly
+ on your system, you can turn it off -- see the documentation for the
variable $quote_filenames.
- The distinction between %B and %R needs a bit of care, since they are
- often the same, but not always. For example on a simple document, the
+ The distinction between %B and %R needs a bit of care, since they are
+ often the same, but not always. For example on a simple document, the
basename of a bibtex run is the same as for the texfile. But in a doc-
- ument with several bibliographies, the bibliography files will have a
- variety of names. Since bibtex is invoked with the basename of the
- bibliography file, the setting for the bibtex command should therefore
+ ument with several bibliographies, the bibliography files will have a
+ variety of names. Since bibtex is invoked with the basename of the
+ bibliography file, the setting for the bibtex command should therefore
be
$bibtex = 'bibtex %O %B';
- Generally, you should use %B rather than %R. Similarly for most pur-
+ Generally, you should use %B rather than %R. Similarly for most pur-
poses, the name %T of the primary texfile is not a useful placeholder.
- See the default values in the section "List of configuration variables
+ See the default values in the section "List of configuration variables
usable in initialization files" for what is normally the most appropri-
ate usage.
If you omit to supply any placeholders whatever in the specification of
- a command, latexmk will supply what its author thinks are appropriate
+ a command, latexmk will supply what its author thinks are appropriate
defaults. This gives compatibility with configuration files for previ-
ous versions of latexmk, which didn't use placeholders.
- "Detaching" a command: Normally when latexmk runs a command, it waits
+ "Detaching" a command: Normally when latexmk runs a command, it waits
for the command to run to completion. This is appropriate for commands
like latex, of course. But for previewers, the command should normally
- run detached, so that latexmk gets the previewer running and then
+ run detached, so that latexmk gets the previewer running and then
returns to its next task (or exits if there is nothing else to do). To
- achieve this effect of detaching a command, you need to precede the
- command name with "start ", as in
+ achieve this effect of detaching a command, you need to precede the
- $dvi_previewer = 'start xdvi %O %S';
- This will be translated to whatever is appropriate for your operating
- system.
- Notes: (1) In some circumstances, latexmk will always run a command
- detached. This is the case for a previewer in preview continuous mode,
- since otherwise previewing continuously makes no sense. (2) This pre-
- cludes the possibility of running a command named start. (3) If the
- word start occurs more than once at the beginning of the command
- string, that is equivalent to having just one. (4) Under cygwin, some
- complications happen, since cygwin amounts to a complicated merging of
- UNIX and MS-Windows. See the source code for how I've handled the
- problem.
+ 25 May 2018 24
- Command names containing spaces: Under MS-Windows it is common that the
- 17 January 2018 24
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ command name with "start ", as in
+ $dvi_previewer = 'start xdvi %O %S';
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ This will be translated to whatever is appropriate for your operating
+ system.
+ Notes: (1) In some circumstances, latexmk will always run a command
+ detached. This is the case for a previewer in preview continuous mode,
+ since otherwise previewing continuously makes no sense. (2) This pre-
+ cludes the possibility of running a command named start. (3) If the
+ word start occurs more than once at the beginning of the command
+ string, that is equivalent to having just one. (4) Under cygwin, some
+ complications happen, since cygwin amounts to a complicated merging of
+ UNIX and MS-Windows. See the source code for how I've handled the
+ problem.
+ Command names containing spaces: Under MS-Windows it is common that the
name of a command includes spaces, since software is often installed in
- a subdirectory of "C:\Program Files". Such command names should be
+ a subdirectory of "C:\Program Files". Such command names should be
enclosed in double quotes, as in
$lpr_pdf = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p
%S';
$pdf_previewer = 'start "c:/Program Files/SumatraPDF/Suma-
traPDF.exe" %O %S';
- $pdf_previewer = 'start "c:/Program Files/SumatraPDF (x86)/Suma-
+ $pdf_previewer = 'start "c:/Program Files/SumatraPDF (x86)/Suma-
traPDF.exe" %O %S';
- (Note about the above example: Under MS-Windows forward slashes are
+ (Note about the above example: Under MS-Windows forward slashes are
equivalent to backslashes in a filename under almost all circumstances,
- provided that the filename is inside double quotes. It is easier to
+ 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
+ not have to worry about the rules for dealing with forward slashes in
strings in the Perl language.)
- Command names under Cygwin: If latexmk is executed by Cygwin's Perl,
+ Command names under Cygwin: If latexmk is executed by Cygwin's Perl,
be particularly certain that pathnames in commands have forward slashes
- not the usual backslashes for the separator of pathname components.
- See the above examples. Backslashes often get misinterpreted by the
+ not the usual backslashes for the separator of pathname components.
+ See the above examples. Backslashes often get misinterpreted by the
Unix shell used by Cygwin's Perl to execute external commands. Forward
slashes don't suffer from this problem, and (when quoted, as above) are
equally acceptable to MS-Windows.
- Using MS-Windows file associations: A useful trick under modern ver-
+ Using MS-Windows file associations: A useful trick under modern ver-
sions of MS-Windows (e.g., WinXP) is to use just the command 'start' by
itself:
$dvi_previewer = 'start %S';
Under 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.) But note that this trick is not always suit-
- able for the pdf previwer, if your system has acroread for the default
- pdf viewer. As explained elsewhere, acroread under MS-Windows does not
- work well with latex and latexmk, because acroread locks the pdf file.
+ has associated with dvi files. (The same applies for a postscript
+ viewer and a pdf viewer.) But note that this trick is not always
- Not using a certain command: If a command is not to be run, the command
- name NONE is used, as in
- $lpr = 'NONE lpr';
- This typically is used when an appropriate command does not exist on
- your system. The string after the "NONE" is effectively a comment.
+ 25 May 2018 25
- Options to commands: Setting the name of a command can be used not only
- for changing the name of the command called, but also to add options to
- command. Suppose you want latexmk to use latex with source specials
- enabled. Then you might use the following line in an initialization
- file:
- 17 January 2018 25
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ suitable for the pdf previwer, if your system has acroread for the
+ default pdf viewer. As explained elsewhere, acroread under MS-Windows
+ does not work well with latex and latexmk, because acroread locks the
+ pdf file.
+ Not using a certain command: If a command is not to be run, the command
+ name NONE is used, as in
+ $lpr = 'NONE lpr';
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ This typically is used when an appropriate command does not exist on
+ your system. The string after the "NONE" is effectively a comment.
+ Options to commands: Setting the name of a command can be used not only
+ for changing the name of the command called, but also to add options to
+ command. Suppose you want latexmk to use latex with source specials
+ enabled. Then you might use the following line in an initialization
+ file:
$latex = 'latex --src-specials %O %S';
@@ -1689,6 +1708,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
%B';
This definition assumes you are using a UNIX-like system (which
+
+
+
+ 25 May 2018 26
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
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.
@@ -1708,18 +1739,6 @@ LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
$always_view_file_via_temporary [0]
Whether ps and pdf files are initially to be made in a temporary
-
-
-
- 17 January 2018 26
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
directory and then moved to the final location. (This applies
to dvips, dvipdf, and ps2pdf operations, and the filtering oper-
ators on dvi and ps files. It does not apply to pdflatex,
@@ -1755,6 +1774,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
doesn't always generate lines in the .fls file for input lua
files. (The situation with lualatex is HIGHLY version depen-
dent, e.g., there was a big change between TeXLive 2016 and
+
+
+
+ 25 May 2018 27
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
TeXLive 2017.)
To keep backward compatibility with older versions of latexmk,
@@ -1774,18 +1805,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
$aux_dir [""]
The directory in which auxiliary files (aux, log, etc) are to be
-
-
-
- 17 January 2018 27
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
written by a run of (pdf)latex. If this variable is not set,
but $out_dir is set, then $aux_dir is set to $out_dir, which is
the directory to which general output files are to be written.
@@ -1822,6 +1841,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
The banner message to print across each page when converting the
dvi file to postscript. This is equivalent to the -bm option.
+
+
+ 25 May 2018 28
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
$banner_scale [220.0]
A decimal number that specifies how large the banner message
will be printed. Experimentation is necessary to get the right
@@ -1840,18 +1870,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
tem, of course. Examples for setting this variable are:
@BIBINPUTS = ( ".", "C:\\bibfiles" );
-
-
-
- 17 January 2018 28
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
@BIBINPUTS = ( ".", "\\server\bibfiles" );
@BIBINPUTS = ( ".", "C:/bibfiles" );
@BIBINPUTS = ( ".", "//server/bibfiles" );
@@ -1888,6 +1906,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
covers from the log file that one (or more) bibtex/biber-gener-
ated bibliographies are used, it can run bibtex or biber when-
ever it appears necessary to regenerate the bbl file(s) from
+
+
+
+ 25 May 2018 29
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
their source bib database file(s). But sometimes, the bib
file(s) are not available (e.g., for a document obtained from an
external archive), but the bbl files are provided. In that case
@@ -1906,18 +1936,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
when the bib files all exist).
2: run bibtex or biber whenever it appears necessary to update
the bbl files, without testing for the existence of the bib
-
-
-
- 17 January 2018 29
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
files; always delete .bbl files in a cleanup.
@@ -1954,6 +1972,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
be deleted, by using the place holder %R, as in commands, and it
is also possible to use wildcards. Thus setting
+
+
+
+ 25 May 2018 30
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
$clean_ext = "out %R-blx.bib %R-figures*.log";
in an initialization file will imply that when a clean-up opera-
@@ -1969,46 +1999,57 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
More general patterns are allowed, as for $clean_ext.
- $compiling_cmd [undefined], $failure_cmd [undefined], $success_cmd
- [undefined]
-
-
-
-
- 17 January 2018 30
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ $compiling_cmd [""], $failure_cmd [""], $warning_cmd [""], $success_cmd
+ [""]
These variables specify commands that are executed at certain
points of compilations during preview-continuous mode. One
- motivation for their existance is to allow convenient visual
- indications of compilation status even when the window receiving
- the screen output of the compilation is hidden.
+ motivation for their existance is to allow very useful conve-
+ nient visual indications of compilation status even when the
+ window receiving the screen output of the compilation is hidden.
The commands are executed at the following points: $compil-
ing_cmd at the start of compilation, $success_cmd at the end of
- a successful compilation, and $failure_cmd at the end of an
- unsuccessful compilation. If any of above variables is unde-
- fined (the default situation) or blank, then the corresponding
- command is not executed.
+ a completely successful compilation, $failure_cmd at the end of
+ an unsuccessful compilation, $warning_cmd at the of an otherwise
+ successful compilation that gives warnings about undefined cita-
+ tions or references or about multiply defined references. If any
+ of above variables is undefined or blank (the default situa-
+ tion), then the corresponding command is not executed.
- An example of a typical setting of these variables is as follows
+ However, when $warning_cmd is not set, then in the case of a
+ compilation with warnings about references or citations, but
+ with no other error, one or other of $success_cmd or $fail-
+ ure_cmd is used (if it is set) according to the setting of
+ $warnings_as_errors.
+
+ An example of a simple setting of these variables is as follows
$compiling_cmd = "xdotool search --name \"%D\" set_window
--name \"%D compiling\"";
$success_cmd = "xdotool search --name \"%D\" set_window
--name \"%D OK\"";
+ $warning_cmd = "xdotool search --name \"%D\" ".
+ "set_window --name \"%D CITE/REF ISSUE\"";
$failure_cmd = "xdotool search --name \"%D\" set_window
--name \"%D FAILURE\"";
These assume that the program xdotool is installed, that the
previewer is using an X-Window system for display, and that the
title of the window contains the name of the displayed file, as
+
+
+
+ 25 May 2018 31
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
it normally does. When the commands are executed, the place-
holder string %D is replaced by the name of the destination
file, which is the previewed file. The above commands result in
@@ -2022,60 +2063,72 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
to keep shifting attention to the (possibly hidden) compilation
window to know the status of the compilation.
+ More complicated situations can best be handled by defining a
+ Perl subroutine to invoke the necessary commands, and using the
+ "internal" keyword in the definitions to get the subroutine to
+ be invoked. (See the section Format of Command Specifications
+ for how to do this.)
+
+ Naturally, the above settings that invoke the xdotool program
+ are only applicable when the X-Window system is used for the
+ relevant window(s). For other cases, you will have to find what
+ software solutions are available.
+
+
@cus_dep_list [()]
Custom dependency list -- see section on "Custom Dependencies".
@default_excluded_files [()]
- When latexmk is invoked with no files specified on the command
+ When latexmk is invoked with no files specified on the command
line, then, by default, it will process all files in the current
directory with the extension .tex. (In general, it will process
the files specified in the @default_files variable.)
- But sometimes you want to exclude particular files from this
- default list. In that case you can specify the excluded files
+ But sometimes you want to exclude particular files from this
+ default list. In that case you can specify the excluded files
in the array @default_excluded_files. For example if you wanted
- to process all .tex files with the exception of common.tex,
- which is a not a standard alone LaTeX file but a file input by
+ to process all .tex files with the exception of common.tex,
+ which is a not a standard alone LaTeX file but a file input by
some or all of the others, you could do
+ @default_files = ("*.tex");
+ @default_excluded_files = ("common.tex");
+ If you have a variable or large number of files to be processed,
+ this method saves you from having to list them in detail in
+ @default_files and having to update the list every time you
+ change the set of files to be processed.
- 17 January 2018 31
+ Notes: 1. This variable has no effect except when no files are
+ specified on the latexmk command line. 2. Wildcards are allowed
+ in @default_excluded_files.
+ 25 May 2018 32
-LATEXMK(1) General Commands Manual LATEXMK(1)
- @default_files = ("*.tex");
- @default_excluded_files = ("common.tex");
- If you have a variable or large number of files to be processed,
- this method saves you from having to list them in detail in
- @default_files and having to update the list every time you
- change the set of files to be processed.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- Notes: 1. This variable has no effect except when no files are
- specified on the latexmk command line. 2. Wildcards are allowed
- in @default_excluded_files.
@default_files [("*.tex")]
Default list of files to be processed.
- If no filenames are specified on the command line, latexmk pro-
- cesses all tex files specified in the @default_files variable,
- which by default is set to all tex files ("*.tex") in the cur-
- rent directory. This is a convenience: just run latexmk and it
- will process an appropriate set of files. But sometimes you
+ If no filenames are specified on the command line, latexmk pro-
+ cesses all tex files specified in the @default_files variable,
+ which by default is set to all tex files ("*.tex") in the cur-
+ rent directory. This is a convenience: just run latexmk and it
+ will process an appropriate set of files. But sometimes you
want only some of these files to be processed. In this case you
- can list the files to be processed by setting @default_files in
- an initialization file (e.g., the file "latexmkrc" in the cur-
- rent directory). Then if no files are specified on the command
- line then the files you specify by setting @default_files are
+ can list the files to be processed by setting @default_files in
+ an initialization file (e.g., the file "latexmkrc" in the cur-
+ rent directory). Then if no files are specified on the command
+ line then the files you specify by setting @default_files are
processed.
Three examples:
@@ -2086,316 +2139,320 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
@default_files = ("*.tex", "*.dtx");
- Note that more than file may be given, and that the default
- extension is ".tex". Wild cards are allowed. The parentheses
+ Note that more than file may be given, and that the default
+ extension is ".tex". Wild cards are allowed. The parentheses
are because @default_files is an array variable, i.e., a
sequence of filename specifications is possible.
- If you want latexmk to process all .tex files with a few excep-
+ If you want latexmk to process all .tex files with a few excep-
tions, see the @default_excluded_files array variable.
$dependents_phony [0]
- If a list of dependencies is output, this variable determines
- whether to include a phony target for each source file. If you
- use the dependents list in a Makefile, the dummy rules work
- around errors make gives if you remove header files without
+ If a list of dependencies is output, this variable determines
+ whether to include a phony target for each source file. If you
+ use the dependents list in a Makefile, the dummy rules work
+ around errors make gives if you remove header files without
updating the Makefile to match.
$dependents_list [0]
- Whether to display a list(s) of dependencies at the end of a
+ Whether to display a list(s) of dependencies at the end of a
run.
+ $deps_file ["-"]
+ Name of file to receive list(s) of dependencies at the end of a
+ run, to be used if $dependesnt_list is set. If the filename is
+ "-", then the dependency list is set to stdout (i.e., normally
+ the screen).
+ $do_cd [0]
+ Whether to change working directory to the directory specified
+ for the main source file before processing it. The default
+ 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.
- 17 January 2018 32
+ 25 May 2018 33
-LATEXMK(1) General Commands Manual LATEXMK(1)
- $deps_file ["-"]
- Name of file to receive list(s) of dependencies at the end of a
- run, to be used if $dependesnt_list is set. If the filename is
- "-", then the dependency list is set to stdout (i.e., normally
- the screen).
+LATEXMK(1) General Commands Manual LATEXMK(1)
- $do_cd [0]
- Whether to change working directory to the directory specified
- for the main source file before processing it. The default
- 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.
$dvi_filter [empty]
- The dvi file filter to be run on the newly produced dvi file
- before other processing. Equivalent to specifying the -dF
+ The dvi file filter to be run on the newly produced dvi file
+ before other processing. Equivalent to specifying the -dF
option.
$dvi_mode [See below for default]
- If nonzero, generate a dvi version of the document. Equivalent
+ If nonzero, generate a dvi version of the document. Equivalent
to the -dvi option.
- The variable $dvi_mode defaults to 0, but if no explicit
- requests are made for other types of file (postscript, pdf),
- then $dvi_mode will be set to 1. In addition, if a request for
- a file for which a .dvi file is a prerequisite, then $dvi_mode
+ The variable $dvi_mode defaults to 0, but if no explicit
+ requests are made for other types of file (postscript, pdf),
+ then $dvi_mode will be set to 1. In addition, if a request for
+ a file for which a .dvi file is a prerequisite, then $dvi_mode
will be set to 1.
$dvi_previewer ["start xdvi %O %S" under UNIX]
- The command to invoke a dvi-previewer. [Under MS-Windows the
- default is "start"; then latexmk arranges to use the MS-Windows
- start program, which will cause to be run whatever command the
+ The command to invoke a dvi-previewer. [Under MS-Windows the
+ default is "start"; then latexmk arranges to use the MS-Windows
+ start program, which will cause to be run whatever command the
system has associated with .dvi files.]
- Important note: Normally you will want to have a previewer run
+ Important note: Normally you will want to have a previewer run
detached, so that latexmk doesn't wait for the previewer to ter-
- minate before continuing its work. So normally you should pre-
- fix the command by "start ", which flags to latexmk that it
- should do the detaching of the previewer itself (by whatever
- method is appropriate to the operating system). But sometimes
+ minate before continuing its work. So normally you should pre-
+ fix the command by "start ", which flags to latexmk that it
+ should do the detaching of the previewer itself (by whatever
+ method is appropriate to the operating system). But sometimes
letting latexmk do the detaching is not appropriate (for a vari-
- ety of non-trivial reasons), so you should put the "start " bit
+ ety of non-trivial reasons), so you should put the "start " bit
in yourself, whenever it is needed.
$dvi_previewer_landscape ["start xdvi %O %S"]
The command to invoke a dvi-previewer in landscape mode. [Under
- MS-Windows the default is "start"; then latexmk arranges to use
- the MS-Windows start program, which will cause to be run what-
+ MS-Windows the default is "start"; then latexmk arranges to use
+ the MS-Windows start program, which will cause to be run what-
ever command the system 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
+ bitmapped fonts, which do not look good when viewed by acroread.
+ That script should be modified to give dvips the options "-P
+ pdf" to ensure that type 1 fonts are used in the pdf file.
- 17 January 2018 33
+ $dvipdf_silent_switch ["-q"]
+ Switch(es) for dvipdf program when silent mode is on.
+ N.B. The standard dvipdf program runs silently, so adding the
+ silent switch has no effect, but is actually innocuous. But if
+ 25 May 2018 34
-LATEXMK(1) General Commands Manual LATEXMK(1)
- $dvipdf = "dvipdfm %O -o %D %S";
- 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
- pdf" to ensure that type 1 fonts are used in the pdf file.
- $dvipdf_silent_switch ["-q"]
- Switch(es) for dvipdf program when silent mode is on.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- N.B. The standard dvipdf program runs silently, so adding the
- silent switch has no effect, but is actually innocuous. But if
- an alternative program is used, e.g., dvipdfmx, then the silent
- switch has an effect. The default setting is correct for
+
+ an alternative program is used, e.g., dvipdfmx, then the silent
+ switch has an effect. The default setting is correct for
dvipdfm and dvipdfmx.
$dvips ["dvips %O -o %D %S"]
- The program to used as a filter to convert a .dvi file to a .ps
- file. If pdf is going to be generated from pdf, then the value
- of the $dvips_pdf_switch variable -- see below -- will be
+ 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 variable -- 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
+ When the dvi previewer is set to be updated by running a com-
+ mand, this is the command that is run. See the information for
the variable $dvi_update_method for further information, and see
- information on the variable $pdf_update_method for an example
+ information on the variable $pdf_update_method for an example
for the analogous case of a pdf previewer.
$dvi_update_method [2 under UNIX, 1 under MS-Windows]
- How the dvi viewer updates its display when the dvi file has
- changed. The values here apply equally to the
+ How the dvi viewer updates its display when the dvi file has
+ changed. The values here apply equally to the
$pdf_update_method and to the $ps_update_method variables.
0 => update is automatic,
1=> manual update by user, which may only mean a mouse click
on the viewer's window or may mean a more serious action.
- 2 => Send the signal, whose number is in the variable
- $dvi_update_signal. The default value under UNIX is suitable
+ 2 => Send the signal, whose number is in the variable
+ $dvi_update_signal. The default value under UNIX is suitable
for xdvi.
- 3 => Viewer cannot do an update, because it locks the file.
+ 3 => Viewer cannot do an update, because it locks the file.
(As with acroread under MS-Windows.)
- 4 => run a command to do the update. The command is speci-
+ 4 => run a command to do the update. The command is speci-
fied by the variable $dvi_update_command.
+ See information on the variable $pdf_update_method for an exam-
+ ple of updating by command.
+ $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
+ appropriate for xdvi on a UNIX system.
- 17 January 2018 34
+ 25 May 2018 35
-LATEXMK(1) General Commands Manual LATEXMK(1)
- 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
- 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
- appropriate for xdvi on a UNIX system.
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
$failure_cmd [undefined]
See the documentation for $compiling_cmd.
$fdb_ext ["fdb_latexmk"]
- The extension of the file which latexmk generates to contain a
- database of information on source files. You will not normally
+ The extension of the file which latexmk generates to contain a
+ database of information on source files. You will not normally
need to change this.
- $filetime_causality_threshold [5]; $filetime_offset_report_threshold
+ $filetime_causality_threshold [5]; $filetime_offset_report_threshold
[30]. (Units of seconds.)
- These variables control how latexmk deals with the following
- issue, which can affect the use of files that are on a remote
- filesystem (network share) instead of being on a file system
- local to the computer running latexmk. Almost users will not
+ These variables control how latexmk deals with the following
+ issue, which can affect the use of files that are on a remote
+ filesystem (network share) instead of being on a file system
+ local to the computer running latexmk. Almost users will not
have to worry about these settings, and can ignore the following
explanation.
- In almost all situations, latexmk does not need to use the time
- stamps of the files it works with. However, there are a couple
- of situations when it needs to know whether a certain file was
+ In almost all situations, latexmk does not need to use the time
+ stamps of the files it works with. However, there are a couple
+ of situations when it needs to know whether a certain file was
created in the current run of a program (e.g., (pdf)latex) or is
- a leftover file from a previous run. It does this by comparing
- the modification time of the file with the system time just
+ a leftover file from a previous run. It does this by comparing
+ the modification time of the file with the system time just
before the program was started. If the modification time is ear-
- lier than when the program was started, the file is a leftover
- file, which latexmk treats as if it were not created. If the
- filetime is at least the program start time, then it can be
+ lier than when the program was started, the file is a leftover
+ file, which latexmk treats as if it were not created. If the
+ filetime is at least the program start time, then it can be
assumed that the file was created in the current run.
- Unfortunately, this test can fail if the file is on a remote
- system, since its system time is not necessarily synchronized
- with that of the local system; the timestamps on the remote
- files are set by the remote system, not the local system. Gen-
- erally, modern operating systems regularly synchronize their
- time with a server, so the non-synchronization is mostly small
+ Unfortunately, this test can fail if the file is on a remote
+ system, since its system time is not necessarily synchronized
+ with that of the local system; the timestamps on the remote
+ files are set by the remote system, not the local system. Gen-
+ erally, modern operating systems regularly synchronize their
+ time with a server, so the non-synchronization is mostly small
(a second or so, or a few seconds). But even a small difference
can mess up latexmk's test.
Latexmk measures the time difference between the time on the two
- systems and compensates for this. But the measurement (in a
+ systems and compensates for this. But the measurement (in a
system-independent way) is only accurate to a second or two. So
- latexmk allows for a threshold on the difference between file
- and system time before it concludes that a file is a leftover
+ latexmk allows for a threshold on the difference between file
+ and system time before it concludes that a file is a leftover
+ file from a previous run. The configuration variable $file-
+ time_causality_theshhold, which in units of seconds, specifies
+ this threshold. Luckily high precision is not needed. The pre-
+ vious run is normally the previous run in a human run-edit-run
+ cycle, and is at least many seconds back. A few seconds is
+ therefore appropriate for the threshold, $filetime_causal-
+ ity_theshhold; it should be non-negative always, and should be
+ bigger than 2 if a remote filesystem or network share is used.
+ If the difference in system times on the two systems is large,
- 17 January 2018 35
+ 25 May 2018 36
-LATEXMK(1) General Commands Manual LATEXMK(1)
+LATEXMK(1) General Commands Manual LATEXMK(1)
- file from a previous run. The configuration variable $file-
- time_causality_theshhold, which in units of seconds, specifies
- this threshold. Luckily high precision is not needed. The pre-
- vious run is normally the previous run in a human run-edit-run
- cycle, and is at least many seconds back. A few seconds is
- therefore appropriate for the threshold, $filetime_causal-
- ity_theshhold; it should be non-negative always, and should be
- bigger than 2 if a remote filesystem or network share is used.
- If the difference in system times on the two systems is large,
- it normally indicates that at least one of the systems is mis-
- configured. The variable $filetime_offset_report_threshold
- specifies the smallest size of the difference (or offset) in
- seconds between the times of the local and remote system beyond
- which the offset is reported. This is reported at the point in
- the latexmk's progress that it measures the offset. The report
+ it normally indicates that at least one of the systems is mis-
+ configured. The variable $filetime_offset_report_threshold
+ specifies the smallest size of the difference (or offset) in
+ seconds between the times of the local and remote system beyond
+ which the offset is reported. This is reported at the point in
+ the latexmk's progress that it measures the offset. The report
is made if silent mode is used and diagnostic mode is not on.
$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
+ a rerun. This includes a file generated by LaTeX, e.g., an aux
+ file, that is read in on subsequent runs. But after a run that
+ results in an error, a new run should occur until the user has
+ made a change in the files. But the user may have corrected an
error in a source .tex file during the run. So latexmk needs to
distinguish user-generated and automatically generated files; it
- determines the automatically generated files as those with
+ determines the automatically generated files as those with
extensions in the list in @generated_exts.)
- A convenient way to add an extra extension to the list, without
- losing the already defined ones is to use a push command in the
+ A convenient way to add an extra extension to the list, without
+ losing the already defined ones is to use a push command in the
line in an RC file. E.g.,
push @generated_exts, "end";
- adds the extension "end" to the list of predefined generated
- extensions. (This extension is used by the RevTeX package, for
+ adds the extension "end" to the list of predefined generated
+ extensions. (This extension is used by the RevTeX package, for
example.)
+ $go_mode [0]
+ If nonzero, process files regardless of timestamps, and is then
+ equivalent to the -g option.
+ %hash_calc_ignore_pattern
+ !!!This variable is for experts only!!!
- 17 January 2018 36
+ The general rule latexmk uses for determining when an extra run
+ of some program is needed is that one of the source files has
+ 25 May 2018 37
-LATEXMK(1) General Commands Manual LATEXMK(1)
- $go_mode [0]
- 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!!!
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
- The general rule latexmk uses for determining when an extra run
- of some program is needed is that one of the source files has
- changed. But consider for example a latex package that causes
- an encapsulated postscript file (an "eps" file) to be made that
- is to be read in on the next run. The file contains a comment
- line giving its creation date and time. On the next run the
- time changes, latex sees that the eps file has changed, and
- therefore reruns latex. This causes an infinite loop, that is
- only terminated because latexmk has a limit on the number of
+ changed. But consider for example a latex package that causes
+ an encapsulated postscript file (an "eps" file) to be made that
+ is to be read in on the next run. The file contains a comment
+ line giving its creation date and time. On the next run the
+ time changes, latex sees that the eps file has changed, and
+ therefore reruns latex. This causes an infinite loop, that is
+ only terminated because 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.
@@ -2404,123 +2461,123 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
$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.
- There is only one regular expression available for each exten-
- sion. If you need more one pattern to specify lines to ignore,
- then you need to combine the patterns into a single regular
- expression. The simplest method is separate the different sim-
- ple patterns by a vertical bar character (indicating "alterna-
+ There is only one regular expression available for each exten-
+ sion. If you need more one pattern to specify lines to ignore,
+ then you need to combine the patterns into a single regular
+ expression. The simplest method is separate the different sim-
+ ple patterns by a vertical bar character (indicating "alterna-
tion" in the jargon of regular expressions). For example,
- $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate:
+ $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate:
|^%%Title: ';
- causes lines starting with either "^%%CreationDate: " or
+ causes lines starting with either "^%%CreationDate: " or
"^%%Title: " to be ignored.
- It may happen that a pattern to be ignored is specified in, for
- example, in a system or user initialization file, and you wish
- to remove this in a file that is read later. To do this, you
+ It may happen that a pattern to be ignored is specified in, for
+ example, in a system or user initialization file, and you wish
+ to remove this in a file that is read later. To do this, you
use Perl's delete function, e.g.,
delete $hash_calc_ignore_pattern{'eps'};
+ $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 a .bib or a .bst file is found from the log file of
+ a bibtex or biber run, only the base name of the file is known,
+ but not its path. The program specified by $kpsewhich is used to
+ find it.
- 17 January 2018 37
+ 25 May 2018 38
-LATEXMK(1) General Commands Manual LATEXMK(1)
+LATEXMK(1) General Commands Manual LATEXMK(1)
- $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 a .bib or a .bst file is found from the log file of
- a bibtex or biber run, only the base name of the file is known,
- but not its path. The program specified by $kpsewhich is used to
- find it.
- (For advanced users: Because of the different way in which
- latexmk uses the command specified in $kpsewhich, some of the
- possibilities listed in the FORMAT OF COMMAND SPECIFICATIONS do
+ (For advanced users: Because of the different way in which
+ latexmk uses the command specified in $kpsewhich, some of the
+ possibilities listed in the FORMAT OF COMMAND SPECIFICATIONS do
not apply. The internal and start keywords are not available. A
simple command specification with possible options and then "%S"
- is all that is guaranteed to work. Note that for other com-
+ is all that is guaranteed to work. Note that for other com-
mands, "%S" is substituted by a single source file. In contrast,
for $kpsewhich, "%S" may be substituted by a long list of space-
- separated filenames, each of which is quoted. The result on
+ separated filenames, each of which is quoted. The result on
STDOUT of running the command is then piped to latexmk.)
- 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.
$kpsewhich_show [0]
- Whether to show diagnostics about invocations of kpsewhich: the
- command line use to invoke it and the results. These diagnos-
- tics are shown if $kpsewhich_show is non-zero or if diagnostics
- mode is on. (But in the second case, lots of other diagnostics
- are also shown.) Without these diagnostics there is nothing
- visible in latexmk's screen output about invocations of kpse-
+ Whether to show diagnostics about invocations of kpsewhich: the
+ command line use to invoke it and the results. These diagnos-
+ tics are shown if $kpsewhich_show is non-zero or if diagnostics
+ mode is on. (But in the second case, lots of other diagnostics
+ are also shown.) Without these diagnostics there is nothing
+ visible in latexmk's screen output about invocations of kpse-
which.
$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
+ 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
- 17 January 2018 38
+ 25 May 2018 39
-LATEXMK(1) General Commands Manual LATEXMK(1)
+LATEXMK(1) General Commands Manual LATEXMK(1)
- make the missing file(s), but restricts it to the extensions
- specified by the variable %latex_input_extensions. The default
- extensions are 'tex' and 'eps'.
- (For Perl experts: %latex_input_extensions is a hash whose keys
- are the extensions. The values are irrelevant.) Two subrou-
- tines are provided for manipulating this and the related vari-
- able %pdflatex_input_extensions, add_input_ext and
- remove_input_ext. They are used as in the following examples
are possible lines in an initialization file:
remove_input_ext( 'latex', 'tex' );
@@ -2529,19 +2586,19 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
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-
@@ -2551,75 +2608,75 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
$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.
+ $lpr_dvi ["NONE lpr_dvi"]
+ The printing program to print dvi files.
+ $lpr_pdf ["NONE lpr_pdf"]
+ The printing program to print pdf files.
- 17 January 2018 39
+ Under MS-Windows you could set this to use gsview, if it is
+ installed, e.g.,
+ 25 May 2018 40
-LATEXMK(1) General Commands Manual LATEXMK(1)
- $lpr_dvi ["NONE lpr_dvi"]
- The printing program to print dvi files.
- $lpr_pdf ["NONE lpr_pdf"]
- The printing program to print pdf files.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- 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.
$lualatex ["lualatex %O %S"]
- The LaTeX processing program that is to be used when the luala-
+ The LaTeX processing program that is to be used when the luala-
tex program is called for (e.g., by the option -lualatex.
%lualatex_input_extensions
- This variable specifies the extensions tried by latexmk when it
- finds that a lualatex 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 lualatex run resulted in an error that a file has
+ not been found, and the file is given without an extension.
+ This typically happens when LaTeX commands of the form
\input{file} or \includegraphics{figure}, when the relevant
source file does not exist.
- In this situation, latexmk searches for custom dependencies to
- make the missing file(s), but restricts it to the extensions
- specified by the variable %pdflatex_input_extensions. The
+ In this situation, latexmk searches for custom dependencies to
+ make the missing file(s), but restricts it to the extensions
+ specified by the variable %pdflatex_input_extensions. The
default extensions are 'tex', 'pdf', 'jpg, and 'png'.
See details of the %latex_input_extensions for other information
that equally applies to %lualatex_input_extensions.
$lualatex_silent_switch ["-interaction=batchmode"]
- Switch(es) for the lualatex program (specified in the variable
+ Switch(es) for the lualatex program (specified in the variable
$lualatex) when silent mode is on.
- See details of the $latex_silent_switch for other information
+ See details of the $latex_silent_switch for other information
that equally applies to $lualatex_silent_switch.
$make ["make"]
@@ -2629,79 +2686,88 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
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
+ 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.)
- 17 January 2018 40
-
+ 25 May 2018 41
-LATEXMK(1) General Commands Manual LATEXMK(1)
- $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.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- (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 "\" on the command line. So for safety latexmk
- makes a translation, by default. It is conceivable that under
+ able as the directory separator character. But some programs
+ only accept "\" on the command line. 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 possible example might be when some of the soft-
- ware is implemented using Cygwin, which provides a Unix-like
+ ware is implemented using Cygwin, which provides a Unix-like
environment inside MS-Windows.)
$new_viewer_always [0]
- This variable applies to latexmk only in continuous-preview
+ This variable applies to latexmk only in continuous-preview
mode. If $new_viewer_always is 0, latexmk will check for a pre-
- viously running previewer on the same file, and if one is run-
- ning will not start a new one. If $new_viewer_always is non-
- zero, this check will be skipped, and latexmk will behave as if
+ 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 [""]
- If non-blank, this variable specifies the directory in which
+ If non-blank, this variable specifies 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 and later) implementations of
- TeX, i.e., MiKTeX and TeXLive. But it may not be present in
+ 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 and later) implementations of
+ TeX, i.e., MiKTeX and TeXLive. But it may not be present in
other versions.
- If you also use the -cd option, and $out_dir (or $aux_dir) con-
- tains a relative path, then the path is interpreted relative to
+ If you also use the -cd option, and $out_dir (or $aux_dir) con-
+ tains a relative path, then the path is interpreted relative to
the document directory.
- 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
+ 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
+ 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
+ path (e.g., "../output") that includes a higher-level directory,
+ and you need to use makeindex or bibtex, then you need to
- 17 January 2018 41
+ 25 May 2018 42
@@ -2710,41 +2776,31 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
LATEXMK(1) General Commands Manual LATEXMK(1)
- 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
- 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
- path (e.g., "../output") that includes a higher-level directory,
- and you need to use makeindex or bibtex, then you need to dis-
- able the security measures (and assume any risks). One way of
- doing this is to temporarily set an operating system environment
- variable openout_any to "a" (as in "all"), to override the
+ disable the security measures (and assume any risks). One way
+ of doing this is to temporarily set an operating system environ-
+ ment 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-
- tex, using the command specified by the $pdflatex variable. If
- equal to 2, generate a pdf version of the document from the ps
- file, by using the command specified by the $ps2pdf variable.
- If equal to 3, generate a pdf version of the document from the
- dvi file, by using the command specified by the $dvipdf vari-
- able. If equal to 4, generate a pdf version of the document
- using lualatex, using the command specified by the $lualatex
- variable. If equal to 5, generate a pdf version (and an xdv
+ 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, using the command specified by the $pdflatex variable. If
+ equal to 2, generate a pdf version of the document from the ps
+ file, by using the command specified by the $ps2pdf variable.
+ If equal to 3, generate a pdf version of the document from the
+ dvi file, by using the command specified by the $dvipdf vari-
+ able. If equal to 4, generate a pdf version of the document
+ using lualatex, using the command specified by the $lualatex
+ variable. If equal to 5, generate a pdf version (and an xdv
version) of the document using xelatex, using the commands spec-
ified by the $xelatex and xdvipdfmx variables.
- In $pdf_mode=2, it is ensured that dvi and ps files are also
- made. In $pdf_mode=3, it is ensured that a dvi file is also
+ In $pdf_mode=2, it is ensured that dvi and ps files are also
+ made. In $pdf_mode=3, it is ensured that a dvi file is also
made.
$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 use of this variable is to add certain options to the
@@ -2752,88 +2808,98 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
$pdflatex = "pdflatex --shell-escape %O %S";
- (In some earlier versions of latexmk, you needed to use an
- assignment to $pdflatex to allow the use of lualatex or xelatex
+ (In some earlier versions of latexmk, you needed to use an
+ assignment to $pdflatex to allow the use of lualatex or xelatex
instead of pdflatex. There are now separate configuration vari-
- ables for the use of lualatex or xelatex. See $lualatex and
+ ables for the use of lualatex or xelatex. See $lualatex and
$xelatex.)
%pdflatex_input_extensions
- This variable specifies the extensions tried by latexmk when it
- finds that a pdflatex run resulted in an error that a file has
- not been found, and the file is given without an extension.
- This typically happens when LaTeX commands of the form
+ This variable specifies the extensions tried by latexmk when it
+ finds that a pdflatex run resulted in an error that a file has
+ not been found, and the file is given without an extension.
+ This typically happens when LaTeX commands of the form
\input{file} or \includegraphics{figure}, when the relevant
+ source file does not exist.
+ In this situation, latexmk searches for custom dependencies to
+ make the missing file(s), but restricts it to the extensions
+ specified by the variable %pdflatex_input_extensions. The
+ default extensions are 'tex', 'pdf', 'jpg, and 'png'.
+ See details of the %latex_input_extensions for other information
+ that equally applies to %pdflatex_input_extensions.
- 17 January 2018 42
+ 25 May 2018 43
-LATEXMK(1) General Commands Manual LATEXMK(1)
- 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'.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- See details of the %latex_input_extensions for other information
- that equally applies to %pdflatex_input_extensions.
$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.
- See details of the $latex_silent_switch for other information
+ See details of the $latex_silent_switch for other information
that equally applies to $pdflatex_silent_switch.
$pdf_previewer ["start acroread %O %S"]
The command to invoke a pdf-previewer.
- On MS-Windows, the default is changed to "cmd /c start """;
+ 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 --
+ 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
+ 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
+ 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
+ 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
+ specified by $pdf_update_signal.)
+ Note that acroread under MS-Windows (but not UNIX) locks the pdf
+ file, so the default value is then 3.
- 17 January 2018 43
+ 25 May 2018 44
@@ -2842,18 +2908,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
LATEXMK(1) General Commands Manual LATEXMK(1)
- $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
- 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
- specified by $pdf_update_signal.)
-
- Note that acroread under MS-Windows (but not UNIX) locks the pdf
- file, so the default value is then 3.
-
Arranging to use a command to get a previewer explicitly updated
requires three variables to be set. For example:
@@ -2861,83 +2915,83 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
$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
+ 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, Linux, and OS-X
with their default settings of $pscmd.
- Setting the variable to -1 is used to indicate that $pscmd is
+ Setting 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.
+ 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
+ If some other request is made for which a postscript file is
needed, then $postscript_mode will be set to 1.
$preview_continuous_mode [0]
- If nonzero, run a previewer to view the document, and continue
+ If nonzero, run a previewer to view the document, and continue
running latexmk to keep .dvi up-to-date. Equivalent to the -pvc
- option. Which previewer is run depends on the other settings,
+ option. Which previewer is run depends on the other settings,
see the command line options -view=, and the variable $view.
+ $preview_mode [0]
+ If nonzero, run a previewer to preview the document. Equivalent
+ to the -pv option. Which previewer is run depends on the other
+ settings, see the command line options -view=, and the variable
+ $view.
+ $printout_mode [0]
+ If nonzero, print the document using the command specified in
+ the $lpr variable. Equivalent to the -p option. This is recom-
+ mended not to be set from an RC file, otherwise you could waste
+ lots of paper.
- 17 January 2018 44
+ 25 May 2018 45
-LATEXMK(1) General Commands Manual LATEXMK(1)
- $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
- $view.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- $printout_mode [0]
- If nonzero, print the document using the command specified in
- the $lpr variable. Equivalent to the -p option. This is recom-
- mended not to be set from an RC file, otherwise you could waste
- lots of paper.
$print_type = ["auto"]
- Type of file to printout: possibilities are "auto", "dvi",
+ 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
- $pscmd to determine if there is an already running previewer,
- and to find the process ID (needed if latexmk needs to signal
+ The -pvc option uses the command specified by the variable
+ $pscmd to determine if there is an already running previewer,
+ and to find the process ID (needed if latexmk needs to signal
the previewer about file changes).
Each line of the output of this command is assumed to correspond
- to one process. See the $pid_position variable for how the
+ to one process. See the $pid_position variable for how the
process number is determined.
- The default for pscmd is "NONE" under MS-Windows and cygwin
- (i.e., the command is not used), "ps -ww -u $ENV{USER}" under
- OS-X, and "ps -f -u $ENV{USER}" under other operating systems
+ The default for pscmd is "NONE" under MS-Windows and cygwin
+ (i.e., the command is not used), "ps -ww -u $ENV{USER}" under
+ OS-X, and "ps -f -u $ENV{USER}" under other operating systems
(including Linux). In these specifications "$ENV{USER}" is sub-
stituted by the username.
@@ -2946,76 +3000,75 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
$ps_filter [empty]
The postscript file filter to be run on the newly produced post-
- script file before other processing. Equivalent to specifying
+ script file before other processing. Equivalent to specifying
the -pF option.
$ps_previewer ["start gv %O %S", but start %O %S under MS-Windows]
- The command to invoke a ps-previewer. (The default under MS-
- Windows will cause to be run whatever command the system has
+ The command to invoke a ps-previewer. (The default under MS-
+ Windows will cause to be run whatever command the system has
associated with .ps files.)
- Note that gv could be used with the -watch option updates its
- display whenever the postscript file changes, whereas ghostview
- does not. However, different versions of gv have slightly dif-
- ferent ways of writing this option. You can configure this
+ Note that gv could be used with the -watch option updates its
+ display whenever the postscript file changes, whereas ghostview
+ does not. However, different versions of gv have slightly dif-
+ ferent ways of writing this option. You can configure this
variable appropriately.
WARNING: Linux systems may have installed one (or more) versions
- of gv under different names, e.g., ggv, kghostview, etc, but
+ of gv under different names, e.g., ggv, kghostview, etc, but
+ perhaps not one actually 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
+ 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
+ in yourself, whenever it is needed.
- 17 January 2018 45
+ 25 May 2018 46
-LATEXMK(1) General Commands Manual LATEXMK(1)
- perhaps not one actually 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
- 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
- in yourself, whenever it is needed.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- $ps_previewer_landscape ["start gv -swap %O %S", but start %O %S under
+ $ps_previewer_landscape ["start gv -swap %O %S", but start %O %S under
MS-Windows]
The command to invoke a ps-previewer in landscape mode.
$ps_update_command [""]
- When the postscript previewer is set to be updated by running a
- command, this is the command that is run. See the information
+ When the postscript previewer is set to be updated by running a
+ command, this is the command that is run. See the information
for the variable $ps_update_method.
$ps_update_method [0 under UNIX, 1 under MS-Windows]
- How the postscript viewer updates its display when the ps file
- has changed. See the information on the variable
- $dvi_update_method for the codes. (Note that information needs
+ How the postscript viewer updates its display when the ps file
+ has changed. See the information on the variable
+ $dvi_update_method for the codes. (Note that information needs
be changed slightly so that for the value 4, to run a command to
do the update, the command is specified by the variable
- $ps_update_command, and for the value 2, to specify update by
+ $ps_update_command, and for the value 2, to specify update by
signal, the signal is specified by $ps_update_signal.)
- $ps_update_signal [Under UNIX: SIGHUP, which is a system-dependent
+ $ps_update_signal [Under UNIX: SIGHUP, which is a system-dependent
value]
- The number of the signal that is sent to the pdf viewer when it
- is updated by sending a signal -- see $ps_update_method. The
+ The number of the signal that is sent to the pdf viewer when it
+ is updated by sending a signal -- see $ps_update_method. The
default value is the one appropriate for gv on a UNIX system.
$pvc_timeout [0]
- If this variable is nonzero, there will be a timeout in pvc
- mode after a period of inactivity. Inactivity means a period
- when latexmk has detected no file changes and hence has not
- taken any actions like compiling the document. The period of
+ If this variable is nonzero, there will be a timeout in pvc
+ mode after a period of inactivity. Inactivity means a period
+ when latexmk has detected no file changes and hence has not
+ taken any actions like compiling the document. The period of
inactivity is in the variable $pvc_timeout_mins.
@@ -3027,11 +3080,24 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
The same as $always_view_file_via_temporary, except that it only
applies in preview-continuous mode (-pvc option).
+ $quote_filenames [1]
+ This specifies whether substitutions for placeholders in command
+ specifications (as in $pdflatex) are surrounded by double
+ quotes. If this variable is 1 (or any other value Perl regards
+ as true), then quoting is done. Otherwise quoting is omitted.
+ The quoting method used by latexmk is tested to work correctly
+ under UNIX systems (including Linux and Mac OS-X) and under MS-
+ Windows. It allows the use of filenames containing special
+ characters, notably spaces. (But note that many versions of
+ latex and pdflatex cannot correctly deal with TeX files whose
+ names contain spaces. Latexmk's quoting only ensures that such
+ filenames are correctly treated by the operating system in pass-
+ ing arguments to programs.)
- 17 January 2018 46
+ 25 May 2018 47
@@ -3040,116 +3106,101 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
LATEXMK(1) General Commands Manual LATEXMK(1)
- $quote_filenames [1]
- This specifies whether substitutions for placeholders in command
- specifications (as in $pdflatex) are surrounded by double
- quotes. If this variable is 1 (or any other value Perl regards
- as true), then quoting is done. Otherwise quoting is omitted.
-
- The quoting method used by latexmk is tested to work correctly
- under UNIX systems (including Linux and Mac OS-X) and under MS-
- Windows. It allows the use of filenames containing special
- characters, notably spaces. (But note that many versions of
- latex and pdflatex cannot correctly deal with TeX files whose
- names contain spaces. Latexmk's quoting only ensures that such
- filenames are correctly treated by the operating system in pass-
- ing arguments to programs.)
-
$recorder [1]
- Whether to use the -recorder option to latex and pdflatex. Use
- of this option results in a file of extension .fls containing a
- list of the files that these programs have read and written.
- Latexmk will then use this file to improve its detection of
- source files and generated files after a run of latex or pdfla-
+ Whether to use the -recorder option to latex and pdflatex. Use
+ of this option results in a file of extension .fls containing a
+ list of the files that these programs have read and written.
+ Latexmk will then use this file to improve its detection of
+ source files and generated files after a run of latex or pdfla-
tex.
- It is generally recommended to use this option (or to configure
- the $recorder variable to be on.) But it only works if
+ It is generally recommended to use this option (or to configure
+ the $recorder variable to be on.) But it only works if
(pdf)latex supports the -recorder option, which is true for most
current implementations
- Note about the name of the .fls file: Most implementations of
- (pdf)latex produce an .fls file with the same basename as the
- main document's LaTeX, e.g., for Document.tex, the .fls file is
- Document.fls. However, some implementations instead produce
- files named for the program, i.e., latex.fls or pdflatex.fls.
- In this second case, latexmk copies the latex.fls or pdfla-
- tex.fls to a file with the basename of the main LaTeX document,
+ Note about the name of the .fls file: Most implementations of
+ (pdf)latex produce an .fls file with the same basename as the
+ main document's LaTeX, e.g., for Document.tex, the .fls file is
+ Document.fls. However, some implementations instead produce
+ files named for the program, i.e., latex.fls or pdflatex.fls.
+ In this second case, latexmk copies the latex.fls or pdfla-
+ tex.fls to a file with the basename of the main LaTeX document,
e.g., Document.fls.
$search_path_separator [See below for default]
The character separating paths in the environment variables TEX-
- INPUTS, BIBINPUTS, and BSTINPUTS. This variable is mainly used
- by latexmk when the -outdir, -output-directory, -auxdir, and/or
- -aux-directory options are used. In that case latexmk needs to
+ INPUTS, BIBINPUTS, and BSTINPUTS. This variable is mainly used
+ by latexmk when the -outdir, -output-directory, -auxdir, and/or
+ -aux-directory options are used. In that case latexmk needs to
communicate appropriately modified search paths to bibtex,
dvipdf, dvips, and (pdf)latex.
- [Comment to technically savvy readers: (pdf)latex doesn't actu-
- ally need the modified search path. But, surprisingly, dvipdf
- and dvips do, because sometimes graphics files get generated in
+ [Comment to technically savvy readers: (pdf)latex doesn't actu-
+ ally need the modified search path. But, surprisingly, dvipdf
+ and dvips do, because sometimes graphics files get generated in
the output or aux directories.]
- The default under MSWin and Cygwin is ';' and under UNIX-like
- operating systems (including Linux and OS-X) is ':'. Normally
- the defaults give correct behavior. But there can be difficul-
- ties if your operating system is of one kind, but some of your
+ The default under MSWin and Cygwin is ';' and under UNIX-like
+ operating systems (including Linux and OS-X) is ':'. Normally
+ the defaults give correct behavior. But there can be difficul-
+ ties if your operating system is of one kind, but some of your
+ software is running under an emulator for the other kind of
+ operating system; in that case you'll need to find out what is
+ needed, and set $search_path_separator explicitly. (The same
+ goes, of course, for unusual operating systems that are not in
+ the MSWin, Linux, OS-X, Unix collection.)
+ $show_time [0]
+ Whether to show CPU time used.
+ $silence_logfile_warnings [0]
+ Whether after a run of (pdf)latex to summarize warnings in the
+ log file about undefined citations and references. Setting
+ $silence_logfile_warnings=0 gives the summary of warnings (pro-
+ vided silent mode isn't also set), and this is useful to locate
+ undefined citations and references without searching through the
- 17 January 2018 47
+ 25 May 2018 48
-LATEXMK(1) General Commands Manual LATEXMK(1)
- software is running under an emulator for the other kind of
- operating system; in that case you'll need to find out what is
- needed, and set $search_path_separator explicitly. (The same
- goes, of course, for unusual operating systems that are not in
- the MSWin, Linux, OS-X, Unix collection.)
+LATEXMK(1) General Commands Manual LATEXMK(1)
- $show_time [0]
- Whether to show CPU time used.
- $silence_logfile_warnings [0]
- Whether after a run of (pdf)latex to summarize warnings in the
- log file about undefined citations and references. Setting
- $silence_logfile_warnings=0 gives the summary of warnings (pro-
- vided silent mode isn't also set), and this is useful to locate
- undefined citations and references without searching through the
- much more verbose log file or the screen output of (pdf)latex.
- But the summary can also be excessively annoying. The default
- is not to give these warnings. The command line options
+ much more verbose log file or the screen output of (pdf)latex.
+ But the summary can also be excessively annoying. The default
+ is not to give these warnings. The command line options
-silence_logfile_warning_list and -silence_logfile_warning_list-
also set this variable.
- Note that multiple occurrences for the same undefined object on
+ Note that multiple occurrences for the same undefined object on
the same page and same line will be compressed to a single warn-
ing.
$silent [0]
- Whether to run silently. Setting $silent to 1 has the same
+ Whether to run silently. Setting $silent to 1 has the same
effect as the -quiet of -silent options on the command line.
$sleep_time [2]
- The time to sleep (in seconds) between checking for source file
+ The time to sleep (in seconds) between checking for source file
changes when running with the -pvc option. This is subject to a
- minimum of one second delay, except that zero delay is also
+ minimum of one second delay, except that zero delay is also
allowed.
- A value of exactly 0 gives no delay, and typically results in
+ A value of exactly 0 gives no delay, and typically results in
100% CPU usage, which may not be desirable.
$texfile_search [""]
- This is an obsolete variable, replaced by the @default_files
+ This is an obsolete variable, replaced by the @default_files
variable.
- For backward compatibility, if you choose to set $tex-
- file_search, it is a string of space-separated filenames, and
+ 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-
file_search to which is added "*.tex".
@@ -3157,102 +3208,144 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
See the documentation for $compiling_cmd.
$tmpdir [See below for default]
- Directory to store temporary files that latexmk may generate
+ Directory to store temporary files that latexmk may generate
while running.
+ 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
+ current directory. Under other operating systems (expected to
+ be UNIX/Linux, including OS-X), the default is the value of the
+ system environment variable TMPDIR if it exists, otherwise
+ "/tmp".
+ $use_make_for_missing_files [0]
+ Whether to use make to try and make files that are missing after
+ a run of latex or pdflatex, and for which a custom dependency
+ has not been found. This is generally useful only when latexmk
+ is used as part of a bigger project which is built by using the
+ make program.
- 17 January 2018 48
+ 25 May 2018 49
-LATEXMK(1) General Commands Manual LATEXMK(1)
- 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
- current directory. Under other operating systems (expected to
- be UNIX/Linux, including OS-X), the default is the value of the
- system environment variable TMPDIR if it exists, otherwise
- "/tmp".
+LATEXMK(1) General Commands Manual LATEXMK(1)
- $use_make_for_missing_files [0]
- Whether to use make to try and make files that are missing after
- a run of latex or pdflatex, and for which a custom dependency
- has not been found. This is generally useful only when latexmk
- is used as part of a bigger project which is built by using the
- make program.
Note that once a missing file has been made, no further calls to
- make will be made on a subsequent run of latexmk to update the
- file. Handling this problem is the job of a suitably defined
- Makefile. See the section "USING latexmk WITH make" for how to
- do this. The intent of calling make from latexmk is merely to
+ make will be made on a subsequent run of latexmk to update the
+ file. Handling this problem is the job of a suitably defined
+ Makefile. See the section "USING latexmk WITH make" for how to
+ do this. The intent of calling make from latexmk is merely to
detect dependencies.
$view ["default"]
- Which kind of file is to be previewed if a previewer is used.
- The possible values are "default", "dvi", "ps", "pdf". The
+ Which kind of file is to be previewed if a previewer is used.
+ The possible values are "default", "dvi", "ps", "pdf". The
value of "default" means that the "highest" of the kinds of file
generated is to be used (among dvi, ps and pdf).
+
+ $warnings_as_errors [0]
+ Normally latexmk copies the behavior of latex in treating unde-
+ fined references and citations and multiply defined references
+ as conditions that give a warning but not an error. The vari-
+ able $warnings_as_errors controls whether this behavior is modi-
+ fied.
+
+ When the variable is non-zero, latexmk at the end of its run
+ will return a non-zero status code to the operating system if
+ any of the files processed gives a warning about problems with
+ citations or references (i.e., undefined citations or references
+ or multiply defined references). This is after latexmk has com-
+ pleted all the runs it needs to try and resolve references and
+ citations. Thus $warnings_as_errors being nonzero causes
+ latexmk to treat such warnings as errors, but only when they
+ occur on the last run of (pdf)latex and only after processing is
+ complete. A non-zero value $warnings_as_errors can be set by
+ the command-line option -Werror.
+
+ The default behavior is normally satisfactory in the usual edit-
+ compile-edit cycle. But, for example, latexmk can also be used
+ as part of a build process for some bigger project, e.g., for
+ creating documentation in the build of a software application.
+ Then it is often sensible to treat citation and reference warn-
+ ings as errors that require the overall build process to be
+ aborted. Of course, since multiple runs of (pdf)latex are gen-
+ erally needed to resolve references and citations, what matters
+ is not the warnings on the first run, but the warnings on the
+ last run; latexmk takes this into account appropriately.
+
+ In addition, when preview-continuous mode is used, a non-zero
+ value for $warnings_as_errors changes the use of the commands
+ $failure_cmd, $warning_cmd, and $success_cmd after a complia-
+ tion. If there are citation or reference warnings, but no other
+ errors, the behavior is as follows. If $warning_cmd is set, it
+ is used. If it is not set, then then if $warnings_as_errors is
+ non-zero and $failure_cmd is set, then $failure_cmd. Otherwise
+ $success_cmd is used, if it is set. (The foregoing explanation
+ is rather complicated, because latexmk has to deal with the case
+ that one or more of the commands isn't set.)
+
+
+
+ 25 May 2018 50
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
$xdvipdfmx ["xdvipdfmx -o %D %O %S"]
- The program to make a pdf file from an xdv file (used in con-
+ The program to make a pdf file from an xdv file (used in con-
junction with xelatex when $pdf_mode=5).
$xdvipdfmx_silent_switch ["-q"]
Switch(es) for the xdvipdfmx program when silent mode is on.
$xelatex ["xelatex %O %S"]
- The LaTeX processing program of in a version that makes a pdf
- file instead of a dvi file, when the xelatex program is called
+ The LaTeX processing program of in a version that makes a pdf
+ file instead of a dvi file, when the xelatex program is called
for. See the documentation of the -xelatex option for some spe-
cial properties of latexmk's use of xelatex.
%xelatex_input_extensions
- This variable specifies the extensions tried by latexmk when it
- finds that an xelatex 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 an xelatex 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 %xelatex_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 %xelatex_input_extensions. The
default extensions are 'tex', 'pdf', 'jpg, and 'png'.
-
-
- 17 January 2018 49
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
See details of the %latex_input_extensions for other information
that equally applies to %xelatex_input_extensions.
$xelatex_silent_switch ["-interaction=batchmode"]
- Switch(es) for the xelatex program (specified in the variable
+ Switch(es) for the xelatex program (specified in the variable
$xelatex) when silent mode is on.
- See details of the $latex_silent_switch for other information
+ See details of the $latex_silent_switch for other information
that equally applies to $xelatex_silent_switch.
CUSTOM DEPENDENCIES
- In any RC file a set of custom dependencies can be set up to convert a
+ 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
would be to allow latexmk to convert a .fig file to .eps to be included
in the .tex file.
@@ -3260,11 +3353,23 @@ CUSTOM DEPENDENCIES
Defining a custom dependency:
The old method of configuring latexmk to use a custom dependency was to
- directly manipulate the @cus_dep_list array that contains information
- defining the custom dependencies. (See the section "Old Method of
- Defining Custom Dependencies" for details.) This method still works,
+ directly manipulate the @cus_dep_list array that contains information
+ defining the custom dependencies. (See the section "Old Method of
+ Defining Custom Dependencies" for details.) This method still works,
but is no longer preferred.
+
+
+
+ 25 May 2018 51
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
A better method is to use the subroutines that allow convenient manipu-
lations of the custom dependency list. These are
@@ -3275,78 +3380,78 @@ CUSTOM DEPENDENCIES
The arguments are as follows:
from extension:
- The extension of the file we are converting from (e.g. "fig").
+ The extension of the file we are converting from (e.g. "fig").
It is specified without a period.
to extension:
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
+ 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 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
+ 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.
+ Naturally add_cus_dep adds a custom dependency with the specified from
+ and to extensions. If a custom dependency has been previously defined
+ (e.g., in an rcfile that was read earlier), then it is replaced by the
+ new one.
- 17 January 2018 50
+ The subroutine remove_cus_dep removes the specified custom dependency.
+ The subroutine show_cus_dep causes a list of the currently defined cus-
+ tom dependencies to be sent to the screen output.
+ How custom dependencies are used:
+ A custom dependency rule is invoked whenever latexmk detects that a run
+ of latex/pdflatex needs to read a file, like a graphics file, whose
+ extension is the to-extension of a custom dependency. Then latexmk
+ examines whether a file exists with the same name, but with the corre-
+ sponding from-extension, as specified in the custom-dependency rule.
+ If it does, then the rule is invoked whenever the destination file (the
+ one with the to-extension) is out-of-date with respect to the corre-
+ sponding source file.
+ To make the new destination file, the Perl subroutine specified in the
+ rule is invoked, with an argument that is the base name of the files in
+ question. Simple cases just involve a subroutine invoking an external
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ 25 May 2018 52
- function should return 0 if it was successful and a nonzero num-
- ber if it failed.
- Naturally add_cus_dep adds a custom dependency with the specified from
- and to extensions. If a custom dependency has been previously defined
- (e.g., in an rcfile that was read earlier), then it is replaced by the
- new one.
- The subroutine remove_cus_dep removes the specified custom dependency.
- The subroutine show_cus_dep causes a list of the currently defined cus-
- tom dependencies to be sent to the screen output.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- How custom dependencies are used:
- A custom dependency rule is invoked whenever latexmk detects that a run
- of latex/pdflatex needs to read a file, like a graphics file, whose
- extension is the to-extension of a custom dependency. Then latexmk
- examines whether a file exists with the same name, but with the corre-
- sponding from-extension, as specified in the custom-dependency rule.
- If it does, then the rule is invoked whenever the destination file (the
- one with the to-extension) is out-of-date with respect to the corre-
- sponding source file.
- To make the new destination file, the Perl subroutine specified in the
- rule is invoked, with an argument that is the base name of the files in
- question. Simple cases just involve a subroutine invoking an external
- program; this can be done by following the templates below, even by
- those without knowledge of the Perl programming language. Of course,
+ program; this can be done by following the templates below, even by
+ those without knowledge of the Perl programming language. Of course,
experts could do something much more elaborate.
- One other item in the specification of each custom-dependency rule,
+ One other item in the specification of each custom-dependency rule,
labeled "must" above, specifies how the rule should be applied when the
source file fails to exist.
Function to implement custom dependency, traditional method:
- The function that implements a custom dependency gets the information
+ The function that implements a custom dependency gets the information
on the files to be processed in two ways. The first is through its one
- argument; the argument contains the base name of the source and desti-
+ argument; the argument contains the base name of the source and desti-
nation files. The second way is described later.
- A simple and typical example of code in an initialization rcfile using
+ A simple and typical example of code in an initialization rcfile using
the first method is:
add_cus_dep( 'fig', 'eps', 0, 'fig2eps' );
@@ -3354,102 +3459,92 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
system( "fig2dev -Leps \"$_[0].fig\" \"$_[0].eps\"" );
}
- The first line adds a custom dependency that converts a file with
- extension "fig", as created by the xfig program, to an encapsulated
- postscript file, with extension "eps". The remaining lines define a
- subroutine that carries out the conversion. If a rule for converting
-
-
-
- 17 January 2018 51
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
- "fig" to "eps" files already exists (e.g., from a previously read-in
- initialization file), the latexmk will delete this rule before making
+ The first line adds a custom dependency that converts a file with
+ extension "fig", as created by the xfig program, to an encapsulated
+ postscript file, with extension "eps". The remaining lines define a
+ subroutine that carries out the conversion. If a rule for converting
+ "fig" to "eps" files already exists (e.g., from a previously read-in
+ initialization file), the latexmk will delete this rule before making
the new one.
- Suppose latexmk is using this rule to convert a file "figure.fig" to
- "figure.eps". Then it will invoke the fig2eps subroutine defined in
- the above code with a single argument "figure", which is the basename
- of each of the files (possibly with a path component). This argument
- is referred to by Perl as $_[0]. In the example above, the subroutine
+ Suppose latexmk is using this rule to convert a file "figure.fig" to
+ "figure.eps". Then it will invoke the fig2eps subroutine defined in
+ the above code with a single argument "figure", which is the basename
+ of each of the files (possibly with a path component). This argument
+ is referred to by Perl as $_[0]. In the example above, the subroutine
uses the Perl command system to invoke the program fig2dev. The double
quotes around the string are a Perl idiom that signify that each string
- of the form of a variable name, $_[0] in this case, is to be substi-
+ of the form of a variable name, $_[0] in this case, is to be substi-
tuted by its value.
- If the return value of the subroutine is non-zero, then latexmk will
- assume an error occurred during the execution of the subroutine. In
- the above example, no explicit return value is given, and instead the
- return value is the value returned by the last (and only) statement,
+ If the return value of the subroutine is non-zero, then latexmk will
+ assume an error occurred during the execution of the subroutine. In
+ the above example, no explicit return value is given, and instead the
+ return value is the value returned by the last (and only) statement,
i.e., the invocation of system, which returns the value 0 on success.
- If you use pdflatex instead of latex, then you will probably prefer to
- convert your graphics files to pdf format, in which case you would
+ If you use pdflatex instead of latex, then you will probably prefer to
+ convert your graphics files to pdf format, in which case you would
replace the above code in an initialization file by
add_cus_dep( 'fig', 'pdf, 0, 'fig2pdf' );
sub fig2pdf {
system( "fig2dev -Lpdf \"$_[0].fig\" \"$_[0].pdf\"" );
- }
- 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
- normally safer to keep them in. Even though the rules for quoting vary
- between operating systems, command shells and individual pieces of
- software, the quotes in the above examples do not cause problems in the
- cases I have tested.
- Note 2: One case in which the quotes are important is when the files
- are in a subdirectory and your operating system is Microsoft Windows.
- Then the separator character for directory components can be either a
- forward slash '/' or Microsoft's more usual backward slash '\'. For-
- ward slashes are generated by latexmk, to maintain its sanity from
- software like MiKTeX that mixes both directory separators; but their
- correct use normally requires quoted filenames. (See a log file from a
- run of MiKTeX (at least in v. 2.9) for an example of the use of both
- directory separators.)
- Note 3: The subroutines implementing custom dependencies in the exam-
- ples given just have a single line invoking an external program.
- That's the usual situation. But since the subroutines are in the Perl
- language, you can implement much more complicated processing if you
- need it.
+ 25 May 2018 53
+
- 17 January 2018 52
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ }
+ 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
+ normally safer to keep them in. Even though the rules for quoting vary
+ between operating systems, command shells and individual pieces of
+ software, the quotes in the above examples do not cause problems in the
+ cases I have tested.
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ Note 2: One case in which the quotes are important is when the files
+ are in a subdirectory and your operating system is Microsoft Windows.
+ Then the separator character for directory components can be either a
+ forward slash '/' or Microsoft's more usual backward slash '\'. For-
+ ward slashes are generated by latexmk, to maintain its sanity from
+ software like MiKTeX that mixes both directory separators; but their
+ correct use normally requires quoted filenames. (See a log file from a
+ run of MiKTeX (at least in v. 2.9) for an example of the use of both
+ directory separators.)
+
+ Note 3: The subroutines implementing custom dependencies in the exam-
+ ples given just have a single line invoking an external program.
+ That's the usual situation. But since the subroutines are in the Perl
+ language, you can implement much more complicated processing if you
+ need it.
Removing custom dependencies, and when you might need to do this:
- If you have some general custom dependencies defined in the system or
- user initialization file, you may find that for a particular project
- they are undesirable. So you might want to delete the unneeded ones.
- A situation where this would be desirable is where there are multiple
- custom dependencies with the same from-extension or the same to-exten-
- sion. In that case, latexmk might choose a different one from the one
+ If you have some general custom dependencies defined in the system or
+ user initialization file, you may find that for a particular project
+ they are undesirable. So you might want to delete the unneeded ones.
+ A situation where this would be desirable is where there are multiple
+ custom dependencies with the same from-extension or the same to-exten-
+ sion. In that case, latexmk might choose a different one from the one
you want for a specific project. As an example, to remove any "fig" to
"eps" rule you would use:
remove_cus_dep( 'fig', 'eps' );
- If you have complicated sets of custom dependencies, you may want to
- get a listing of the custom dependencies. This is done by using the
+ If you have complicated sets of custom dependencies, you may want to
+ get a listing of the custom dependencies. This is done by using the
line
show_cus_dep();
@@ -3460,29 +3555,41 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
Function implementing custom dependency, alternative methods:
So far the examples for functions to implement custom dependencies have
used the argument of the function to specify the base name of converted
- file. This method has been available since very old versions of
+ file. This method has been available since very old versions of
+
+
+
+ 25 May 2018 54
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
latexmk, and many examples can be found, e.g., on the web.
- However in later versions of latexmk the internal structure of the
- implementation of its "rules" for the steps of processing, including
- custom dependencies, became much more powerful. The function imple-
- menting a custom dependency is executed within a special context where
+ However in later versions of latexmk the internal structure of the
+ implementation of its "rules" for the steps of processing, including
+ custom dependencies, became much more powerful. The function imple-
+ menting a custom dependency is executed within a special context where
a number of extra variables and subroutines are defined. Publicly doc-
- umented ones, intended to be long-term stable, are listed below, under
+ umented ones, intended to be long-term stable, are listed below, under
the heading "Variables and subroutines for processing a rule".
- Examples of their use is given in the following examples, concerning
+ Examples of their use is given in the following examples, concerning
multiple index files and glossaries.
- The only index-file conversion built-in to latexmk is from an ".idx"
- file written on one run of latex/pdflatex to an ".ind" file to be read
- in on a subsequent run. But with the index.sty package, for example,
- you can create extra indexes with extensions that you configure.
+ The only index-file conversion built-in to latexmk is from an ".idx"
+ file written on one run of latex/pdflatex to an ".ind" file to be read
+ in on a subsequent run. But with the index.sty package, for example,
+ you can create extra indexes with extensions that you configure.
Latexmk does not know how to deduce the extensions from the information
- it has. But you can easily write a custom dependency. For example if
- your latex file uses the command "\newindex{special}{ndx}{nnd}{Special
- index}" you will need to get latexmk to convert files with the exten-
- sion .ndx to .nnd. The most elementary method is to define a custom
+ it has. But you can easily write a custom dependency. For example if
+ your latex file uses the command "\newindex{special}{ndx}{nnd}{Special
+ index}" you will need to get latexmk to convert files with the exten-
+ sion .ndx to .nnd. The most elementary method is to define a custom
dependency as follows:
add_cus_dep( 'ndx', 'nnd', 0, 'ndx2nnd' );
@@ -3491,25 +3598,14 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
}
push @generated_exts, 'ndx', 'nnd';
-
-
- 17 January 2018 53
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
- Notice the added line compared with earlier examples. The extra line
+ Notice the added line compared with earlier examples. The extra line
gets the extensions "ndx" and "nnd" added to the list of extensions for
generated files; then the extra index files will be deleted by clean-up
operations
- But if you have yet more indexes with yet different extensions, e.g.,
- "adx" and "and", then you will need a separate function for each pair
- of extensions. This is quite annoying. You can use the Run_subst
+ But if you have yet more indexes with yet different extensions, e.g.,
+ "adx" and "and", then you will need a separate function for each pair
+ of extensions. This is quite annoying. You can use the Run_subst
function to simplify the definitions to use a single function:
add_cus_dep( 'ndx', 'nnd', 0, 'dx2nd' );
@@ -3526,50 +3622,51 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
sub dx2nd {
return Run_subst( $makeindex );
}
+
+
+
+ 25 May 2018 55
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
push @generated_exts, 'ndx', 'nnd', 'adx', 'and';
- This last example uses the command specification in $makeindex, and so
- any customization you have made for the standard index also applies to
+ This last example uses the command specification in $makeindex, and so
+ any customization you have made for the standard index also applies to
your extra indexes.
Similar techniques can be applied for glossaries.
Those of you with experience with Makefiles, may get concerned that the
.ndx file is written during a run of latex/pdflatex and is always later
- than the .nnd last read in. Thus the .nnd appears to be perpetually
- out-of-date. This situation, of circular dependencies, is endemic to
+ than the .nnd last read in. Thus the .nnd appears to be perpetually
+ out-of-date. This situation, of circular dependencies, is endemic to
latex, and is one of the issues that latexmk is programmed to overcome.
- It examines the contents of the files (by use of a checksum), and only
+ It examines the contents of the files (by use of a 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 the .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
+ Of course if you choose to write random data to the .nnd (or the .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.
Old Method of Defining Custom Dependencies:
- In much older versions of latexmk, the only method of defining custom
- dependencies was to directly manipulate the table of custom dependen-
+ In much older versions of latexmk, the only method of defining custom
+ dependencies was to directly manipulate the table of custom dependen-
cies. This is contained in the @cus_dep_list array. It is an array of
- strings, and each string in the array has four items in it, each sepa-
- rated by a space, the from-extension, the to-extension, the "must"
- item, and the name of the subroutine for the custom dependency. These
+ strings, and each string in the array has four items in it, each sepa-
+ rated by a space, the from-extension, the to-extension, the "must"
+ item, and the name of the subroutine for the custom dependency. These
were all defined above.
-
-
- 17 January 2018 54
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
An example of the old method of defining custom dependencies is as fol-
- lows. It is the code in an RC file to ensure automatic conversion of
+ lows. It is the code in an RC file to ensure automatic conversion of
.fig files to .eps files:
push @cus_dep_list, "fig eps 0 fig2eps";
@@ -3577,21 +3674,33 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
return system( "fig2dev -Lps \"$_[0].fig\" \"$_[0].eps\"" );
}
- This method still works, and is almost equivalent to the code given
- earlier that used the add_cus_dep subroutine. However, the old method
- doesn't delete any previous custom-dependency for the same conversion.
+ This method still works, and is almost equivalent to the code given
+ earlier that used the add_cus_dep subroutine. However, the old method
+ doesn't delete any previous custom-dependency for the same conversion.
So the new method is preferable.
ADVANCED CONFIGURATION: Some extra resources and advanced tricks
- For most purposes, simple configuration for latexmk along the lines of
- the examples given is sufficient. But sometimes you need something
- harder. In this section, I indicate some extra possibilities. Gener-
- ally to use these, you need to be fluent in the Perl language, since
+ For most purposes, simple configuration for latexmk along the lines of
+ the examples given is sufficient. But sometimes you need something
+ harder. In this section, I indicate some extra possibilities. Gener-
+ ally to use these, you need to be fluent in the Perl language, since
this is what is used in the rc files.
- See also the section DEALING WITH ERRORS, PROBLEMS, ETC. See also the
+
+
+
+ 25 May 2018 56
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
+ See also the section DEALING WITH ERRORS, PROBLEMS, ETC. See also the
examples in the directory example_rcfiles in the latexmk distributions.
Even if none of the examples apply to your case, they may give you use-
ful ideas
@@ -3599,138 +3708,136 @@ ADVANCED CONFIGURATION: Some extra resources and advanced tricks
Variables and subroutines for processing a rule
A step in the processing is called a rule. One possibility to implement
- the processing of a rule is by a Perl subroutine. This is always the
- case for custom dependencies. Also, for any other rule, you can use a
- subroutine by prefixing the command specification by the word "inter-
+ the processing of a rule is by a Perl subroutine. This is always the
+ case for custom dependencies. Also, for any other rule, you can use a
+ subroutine by prefixing the command specification by the word "inter-
nal" -- see the section FORMAT OF COMMAND SPECIFICATIONS.
- When you use a subroutine for processing a rule, all the possibilities
- of Perl programming are available, of course. In addition, some of
- latexmk's internal variables and subroutines are available. The ones
- listed below are intended to be available to (advanced) users, and
+ When you use a subroutine for processing a rule, all the possibilities
+ of Perl programming are available, of course. In addition, some of
+ latexmk's internal variables and subroutines are available. The ones
+ listed below are intended to be available to (advanced) users, and
their specifications will generally have stability under upgrades. Gen-
- erally, the variables should be treated as read-only: Changing their
- values can have bad consequences, since it is liable to mess up the
+ erally, the variables should be treated as read-only: Changing their
+ values can have bad consequences, since it is liable to mess up the
consistency of what latexmk is doing.
- $rule This variable has the name of the rule, as known to latexmk.
- Note that the exact contents of this variable for a given rule
+ $rule This variable has the name of the rule, as known to latexmk.
+ Note that the exact contents of this variable for a given rule
may be dependent on the version of latexmk
$$Psource
This gives the name of the primary source file. Note the double
dollar signs.
+ $$Pdest
+ This gives the name of the main output file if any. Note the
+ double dollar signs.
+ rdb_ensure_file( $rule, file )
+ This a subroutine that ensures that the given file is among the
+ source files for the specified rule. It is typically used when,
+ during the processing of a rule, it is known that a particular
+ extra file is among the dependencies that latexmk should know,
+ but its default methods don't find the dependency. Almost always
+ the first argument is the name of the rule currently being pro-
+ cessed, so it is then appropriate to specify it by $rule.
+ For examples of its use, see some of the files in the directory
+ example_rcfiles of latexmk's distribution. Currently the cases
+ that use this subroutine are bib2gls-latexmkrc, excel-
+ tex_latexmkrc and texinfo-latexmkrc. These illustrate typical
+ cases where latexmk's normal processing fails to detect certain
+ extra source files.
+ rdb_remove_files( $rule, file, ... )
+ This subroutine removes one or more files from the dependency
+ list for the given rule.
- 17 January 2018 55
+ 25 May 2018 57
-LATEXMK(1) General Commands Manual LATEXMK(1)
- $$Pdest
- This gives the name of the main output file if any. Note the
- double dollar signs.
- rdb_ensure_file( $rule, file )
- This a subroutine that ensures that the given file is among the
- source files for the specified rule. It is typically used when,
- during the processing of a rule, it is known that a particular
- extra file is among the dependencies that latexmk should know,
- but its default methods don't find the dependency. Almost always
- the first argument is the name of the rule currently being pro-
- cessed, so it is then appropriate to specify it by $rule.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- For examples of its use, see some of the files in the directory
- example_rcfiles of latexmk's distribution. Currently the cases
- that use this subroutine are bib2gls-latexmkrc, excel-
- tex_latexmkrc and texinfo-latexmkrc. These illustrate typical
- cases where latexmk's normal processing fails to detect certain
- extra source files.
-
- rdb_remove_files( $rule, file, ... )
- This subroutine removes one or more files from the dependency
- list for the given rule.
rdb_list_source( $rule )
- This subroutine returns the list of source files (i.e., the
+ This subroutine returns the list of source files (i.e., the
dependency list) for the given rule.
rdb_set_source( $rule, file, ... )
rdb_set_source( $rule, @files )
- This subroutine sets the dependency list for the given rule to
+ This subroutine sets the dependency list for the given rule to
be the specified files. Files that are already in the list have
- unchanged information. Files that were not in the list are
+ unchanged information. Files that were not in the list are
added to it. Files in the previous dependency list that are not
in the newly specified list of files are removed from the depen-
dency list.
Run_subst( command_spec )
This subroutine runs the command specified by command_spec. The
- specification is a string in the format listed in the section
- "Format of Command Specifications". An important action of the
+ specification is a string in the format listed in the section
+ "Format of Command Specifications". An important action of the
Run_subst is to make substitutions of placeholders, e.g., %S and
- %D for source and destination files; these get substituted
- before the command is run. In addition, the command after sub-
- stitution is printed to the screen unless latexmk is running in
+ %D for source and destination files; these get substituted
+ before the command is run. In addition, the command after sub-
+ stitution is printed to the screen unless latexmk is running in
silent mode.
Advanced configuration: Using latexmk with make
- This section is targeted only at advanced users who use the make pro-
+ This section is targeted only at advanced users who use the make pro-
gram for complex projects, as for software development, with the depen-
dencies specified by a Makefile.
+ Now the basic task of latexmk is to run the appropriate programs to
+ make a viewable version of a LaTeX document. However, the usual make
+ program is not suited to this purpose for at least two reasons. First
+ is that the use of LaTeX involves circular dependencies (e.g., via .aux
+ files), and these cannot be handled by the standard make program. Sec-
+ ond is that in a large document the set of source files can change
+ quite frequently, particularly with included graphics files; in this
+ situation keeping a Makefile manually updated is inappropriate and
+ error-prone, especially when the dependencies can be determined auto-
+ matically. Latexmk solves both of these problems robustly.
+ Thus for many standard LaTeX documents latexmk can be used by itself
+ without the make program. In a complex project it simply needs to be
+ suitably configured. A standard configuration would be to define cus-
+ tom dependencies to make graphics files from their source files (e.g.,
+ as created by the xfig program). Custom dependencies are latexmk's
+ equivalent of pattern rules in Makefiles.
-
- 17 January 2018 56
+ Nevertheless there are projects for which a Makefile is appropriate,
+ and it is useful to know how to use latexmk from a Makefile. A typical
+ example would be to generate documentation for a software project.
+ Potentially the interaction with the rest of the rules in the Makefile
+ could be quite complicated, for example if some of the source files for
+ a LaTeX document are generated by the project's software.
+ 25 May 2018 58
-LATEXMK(1) General Commands Manual LATEXMK(1)
- Now the basic task of latexmk is to run the appropriate programs to
- make a viewable version of a LaTeX document. However, the usual make
- program is not suited to this purpose for at least two reasons. First
- is that the use of LaTeX involves circular dependencies (e.g., via .aux
- files), and these cannot be handled by the standard make program. Sec-
- ond is that in a large document the set of source files can change
- quite frequently, particularly with included graphics files; in this
- situation keeping a Makefile manually updated is inappropriate and
- error-prone, especially when the dependencies can be determined auto-
- matically. Latexmk solves both of these problems robustly.
- Thus for many standard LaTeX documents latexmk can be used by itself
- without the make program. In a complex project it simply needs to be
- suitably configured. A standard configuration would be to define cus-
- tom dependencies to make graphics files from their source files (e.g.,
- as created by the xfig program). Custom dependencies are latexmk's
- equivalent of pattern rules in Makefiles.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- Nevertheless there are projects for which a Makefile is appropriate,
- and it is useful to know how to use latexmk from a Makefile. A typical
- example would be to generate documentation for a software project.
- Potentially the interaction with the rest of the rules in the Makefile
- could be quite complicated, for example if some of the source files for
- a LaTeX document are generated by the project's software.
In this section, I give a couple of examples of how latexmk can be use-
- fully invoked from a Makefile. The examples use specific features of
- current versions of GNU make, which is the default on both linux and
+ fully invoked from a Makefile. The examples use specific features of
+ current versions of GNU make, which is the default on both linux and
OS-X systems. They may need modifications for other versions of make.
- The simplest method is simply to delegate all the relevant tasks to
+ 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
@@ -3739,45 +3846,33 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
%.pdf : %.tex FORCE_MAKE
latexmk -pdf -dvi- -ps- $<
- (Note: the last line must be introduced by a tab for the Makefile to
- function correctly!) Naturally, if making try.pdf from its associated
- LaTeX file try.tex were the only task to be performed, a direct use of
- latexmk without a Makefile would normally be better. The benefit of
- using a Makefile for a LaTeX document would be in a larger project,
+ (Note: the last line must be introduced by a tab for the Makefile to
+ function correctly!) Naturally, if making try.pdf from its associated
+ LaTeX file try.tex were the only task to be performed, a direct use of
+ latexmk without a Makefile would normally be better. The benefit of
+ using a Makefile for a LaTeX document would be in a larger project,
where lines such as the above would be only be a small part of a larger
Makefile.
The above example has a pattern rule for making a .pdf file from a .tex
- file, and it is defined to use latexmk in the obvious way. There is a
+ file, and it is defined to use latexmk in the obvious way. There is a
conventional default target named "all", with a prerequisite of
- try.pdf. So when make is invoked, by default it makes try.pdf. The
- only complication is that there may be many source files beyond
+ try.pdf. So when make is invoked, by default it makes try.pdf. The
+ only complication is that there may be many source files beyond
try.tex, but these aren't specified in the Makefile, so changes in them
- will not by themselves cause latexmk to be invoked. Instead, the
-
-
-
- 17 January 2018 57
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
- pattern rule is equipped with a "phony" prerequisite FORCE_MAKE; this
- has the effect of causing the rule to be always out-of-date, so that
- latexmk is always run. It is latexmk that decides whether any action
- is needed, e.g., a rerun of pdflatex. Effectively the Makefile dele-
+ will not by themselves cause latexmk to be invoked. Instead, the pat-
+ tern rule is equipped with a "phony" prerequisite FORCE_MAKE; this has
+ the effect of causing the rule to be always out-of-date, so that
+ latexmk is always run. It is latexmk that decides whether any action
+ is needed, e.g., a rerun of pdflatex. Effectively the Makefile dele-
gates all decisions to latexmk, while make has no knowledge of the list
- of source files except for primary LaTeX file for the document. If
- there are, for example, graphics files to be made, these must be made
+ of source files except for primary LaTeX file for the document. If
+ there are, for example, graphics files to be made, these must be made
by custom dependencies configured in latexmk.
- But something better is needed in more complicated situations, for
- example, when the making of graphics files needs to be specified by
- rules in the Makefile. To do this, one can use a Makefile like the
+ But something better is needed in more complicated situations, for
+ example, when the making of graphics files needs to be specified by
+ rules in the Makefile. To do this, one can use a Makefile like the
following:
TARGETS = document1.pdf document2.pdf
@@ -3791,54 +3886,54 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
$(DEPS_DIR) :
mkdir $@
%.pdf : %.tex
+
+
+
+ 25 May 2018 59
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
if [ ! -e $(DEPS_DIR) ]; then mkdir $(DEPS_DIR); fi
$(LATEXMK) -pdf -dvi- -ps- -deps-out=$(DEPS_DIR)/$@P $<
%.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
+ 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
+ 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
+ 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
-
-
-
- 17 January 2018 58
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
- 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.
@@ -3847,49 +3942,20 @@ 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-
- 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
- their standard form to avoid being harvested too easily.)
-
-AUTHOR
- Current version, by John Collins (username jcc8 at node psu.edu).
- (Version 4.55).
-
- Released version can be obtained from CTAN:
- <http://www.ctan.org/pkg/latexmk/>, and from the author's website
- <http://www.personal.psu.edu/jcc8/latexmk/>.
- Modifications and enhancements by Evan McLean (Version 2.0)
- Original script called "go" by David J. Musliner (RCS Version 3.2)
-
-
-
-
+ (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
-
-
-
- 17 January 2018 59
+ 25 May 2018 60
@@ -3898,9 +3964,28 @@ AUTHOR
LATEXMK(1) General Commands Manual LATEXMK(1)
+ 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
+ their standard form to avoid being harvested too easily.)
+AUTHOR
+ Current version, by John Collins (username jcc8 at node psu.edu).
+ (Version 4.56).
+ Released version can be obtained from CTAN:
+ <http://www.ctan.org/pkg/latexmk/>, and from the author's website
+ <http://www.personal.psu.edu/jcc8/latexmk/>.
+ Modifications and enhancements by Evan McLean (Version 2.0)
+ Original script called "go" by David J. Musliner (RCS Version 3.2)
@@ -3936,25 +4021,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 17 January 2018 60
+ 25 May 2018 61
diff --git a/Master/texmf-dist/scripts/latexmk/latexmk.pl b/Master/texmf-dist/scripts/latexmk/latexmk.pl
index d83a2440ce8..4f7aa737664 100755
--- a/Master/texmf-dist/scripts/latexmk/latexmk.pl
+++ b/Master/texmf-dist/scripts/latexmk/latexmk.pl
@@ -121,8 +121,8 @@ use warnings;
$my_name = 'latexmk';
$My_name = 'Latexmk';
-$version_num = '4.55';
-$version_details = "$My_name, John Collins, 17 Jan. 2018";
+$version_num = '4.56';
+$version_details = "$My_name, John Collins, 25 May 2018";
use Config;
use File::Basename;
@@ -221,7 +221,38 @@ else {
##
## 12 Jan 2012 STILL NEED TO DOCUMENT some items below
##
+## 24,25 May 2018 John Collins Fix problem of .bib files not found with msys.
+## Add use of environment variable LATEXMKRCSYS
+## 12 May 2018 John Collins Simplify code in run_bibtex.
+## 3,9 May 2018 John Collins Improved diagnostics on mismatch of output filenames
+## 28,30 Apr 2018 John Collins Improve error messages for bib files not found
+## 26 Apr 2018 John Collins In testing for different expected and actual
+## output of primary run, normalize $$Pdest, to
+## avoid spurious warnings.
+## 4 Apr 2018 John Collins Version 4.56.
+## Get TeX disribution in .log file
+## Start on dealing with aux_dir and out_dir
+## that didn't get used as intended.
+## And on fls_file that didn't get made when expected.
+## Need to finish:
+## 15 Mar 2018 John Collins Version 4.55d.
+## In test for non-existent file in fls, don't give
+## warning.
+## Add corresponding test for files reported as
+## output that no longer exist.
+## (See minted package for cases where reported
+## input and output files don't exist at end of run.)
+## 15 Mar 2018 John Collins Version 4.55c.
+## Move test for non-existent file in fls to calling routine.
+## 15 Mar 2018 John Collins Deal with non-existent input files reported in
+## fls file. (Needed to work around bug in lualatex
+## in TeXLive 2016, 2017 and pretest 2018 (as of the
+## version of 2018 Mar 4).
+## 2 Feb 2018 John Collins Version 4.55b. Correct parsing of biber's log file.
+## 25 Jan 2018 John Collins Implement $warning_cmd
+## 24 Jan 2018 John Collins Version number to 4.55a. Implement warnings_as_errors option
## 17 Jan 2018 John Collins Version number to 4.55. Ready for release.
+## Release v. 4.55 on CTAN.
## 15, 16 Jan 2018 John Collins Correct bug in measuring filetime offset.
## 14 Jan 2018 John Collins Correct issue with possible filetime offset
## on remote file system.
@@ -322,6 +353,12 @@ $log_wrap = 79;
## Most of these variables represents the external command needed to
## perform a certain action. Some represent switches.
+
+## Which TeX distribution is being used
+## E.g., "MiKTeX 2.9", "TeX Live 2018"
+## "" means not determined. Obtain from first line of .log file.
+$tex_distribution = '';
+
## Commands to invoke latex, pdflatex, etc
$latex = 'latex %O %S';
$pdflatex = 'pdflatex %O %S';
@@ -354,6 +391,8 @@ add_input_ext( 'lualatex', 'tex', 'jpg', 'pdf', 'png' );
add_input_ext( 'xelatex', 'tex', 'jpg', 'pdf', 'png' );
#show_input_ext( 'latex' ); show_input_ext( 'pdflatex' );
+%allowed_output_ext = ( ".dvi" => 1, ".xdv" => 1, ".pdf" => 1 );
+
# Information about options to latex and pdflatex that latexmk will simply
# pass through to (pdf)latex
# Option without arg. maps to itself.
@@ -595,6 +634,10 @@ $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.
+# Commands for use in pvc mode for compiling, success, warnings, and failure;
+# they default to empty, i.e., not to use:
+$compiling_cmd = $success_cmd = $warning_cmd = $failure_cmd = "";
+
# Commands for printing are highly system dependent, so default to NONE:
$lpr = 'NONE $lpr variable is not configured to allow printing of ps files';
$lpr_dvi = 'NONE $lpr_dvi variable is not configured to allow printing of dvi files';
@@ -1064,6 +1107,7 @@ $aux_dir = ''; # Directory for aux files (log, aux, etc).
## default flag settings.
$recorder = 1; # Whether to use recorder option on latex/pdflatex
$silent = 0; # Silence latex's messages?
+$warnings_as_errors = 0;# Treat warnings as errors and exit with non-zero exit code
$silence_logfile_warnings = 0; # Do list warnings in log file
$kpsewhich_show = 0; # Show calls to and results from kpsewhich
$landscape_mode = 0; # default to portrait mode
@@ -1149,10 +1193,11 @@ $cleanup_fdb = 0; # No removal of file for latexmk's file-database
$cleanup_only = 0; # When doing cleanup, do not go on to making files
$cleanup_includes_generated = 0;
# Determines whether cleanup deletes files generated by
- # custom dependencies
+ # (pdf)latex (found from \openout lines in log file).
+ # It's more than that. BUG
$cleanup_includes_cusdep_generated = 0;
# Determines whether cleanup deletes files generated by
- # (pdf)latex (found from \openout lines in log file).
+ # custom dependencies
$diagnostics = 0;
$dvi_filter = ''; # DVI filter command
$ps_filter = ''; # Postscript filter command
@@ -1188,11 +1233,13 @@ $updated = 0; # Flags when something has been remade
$waiting = 0; # Flags whether we are in loop waiting for an event
# Used to avoid unnecessary repeated o/p in wait loop
-# Used for some results of parsing log file:
+# The following are used for some results of parsing log file
+# Global variables, so results can be reported in main program.
$reference_changed = 0;
$mult_defined = 0;
$bad_reference = 0;
$bad_citation = 0;
+@primary_warning_summary = ();
# Cache of expensive-to-compute state variables, e.g., cwd in form
# fixed to deal with cygwin issues.
@@ -1522,7 +1569,20 @@ sub read_first_rc_file_in_list {
# So test on $auto_rc_use in each case.
if ( $auto_rc_use ) {
# System rc file:
- read_first_rc_file_in_list( @rc_system_files );
+ if (exists $ENV{LATEXMKRCSYS} ) {
+ push @rc_system_files, $ENV{LATEXMKRCSYS};
+ if ( !-e $ENV{LATEXMKRCSYS} ) {
+ warn "$My_name: you've specified a system rc file `$ENV{LATEXMKRCSYS}`\n",
+ " in environment variable LATEXMKRCSYS, but the file doesn't exist.\n",
+ " I won't read any system rc file.\n";
+ }
+ else {
+ process_rc_file( $ENV{LATEXMKRCSYS} );
+ }
+ }
+ else {
+ read_first_rc_file_in_list( @rc_system_files );
+ }
}
if ( $auto_rc_use && ($HOME ne "" ) ) {
# User rc file:
@@ -1708,6 +1768,7 @@ while ($_ = $ARGV[0])
elsif (/^-view=none$/) { $view = "none";}
elsif (/^-view=ps$/) { $view = "ps";}
elsif (/^-view=pdf$/) { $view = "pdf"; }
+ elsif (/^-Werror$/){ $warnings_as_errors = 1; }
elsif (/^-lualatex$/) {
$pdf_mode = 4;
$dvi_mode = $postscript_mode = 0;
@@ -1800,33 +1861,26 @@ if ( ($out_dir ne '') && ($aux_dir eq '') ){
$aux_dir = $out_dir;
}
-# Normalize versions terminating in directory/path separator
-# and versions referring to current directory
-$out_dir1 = $out_dir;
-$aux_dir1 = $aux_dir;
-foreach ( $aux_dir1, $out_dir1 ) {
- if ( ($_ ne '') && ! m([\\/\:]$) ) {
- $_ .= '/';
- }
- while ( s[^\.\/][] ) {}
-}
-
-# At least one widely package (revtex4-1) generates a bib file
-# (which is used in revtex4-1 for putting footnotes in the reference
-# list), and bibtex must be run to use it. But latexmk needs to
-# determine the existence of the bib file by use of kpsewhich, otherwise
-# there is an error. So cope with this situation (and any analogous
-# cases by adding the aux_dir to the relevant path search environment
-# variables. BIBINPUTS seems to be the only one currently affected.
-foreach ( 'BIBINPUTS' ) {
- if ( exists $ENV{$_} ) {
- $ENV{$_} = $aux_dir.$search_path_separator.$ENV{$_};
- }
- else {
- $ENV{$_} = $aux_dir.$search_path_separator;
- }
+# Save original values for use in diagnositics.
+# We may change $aux_dir and $out_dir after a detection
+# of results of misconfiguration.
+$aux_dir_requested = $aux_dir;
+$out_dir_requested = $out_dir;
+# The following reports results of diagnostics on location of .log file
+# after the first run of a latex engine, when actually used aux_dir
+# may not be the expected one, due to a configuration error.
+# Values: -1 uninitialized (before first run)
+# 0 log file not found;
+# 1 log file in aux_dir;
+# 2 log file **not** in aux_dir but in out_dir;
+# 3 log file **not** in aux_dir or out_dir, but in cwd.
+$where_log = -1;
+
+foreach ( 'BIBINPUTS', 'TEXINPUTS' ) {
+ if ( exists $ENV{$_} ) { $ENV_ORIG{$_} = $ENV{$_}; }
}
+&set_dirs_etc;
if ($bibtex_use > 1) {
push @generated_exts, 'bbl';
@@ -2112,22 +2166,6 @@ foreach (@generated_exts ) {
$generated_exts_all{$_} = 1;
}
-if ($aux_dir) {
- # Ensure $aux_dir is in TEXINPUTS search path.
- # This is used by dvips for files generated by mpost.
- if ( ! exists $ENV{TEXINPUTS} ) {
- # Note the trailing ":" which ensures that the last item
- # in the list of paths is the empty path, which actually
- # means the default path, i.e., the following means that
- # the TEXINPUTS search path is $aux_dir and the standard
- # value.
- $ENV{TEXINPUTS} = $aux_dir.$search_path_separator;
- }
- elsif ( $ENV{TEXINPUTS} !~ /$aux_dir$search_path_separator/ ) {
- $ENV{TEXINPUTS} = $aux_dir.$search_path_separator.$ENV{TEXINPUTS};
- }
-}
-
$quell_uptodate_msgs = $silent;
# Whether to quell informational messages when files are uptodate
# Will turn off in -pvc mode
@@ -2222,9 +2260,7 @@ foreach $filename ( @file_list )
$root_filename = $jobname;
}
- $aux_main = "$aux_dir1$root_filename.aux";
- $log_name = "$aux_dir1$root_filename.log";
- $fdb_name = "$aux_dir1$root_filename.$fdb_ext";
+ &set_names;
# Initialize basic dependency information:
@@ -2489,6 +2525,13 @@ foreach $filename ( @file_list )
if ( ( $failure <= 0 ) || $force_mode ) {
rdb_for_some( [keys %one_time], \&rdb_run1 );
}
+ if ($#primary_warning_summary > -1) {
+ # N.B. $mult_defined, $bad_reference, $bad_citation also available here.
+ if ($warnings_as_errors) {
+ $failure = 1;
+ $failure_msg = "Warning(s) from latex (or c.) for '$filename'; treated as error";
+ }
+ }
if ($failure > 0) { next FILE; }
} # end FILE
continue {
@@ -2502,8 +2545,11 @@ continue {
if ( $failure_msg ) {
#Remove trailing space
$failure_msg =~ s/\s*$//;
- warn "$My_name: Did not finish processing file '$filename':\n",
+ warn "----------------------\n";
+ warn "This message may duplicate earlier message.\n";
+ warn "$My_name: Failure in processing file '$filename':\n",
" $failure_msg\n";
+ warn "----------------------\n";
$failure = 1;
}
}
@@ -2542,15 +2588,67 @@ if ($failure_count > 0) {
}
if ( !$force_mode ) {
warn "$My_name: Use the -f option to force complete processing,\n",
- " unless error was exceeding maximum runs of latex/pdflatex.\n";
+ " unless error was exceeding maximum runs, or warnings treated as errors.\n";
}
exit 12;
}
+if ( $where_log == 2 ) {
+ warn "$My_name: You requested aux_dir '$aux_dir_requested',\n".
+ " but '$aux_dir' was used by the (pdf)latex engine.\n".
+ " That indicates a configuration error.\n";
+ if ( ($tex_distribution !~ /^MiKTeX/i) && ($aux_dir_requested ne $out_dir_requested) ) {
+ warn " Probably you set different aux and out directories,\n".
+ " but that is not supported by your TeX distribution.\n".
+ " The only current distribution supporting this is MiKTeX.\n";
+ }
+}
+
# end MAIN PROGRAM
#############################################################
+#############################################################
+
+sub set_dirs_etc {
+ # Normalize versions terminating in directory/path separator
+ # and versions referring to current directory
+ # These actions in a subroutine so they can be used elsewhere.
+ $out_dir1 = $out_dir;
+ $aux_dir1 = $aux_dir;
+ foreach ( $aux_dir1, $out_dir1 ) {
+ if ( ($_ ne '') && ! m([\\/\:]$) ) {
+ $_ .= '/';
+ }
+ while ( s[^\.\/][] ) {}
+ }
+ if ($aux_dir) {
+ # Ensure $aux_dir is in BIBINPUTS and TEXINPUTS search paths.
+ # TEXINPUTS is used by dvips for files generated by mpost.
+ # For BIBINPUTS,
+ # at least one widely package (revtex4-1) generates a bib file
+ # (which is used in revtex4-1 for putting footnotes in the reference
+ # list), and bibtex must be run to use it. But latexmk needs to
+ # determine the existence of the bib file by use of kpsewhich, otherwise
+ # there is an error. So cope with this situation (and any analogous
+ # cases by adding the aux_dir to the relevant path search environment
+ # variables. BIBINPUTS seems to be the only one currently affected.
+ foreach ( 'BIBINPUTS', 'TEXINPUTS' ) {
+ if ( exists $ENV_ORIG{$_} ) {
+ $ENV{$_} = $aux_dir.$search_path_separator.$ENV_ORIG{$_};
+ }
+ else {
+ # Note the trailing ":" or ";" which ensures that the last item
+ # in the list of paths is the empty path, which actually
+ # means the default path, i.e., the following means that
+ # the search path is $aux_dir and the standard value.
+ $ENV{$_} = $aux_dir.$search_path_separator;
+ }
+ }
+ }
+}
+
+#############################################################
sub fix_cmds {
# If commands do not have placeholders for %S etc, put them in
@@ -3184,7 +3282,13 @@ CHANGE:
}
}
else {
- if ($success_cmd) {
+ if ( ($#primary_warning_summary > -1) && $warning_cmd ) {
+ Run_subst( $warning_cmd );
+ }
+ elsif ( ($#primary_warning_summary > -1) && $warnings_as_errors && $failure_cmd ) {
+ Run_subst( $failure_cmd );
+ }
+ elsif ($success_cmd) {
Run_subst( $success_cmd );
}
}
@@ -3574,6 +3678,7 @@ sub print_help
" -view=none - no viewer is used\n",
" -view=ps - viewer is for ps\n",
" -view=pdf - viewer is for pdf\n",
+ " -Werror - treat warnings from called programs as errors\n",
" -xelatex - use xelatex for processing files to pdf\n",
" and turn dvi/ps modes off\n",
"\n",
@@ -3706,7 +3811,6 @@ sub check_biber_log {
elsif ( /> INFO - Found .* '([^']+)'\s*$/
|| /> INFO - Found '([^']+)'\s*$/
|| /> INFO - Reading '([^']+)'\s*$/
- || /> INFO - Reading (.*)$/
|| /> INFO - Processing .* file '([^']+)' .*$/
) {
if ( defined $Pbiber_source ) {
@@ -3726,6 +3830,7 @@ sub check_biber_log {
my @not_found = &find_file_list1( $Pbiber_source, $Pbiber_source,
'', \@BIBINPUTS );
@$Pbiber_source = uniqs( @$Pbiber_source );
+
if ( ($#not_found < 0) && ($#$Pbiber_source >= 0) ) {
warn "$My_name: Found biber source file(s) [@$Pbiber_source]\n"
unless $silent;
@@ -3737,8 +3842,8 @@ sub check_biber_log {
return 5;
}
else {
- show_array( "$My_name: Failed to find one or more biber source files:",
- @not_found );
+ warn "$My_name: Failed to find one or more biber source files:\n";
+ foreach (@not_found) { warn " '$_'\n"; }
if ($force_mode) {
warn "==== Force_mode is on, so I will continue. ",
"But there may be problems ===\n";
@@ -3767,31 +3872,33 @@ sub run_bibtex {
my $return = 999;
# Prevent changes we make to environment becoming global:
local %ENV = %ENV;
- if ( $aux_dir ) {
- # 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 );
- my $cwd = good_cwd();
- foreach ( 'BIBINPUTS', 'BSTINPUTS' ) {
- if ( exists $ENV{$_} ) {
- $ENV{$_} = $cwd.$search_path_separator.$ENV{$_};
- }
- else {
- $ENV{$_} = $cwd.$search_path_separator;
- }
+ my ( $base, $path, $ext ) = fileparseA( $$Psource );
+ if ( $path ) {
+ # Since (e.g.,) 'bibtex output/main.aux' doesn't find subsidiary .aux
+ # files, as from \@include{chap.aux}, we change directory to the
+ # directory of the top-level .aux file to run bibtex. But we have to
+ # fix search paths for .bib and .bst, since they may be specified
+ # relative to the document directory.
+ my $cwd = good_cwd();
+ foreach ( 'BIBINPUTS', 'BSTINPUTS' ) {
+ if ( exists $ENV{$_} ) {
+ $ENV{$_} = $cwd.$search_path_separator.$ENV{$_};
}
- pushd( $path );
- $return = &Run_subst( undef, undef, '', $base.$ext, '', $base );
- popd();
- }
- else {
- warn "$My_name: Directory in file name '$$Psource' for bibtex\n",
- " but it is not the output directory '$aux_dir'\n";
- $return = Run_subst();
- }
+ else {
+ $ENV{$_} = $cwd.$search_path_separator;
+ }
+ }
+ pushd( $path );
+ if (!$silent) {
+ print "$My_name: changed directory to '$path'\n",
+ "Set BIBINPUTS='$ENV{BIBINPUTS}'\n",
+ "Set BSTINPUTS='$ENV{BSTINPUTS}'\n";
+ }
+ $return = &Run_subst( undef, undef, '', $base.$ext, '', $base );
+ popd();
+ if (!$silent) {
+ print "$My_name: changed directory back to '", cwd(), "'\n";
+ }
}
else {
$return = Run_subst();
@@ -3884,10 +3991,18 @@ sub normalize_force_directory {
return normalize_filename( $filename );
} #END normalize force_directory
-# ------------------------------
+#**************************************************
-sub parse_log {
+sub set_names {
+ # Set names of standard files:
+ $aux_main = "$aux_dir1$root_filename.aux";
+ $log_name = "$aux_dir1$root_filename.log";
+ $fdb_name = "$aux_dir1$root_filename.$fdb_ext";
+}
+
+#**************************************************
+sub parse_log {
# Scan log file for: dependent files
# reference_changed, bad_reference, bad_citation
# Return value: 1 if success, 0 if no log file.
@@ -4007,6 +4122,11 @@ sub parse_log {
$engine = $1;
print "=== TeX engine is '$engine'\n"
if (!$silent);
+ if ( /^This is ([^,]+), [^\(]*\(([^\)]+)\)/ ) {
+ $tex_distribution = $2;
+ print "=== TeX distribution is '$tex_distribution'\n"
+ if ($diagnostics);
+ }
}
else {
warn "$My_name: First line of .log file '$log_name' is not in standard format.\n";
@@ -4265,7 +4385,6 @@ LINE:
foreach my $pattern (@file_not_found) {
if ( /$pattern/ ) {
my $file = clean_filename($1);
- warn "===========$My_name: Missing input file: '$file' from line\n '$_'\n";
warn "$My_name: Missing input file: '$file' from line\n '$_'\n"
unless $silent;
$dependents{normalize_filename($file, @pwd_log)} = 0;
@@ -4654,6 +4773,72 @@ CANDIDATE_PAIR:
#************************************************************
+sub find_set_log {
+ # Locate the log file, if possible. This allows for possible configuration
+ # errors, e.g., because the command for (*)latex was such that it did not
+ # do the setting of -output-directory or -aux-directory that the user intended,
+ # or because the version used did not support one or other of these options.
+ # Put result in $where_log (see its initial declaration/definition for details).
+ # Change $aux_dir and/or $out_dir as appropriate, and make consequent changes.
+ #
+ # Probably further attention to location of output file (.dvi, .pdf, or .xdv)
+ # could be done, to get $out_dir and $$Pdest more accurately set.
+ #
+ # Typical configuration errors that lead to the need for this subroutine:
+ # %O not used in command definition, so directory options don't getpassed
+ # to (*)latex.
+ # Use of $aux_dir different to $out_dir, when (*)latex doesn't support
+ # the -aux-directory option (notably with TeXLive distribution).
+ if ($where_log >= 0) {
+ # .log file was found on previous run. No need to repeat search, since
+ # if the location were to change from run to run, we'd have other
+ # serious difficulties that are to hard to deal with.
+ return;
+ }
+ if ( test_gen_file( "$aux_dir1$root_filename.log" ) ) {
+ # .log file is in expected place.
+ $where_log = 1;
+ }
+ elsif ( test_gen_file( "$out_dir1$root_filename.log" ) ) {
+ # .log file is in out_dir not in aux_dir.
+ # Presumably there is a configuration error
+ # that prevents aux_dir from being used by latex.
+ # So change $aux_dir to the actually used value.
+ $where_log = 2;
+ $aux_dir = $out_dir;
+ }
+ elsif ( test_gen_file( "$root_filename.log" ) ) {
+ # .log file is not in out_dir nor in aux_dir, but is in cwd.
+ # Presumably there is a configuration error
+ # that prevents the directories from being used by latex.
+ # So change $aux_dir to the actually used value.
+ $where_log = 3;
+ $aux_dir = "";
+ }
+ else {
+ # No .log file found
+ $failure = 1;
+ $$Plast_result = 2;
+ $where_log = 0;
+ $failure_msg
+ = "(Pdf)LaTeX didn't generate the expected log file '$log_name'\n";
+ }
+ if ($where_log > 1) {
+ warn "$My_name: Changed aux_dir from '$aux_dir_requested' to '$aux_dir'\n".
+ " to allow for probable configuration error\n";
+ # Allow for the changes associated with change of $aux_dir:
+ &set_dirs_etc;
+ &set_names;
+ warn "$My_name: Actual .log file is\n",
+ " '$log_name'\n",
+ " instead of the value\n",
+ " '$aux_dir_requested/$root_filename.log'\n",
+ " that seemed to be intended.\n";
+ }
+}
+
+#************************************************************
+
sub parse_fls {
my ($fls_name, $Pinputs, $Poutputs, $Pfirst_read_after_write, $Ppwd_latex ) = @_;
%$Pinputs = %$Poutputs = %$Pfirst_read_after_write = ();
@@ -4833,22 +5018,27 @@ sub parse_aux {
@$Pbib_files = uniqs( @$Pbib_files );
&find_file_list1( $Pbst_files, $Pbst_files, '.bst' );
@$Pbst_files = uniqs( @$Pbst_files );
+ my @bad_bib = ();
+ foreach ( @$Pbib_files ) {
+ if ( /\s/ ) { push @bad_bib, $_; }
+ }
+ if ($#bad_bib >= 0) {
+ warn "$My_name: White space in an argument list for \\bibliography.\n",
+ " which is not allowed by bibtex. Bad arguments:\n";
+ foreach (@bad_bib ) { warn " '$_'\n"; }
+ return 3;
+ }
if ( $#not_found < 0) {
warn "$My_name: Found bibliography file(s) [@$Pbib_files]\n"
unless $silent;
}
else {
- show_array( "$My_name: Failed to find one or more bibliography files ",
- @not_found );
+ warn "$My_name: Failed to find one or more bibliography files:\n";
+ foreach (@not_found) { warn " '$_'\n"; }
if ($force_mode) {
warn "==== Force_mode is on, so I will continue. ",
"But there may be problems ===\n";
}
- else {
- #$failure = -1;
- #$failure_msg = 'Failed to find one or more bib files';
- #warn "$My_name: Failed to find one or more bib files\n";
- }
return 3;
}
return 1;
@@ -5457,10 +5647,27 @@ sub rdb_set_latex_deps {
# wasn't used/analyzed, so we don't need a test as to whether the fls file was
# used.
foreach (keys %source_fls) {
+ if (! -e ) {
+ # File is listed in .fls file as read, but doesn't exist now.
+ # Therefore it is not a true source file, surely.
+ # Sometimes this is caused by a bug (e.g., lualatex in TeXLive 2016,
+ # 2017) when there is an incorrect line in .fls file. (This
+ # would deserve a warning.)
+ # But sometimes (e.g., with minted package), the file could be
+ # created during a run, read, and then deleted.
+ next;
+ }
$dependents{$_} = 4;
if ( /\.bbl$/ ) { push @bbl_files, $_; }
}
foreach (keys %generated_fls) {
+ if (! -e ) {
+ # File is listed in .fls file as written, but doesn't exist now.
+ # Therefore it is not a true externally visible generated file.
+ # (Typically, e.g., with the minted package, it is a temporary
+ # file created during a run and then deleted during the run.)
+ next;
+ }
rdb_add_generated( $_ );
if ( exists($dependents{$_}) ) {
$dependents{$_} = 6;
@@ -5503,14 +5710,45 @@ sub rdb_set_latex_deps {
# (i.e., dvi instead of pdf, or vv). This could
# legitimately occur when the source file (or an invoked
# package or class) sets \pdfoutput.
- $missing_dvi_pdf = '';
+ $missing_dvi_pdf = '';
if ($primary_out eq '') {
warn "$My_name: For rule '$rule', no output was made\n";
$missing_dvi_pdf = $$Pdest;
}
- elsif ($primary_out ne $$Pdest) {
+ elsif ($primary_out ne normalize_filename($$Pdest) ) {
warn "$My_name: ===For rule '$rule', actual output '$primary_out'\n",
- " ======appears not to match expected output '$$Pdest'\n";
+ " ======appears not to match expected output '$$Pdest'.\n",
+ " Further diagnostics follow:\n";
+ my ($actual_base, $actual_path, $actual_ext) = fileparseA( $primary_out );
+ my ($intended_base, $intended_path, $intended_ext) = fileparseA( $$Pdest );
+ if ( $actual_base ne $intended_base ) {
+ warn " --The base names of the files are different. That is strange!!\n";
+ }
+ if ( $actual_path ne $intended_path ) {
+ warn " --The paths of the files are different. I may have misunderstood\n",
+ " different names for the same directory, which is innocuous,\n",
+ " or there may be a configuration error.\n";
+ }
+ if ( $actual_ext ne $intended_ext ) {
+ warn " --The extensions of the files are different, i.e., the\n",
+ " intended and actual types of the output differ.\n";
+ if ( ! exists $allowed_output_ext{$actual_ext} ) {
+ warn " Actual output file has an extension '$actual_ext' that\n",
+ " is not one I know about\n";
+ }
+ if ( (($actual_ext eq '.pdf') && ($intended_ext eq '.dvi'))
+ || (($actual_ext eq '.dvi') && ($intended_ext eq '.pdf'))
+ )
+ {
+ warn " This could arise from use of \\pdfoutput in the source file,\n",
+ " or from a configuration error\n";
+ }
+ else {
+ warn " This indicates a probable configuration error\n";
+ }
+ warn " A future version of $my_name should be able to make dynamically\n",
+ " adjustments to deal with this problem\n";
+ }
}
IDX_FILE:
@@ -5766,10 +6004,10 @@ MISSING_FILE:
if ( -e "$missing.tex" ) {
$new_includes{"$missing.tex"} = 1;
}
- if ( -e $missing ) {
+ elsif ( -e $missing ) {
$new_includes{$missing} = 1;
}
- if ( $ext ne "" ) {
+ elsif ( $ext ne "" ) {
foreach my $dep (@cus_dep_list){
my ($fromext,$toext) = split('\s+',$dep);
if ( ( "$ext" eq "$toext" )
@@ -6275,7 +6513,7 @@ sub rdb_make {
local %pass = ();
local $failure = 0; # General accumulated error flag
- local $missing_dvi_pdf = ''; # Did primary run fail to make its output file?
+ local $missing_dvi_pdf = ''; # Did primary run fail to make its output file?
local $runs = 0;
local $too_many_passes = 0;
local %rules_applied = ();
@@ -6358,6 +6596,11 @@ sub rdb_make {
rdb_for_some( [@unusual_one_time], \&rdb_make1 );
rdb_write( $fdb_name );
+ if ($#primary_warning_summary > -1) {
+ # N.B. $mult_defined, $bad_reference, $bad_citation also available here.
+ show_array( "$My_name: Summary of warnings from last run of (pdf)latex:",
+ @primary_warning_summary );
+ }
if (! $silent) {
if ($failure && $force_mode) {
print "$My_name: Errors, in force_mode: so I tried finishing targets\n";
@@ -7037,16 +7280,14 @@ sub rdb_primary_run {
}
my $return_latex = &rdb_run1;
+
+ # Need to worry about changed directory, changed output extension
+ # Where else is $missing_dvi_pdf set? Was it initialized?
if (-e $$Pdest) { $missing_dvi_pdf = '';}
- ######### Analyze results of run:
- if ( ! -e $log_name ) {
- $failure = 1;
- $$Plast_result = 2;
- $$Plast_message = $failure_msg
- = "(Pdf)LaTeX failed to generate the expected log file '$log_name'";
- return -1;
- }
+ # Handle case that log file is caused to be in an unexpected place,
+ # from a configuration error:
+ &find_set_log;
if ($recorder) {
# Handle problem that some version of (pdf)latex give fls files
@@ -7076,7 +7317,7 @@ sub rdb_primary_run {
}
}
if ( ! test_gen_file( $std_fls_file ) ) {
- warn "$My_name: fls file doesn't appear to have been made\n";
+ warn "$My_name: fls file doesn't appear to have been made.\n";
}
}
@@ -7125,18 +7366,21 @@ sub rdb_primary_run {
$return = 0;
}
# Summarize issues that may have escaped notice:
- my @warnings = ();
+ @primary_warning_summary = ();
if ($bad_reference) {
- push @warnings, "Latex failed to resolve $bad_reference reference(s)";
+ push @primary_warning_summary,
+ "Latex failed to resolve $bad_reference reference(s)";
}
if ($mult_defined) {
- push @warnings, "Latex found $mult_defined multiply defined reference(s)";
+ push @primary_warning_summary,
+ "Latex found $mult_defined multiply defined reference(s)";
}
if ($bad_citation) {
- push @warnings, "Latex failed to resolve $bad_citation citation(s)";
+ push @primary_warning_summary,
+ "Latex failed to resolve $bad_citation citation(s)";
}
- if ($#warnings > -1) {
- show_array( "$My_name: Summary of warnings:", @warnings );
+ if ( $diagnostics && ($#primary_warning_summary > -1) ) {
+ show_array( "$My_name: Summary of warnings:", @primary_warning_summary );
}
return $return;
} #END rdb_primary_run
@@ -8506,7 +8750,7 @@ sub fileparseA {
$path = '';
}
return ($base_name, $path, $ext);
- }
+}
#************************************************************
@@ -8517,7 +8761,7 @@ sub fileparseB {
if ($#_ > 0 ) { $pattern = $_[1]; }
my ($base_name, $path, $ext) = fileparse( $given, $pattern );
return ($base_name, $path, $ext);
- }
+}
#************************************************************
@@ -8846,9 +9090,10 @@ sub find_process_id {
sub cache_good_cwd {
# Set cached value of cwd to current cwd.
- # Under cygwin, the cwd is converted to a native MSWin path so
+ # Under cygwin, the cached value is converted to a native MSWin path so
# that the result can be used for input to MSWin programs as well
- # as cygwin programs.
+ # as cygwin programs.
+ # Similarly for msys.
my $cwd = cwd();
if ( $^O eq "cygwin" ) {
my $cmd = "cygpath -w \"$cwd\"";
@@ -8866,14 +9111,18 @@ sub cache_good_cwd {
" '$Win_cwd'\n";
}
}
+ elsif ( $^O eq "msys" ) {
+ $cwd =~ s[^/([a-z])/][\u$1:/];
+ }
$cache{cwd} = $cwd;
} # END cache_good_cwd
#============================================
sub good_cwd {
- # Return cwd, but under cygwin, convert to MSWin path.
- # Use cached result
+ # Return cwd, but under cygwin (or ...), convert to MSWin path.
+ # Use cached result, to save a possible expensive computation (running
+ # of extenal program under cygwin).
return $cache{cwd};
} # END good_cwd