texlive[73112] trunk: latexmk (13dec24)
commits+karl at tug.org
commits+karl at tug.org
Fri Dec 13 23:37:25 CET 2024
Revision: 73112
https://tug.org/svn/texlive?view=revision&revision=73112
Author: karl
Date: 2024-12-13 23:37:25 +0100 (Fri, 13 Dec 2024)
Log Message:
-----------
latexmk (13dec24)
Modified Paths:
--------------
trunk/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
trunk/Master/texmf-dist/doc/man/man1/latexmk.1
trunk/Master/texmf-dist/doc/man/man1/latexmk.man1.pdf
trunk/Master/texmf-dist/doc/support/latexmk/CHANGES
trunk/Master/texmf-dist/doc/support/latexmk/INSTALL
trunk/Master/texmf-dist/doc/support/latexmk/README
trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/bib2gls_latexmkrc
trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc
trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/splitindex_latexmkrc
trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xr_latexmkrc
trunk/Master/texmf-dist/doc/support/latexmk/latexmk.pdf
trunk/Master/texmf-dist/doc/support/latexmk/latexmk.txt
trunk/Master/texmf-dist/scripts/latexmk/latexmk.pl
Modified: trunk/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl
===================================================================
--- trunk/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Build/source/texk/texlive/linked_scripts/latexmk/latexmk.pl 2024-12-13 22:37:25 UTC (rev 73112)
@@ -47,10 +47,16 @@
# blocks.
$my_name = 'latexmk';
$My_name = 'Latexmk';
- $version_num = '4.85';
- $version_details = "$My_name, John Collins, 7 Apr. 2024. Version $version_num";
+ $version_num = '4.86';
+ $version_details = "$My_name, John Collins, 11 Dec. 2024. Version $version_num";
}
+# Ensure that when STDERR and STDOUT are both redirected, the results are
+# in the order they are written. Otherwise, the default situation for
+# redirected output is that STDERR is always autoflushed, but STDOUT is
+# not, and therefore output does not appear in the order is was written.
+STDOUT->autoflush(1);
+
use Config;
use File::Basename;
use File::Copy;
@@ -1227,7 +1233,7 @@
# compilation of .tex file tests for file existence and
# adjusts behavior accordingly, instead of simply giving an
# error.
-our $max_repeat = 5; # Maximum times I repeat latex. Normally
+our $max_repeat = 5; # Maximum times I repeat latex. Normally
# 3 would be sufficient: 1st run generates aux file,
# 2nd run picks up aux file, and maybe toc, lof which
# contain out-of-date information, e.g., wrong page
@@ -2033,16 +2039,18 @@
elsif (/^-dir-report$/) { $aux_out_dir_report = 1; }
elsif (/^-dir-report-$/) { $aux_out_dir_report = 0; }
elsif (/^-dvi$/) { $dvi_mode = 1;
- $hnt_mode = 0;
+ $hnt_mode = $xdv_mode = 0;
+ # Postscript mode OK
if ( ($pdf_mode != 2) && ($pdf_mode != 3) ) {
- # if pdf_mode is not via dvi or pdf, turn it off
+ # if pdf_mode is not via dvi or ps, turn it off
$pdf_mode = 0;
}
}
elsif (/^-dvilua$/) { $dvi_mode = 2;
- $hnt_mode = 0;
+ $hnt_mode = $xdv_mode = 0;
+ # Postscript mode OK
if ( ($pdf_mode != 2) && ($pdf_mode != 3) ) {
- # if pdf_mode is not via dvi or pdf, turn it off
+ # if pdf_mode is not via dvi or ps, turn it off
$pdf_mode = 0;
}
}
@@ -2064,7 +2072,7 @@
}
elsif ( /^-h$/ || /^-help$/ ) { &print_help; exit;}
elsif (/^-hnt$/) { $hnt_mode = 1;
- $dvi_mode = $postscript_mode = $pdf_mode = 0;
+ $dvi_mode = $postscript_mode = $pdf_mode = $xdv_mode = 0;
}
elsif (/^-jobname=(.*)$/) {
$jobname = $1;
@@ -2071,11 +2079,13 @@
}
elsif (/^-l$/) { $landscape_mode = 1; }
elsif (/^-l-$/) { $landscape_mode = 0; }
- elsif ( /^-latex$/ ) {
- $pdf_mode = 0;
- $postscript_mode = 0;
- $dvi_mode = 1;
- $hnt_mode = 0;
+ elsif ( /^-latex$/ ) { $dvi_mode = 1;
+ $hnt_mode = $postscript_mode = $xdv_mode = 0;
+ # Postscript mode OK
+ if ( ($pdf_mode != 2) && ($pdf_mode != 3) ) {
+ # if pdf_mode is not via dvi or ps, turn it off
+ $pdf_mode = 0;
+ }
}
elsif (/^-latex=(.*)$/) {
$latex = $1;
@@ -2093,7 +2103,7 @@
{ $silence_logfile_warnings = 1; }
elsif ( /^-lualatex$/ || /^-pdflualatex$/ ) {
$pdf_mode = 4;
- $dvi_mode = $hnt_mode = $postscript_mode = 0;
+ $dvi_mode = $hnt_mode = $postscript_mode = $xdv_mode = 0;
}
# See below for -lualatex=...
# See above for -M
@@ -2132,15 +2142,16 @@
my $format = $1;
if ($format eq 'dvi' ) {
$dvi_mode = 1;
- $hnt_mode = 0;
+ $hnt_mode = $xdv_mode = 0;
+ # Postscript mode OK
if ( ($pdf_mode != 2) && ($pdf_mode != 3) ) {
- # if pdf_mode is not via dvi or pdf, turn it off
+ # if pdf_mode is not via dvi or ps, turn it off
$pdf_mode = 0;
}
}
elsif ($format eq 'pdf' ) {
$pdf_mode = 1;
- $dvi_mode = $hnt_mode = $postscript_mode = 0;
+ $dvi_mode = $hnt_mode = $postscript_mode = $xdv_mode = 0;
}
else {
warn "$My_name: unknown format in option '$_'\n";
@@ -2152,16 +2163,16 @@
$preview_mode = 0;
}
elsif (/^-p-$/) { $printout_mode = 0; }
- elsif (/^-pdf$/) { $pdf_mode = 1; $dvi_mode = $hnt_mode = $postscript_mode = 0; }
+ elsif (/^-pdf$/) { $pdf_mode = 1; $dvi_mode = $hnt_mode = $postscript_mode = $xdv_mode = 0; }
elsif (/^-pdf-$/) { $pdf_mode = 0; }
- elsif (/^-pdfdvi$/){ $pdf_mode = 3; $hnt_mode = 0; }
- elsif (/^-pdflua$/){ $pdf_mode = 4; $dvi_mode = $hnt_mode = $postscript_mode = 0; }
- elsif (/^-pdfps$/) { $pdf_mode = 2; $hnt_mode = 0; }
+ elsif (/^-pdfdvi$/){ $pdf_mode = 3; $hnt_mode = $xdv_mode = 0; }
+ elsif (/^-pdflua$/){ $pdf_mode = 4; $dvi_mode = $hnt_mode = $postscript_mode = $xdv_mode = 0; }
+ elsif (/^-pdfps$/) { $pdf_mode = 2; $hnt_mode = $xdv_mode = 0; }
elsif (/^-pdfxe$/) { $pdf_mode = 5; $dvi_mode = $hnt_mode = $postscript_mode = 0; }
elsif (/^-pdflatex$/) {
$pdflatex = "pdflatex %O %S";
$pdf_mode = 1;
- $dvi_mode = $hnt_mode = $postscript_mode = 0;
+ $dvi_mode = $hnt_mode = $postscript_mode = $xdv_mode = 0;
}
elsif (/^-pdflatex=(.*)$/) {
$pdflatex = $1;
@@ -2186,6 +2197,8 @@
}
}
elsif (/^-ps$/) { $postscript_mode = 1;
+ # dvi mode OK
+ $hnt_mode = $xdv_mode = 0;
if ( ($pdf_mode != 2) && ($pdf_mode != 3) ) {
# if pdf_mode is not via dvi or pdf, turn it off
$pdf_mode = 0;
@@ -2254,10 +2267,17 @@
elsif (/^-view=ps$/) { $view = "ps";}
elsif (/^-view=pdf$/) { $view = "pdf"; }
elsif (/^-Werror$/){ $warnings_as_errors = 1; }
- elsif (/^-xdv$/) { $xdv_mode = 1; }
+ elsif (/^-xdv$/) { $xdv_mode = 1;
+ $dvi_mode = $hnt_mode = $postscript_mode = 0;
+ if ( $pdf_mode != 5 ) {
+ # if pdf_mode is not by xelatex
+ $pdf_mode = 0;
+ }
+}
elsif (/^-xdv-$/) { $xdv_mode = 0; }
elsif ( /^-xelatex$/ || /^-pdfxelatex$/ ) {
$pdf_mode = 5;
+ # Xdv mode OK, since use xelatex to make xdv file
$dvi_mode = $hnt_mode = $postscript_mode = 0;
}
# See above for -xelatex=...
@@ -2590,10 +2610,11 @@
# If default viewer requested, use "highest" of dvi, ps and pdf
# that was requested by user.
# No explicit request means view dvi.
- $view = "dvi";
- if ( $hnt_mode ) { $view = "hnt"; }
if ( $pdf_mode ) { $view = "pdf"; }
- if ( $postscript_mode ) { $view = "ps"; }
+ elsif ( $postscript_mode ) { $view = "ps"; }
+ elsif ( $xdv_mode ) { $view = "none"; }
+ elsif ( $hnt_mode ) { $view = "hnt"; }
+ else { $view = "dvi"; }
}
# Determine requests.
@@ -2625,6 +2646,19 @@
" I replaced it by $pdf_mode, to be compatible with those other requests.\n";
}
}
+if ( $xdv_mode && $pdf_mode ) {
+ my %disallowed = ();
+ foreach (1,2,3,4) { $disallowed{$_} = 1; }
+ if ($disallowed{$pdf_mode}) {
+ warn
+ "$My_name: \$pdf_mode = $pdf_mode is incompatible with dvi and postscript modes\n",
+ " which are required by other requests.\n";
+ if ($postscript_mode) { $pdf_mode = 2; }
+ else { $pdf_mode = 3; }
+ warn
+ " I replaced it by $pdf_mode, to be compatible with those other requests.\n";
+ }
+}
if ( $pdf_mode == 0 ) {
$pdf_method = '';
}
@@ -2779,6 +2813,7 @@
my $start_time = time();
$Prun_time = \$start_time;
+
FILE:
foreach $filename ( @file_list )
{
@@ -2825,6 +2860,18 @@
# not known until after the call to normalize_aux_out_ETC:
&set_aux_out_options;
&set_names; # Names of standard files
+ if ($diagnostics || $aux_out_dir_report ) {
+ print "$My_name: Cwd: '", good_cwd(), "'\n";
+ print "$My_name: Normalized aux dir, out dir, out2 dir:\n",
+ " '$aux_dir', '$out_dir', '$out2_dir'\n";
+ print "$My_name: Combining forms of aux dir, out dir, out2 dir:\n",
+ " '$aux_dir1', '$out_dir1', '$out2_dir1'\n";
+ print "$My_name: Base name of generated files:\n",
+ " '$root_filename'\n";
+ if ($aux_out_dir_report == 2) {
+ next FILE;
+ }
+ }
# For use under error conditions:
@default_includes = ($texfile_name, $aux_main);
@@ -3355,17 +3402,6 @@
# So the following is only needed for TeXLive.
$ENV{TEXMFOUTPUT} = $aux_dir;
}
-
- if ($diagnostics || $aux_out_dir_report ) {
- print "$My_name: Cwd: '", good_cwd(), "'\n";
- print "$My_name: Normalized aux dir and out dirs:\n",
- " '$aux_dir', '$out_dir', '$out2_dir'\n";
- print "$My_name: and combining forms:\n '$aux_dir1', '$out_dir1', '$out2_dir1'\n";
- if ($aux_out_dir_report == 2) {
- exit 0;
- }
- }
-
} #END normalize_aux_out_ETC
#############################################################
@@ -3529,6 +3565,7 @@
elsif ($pdf_mode == 5) { rdb_activate( 'xdvipdfmx' ); $current_primary = 'xelatex'; }
if ($dvi_mode == 2) { $current_primary = 'dvilualatex'; }
if ($hnt_mode) { $current_primary = 'hilatex'; }
+ if ($xdv_mode) { $current_primary = 'xelatex'; }
rdb_activate( $current_primary );
@@ -3537,7 +3574,6 @@
if ($postscript_mode) { $target_files{$ps_final} = 1; }
if ($pdf_mode) { $target_files{$pdf_final} = 1; }
if ($xdv_mode) { $target_files{$xdv_final} = 1; }
-
&rdb_set_rule_net;
} # END rdb_initialize_rules
@@ -3936,7 +3972,7 @@
}
}
}
- elsif ( $rule =~ /^(latex|lualtex|pdflatex|xelatex)/ ) {
+ elsif ( exists $possible_primaries{$rule} ) {
foreach my $key (keys %$PHdest) {
$other_generated{$key} = 1;
}
@@ -4735,7 +4771,8 @@
" -bibtex-cond - use bibtex when needed, but only if the bib file exists\n",
" -bibtex-cond1 - use bibtex when needed, but only if the bib file exists;\n",
" on cleanup delete bbl file only if bib file exists\n",
- " -bibfudge or -bibtexfudge - change directory to output directory when running bibtex\n",
+ " -bibfudge or -bibtexfudge - change directory to output directory when\n",
+ " running bibtex\n",
" -bibfudge- or -bibtexfudge- - don't change directory when running bibtex\n",
" -bm <message> - Print message across the page when converting to postscript\n",
" -bi <intensity> - Set contrast or intensity of banner\n",
@@ -4761,10 +4798,11 @@
" and turn on showing of dependency list\n",
" -dF <filter> - Filter to apply to dvi file\n",
" -dir-report - Before processing a tex file, report aux and out dir settings\n",
+ " Report includes cwd and basename of output files\n",
" -dir-report- - Before processing a tex file, do not report aux and out dir\n",
" settings\n",
- " -dir-report-only - Report aux and out dir settings after initialization\n",
- " and previous option processing, and then stop\n",
+ " -dir-report-only - Report aux and out dir settings after initialization for\n",
+ " each tex file, without compiling it\n",
" -dvi - generate dvi by latex\n",
" -dvilua - generate dvi by dvilualatex\n",
" -dvi- - turn off required dvi\n",
@@ -4784,9 +4822,11 @@
" -g- - Turn off -g and -gg\n",
" -h - print help\n",
" -hnt - generate hnt by hilatex\n",
- " -help - print help\n",
- " -indexfudge or -makeindexfudge - change directory to output directory when running makeindex\n",
- " -indexfudge- or -makeindexfudge- - don't change directory when running makeindex\n",
+ " -help - print help\n",
+ " -indexfudge or -makeindexfudge - change directory to output directory when\n",
+ " running makeindex\n",
+ " -indexfudge- or -makeindexfudge- - don't change directory when running\n",
+ " makeindex\n",
" -jobname=STRING - set basename of output file(s) to STRING.\n",
" (Like --jobname=STRING on command line for many current\n",
" implementations of latex/pdflatex.)\n",
@@ -4803,9 +4843,12 @@
" and turn dvi/ps modes off\n",
" -M - Show list of dependent files after processing\n",
" -MF file - Specifies name of file to receives list dependent files\n",
- " -MP - List of dependent files includes phony target for each source file.\n",
- " -makeindexfudge - change directory to output directory when running makeindex\n",
- " -makeindexfudge-- don't change directory to output directory when running makeindex\n",
+ " -MP - List of dependent files includes phony target for each source\n",
+ " file.\n",
+ " -makeindexfudge - change directory to output directory when running\n",
+ " makeindex\n",
+ " -makeindexfudge- - don't change directory to output directory when\n",
+ " running makeindex\n",
" -MSWinBackSlash under MSWin use backslash (\\) for directory separators\n",
" for filenames given to called programs\n",
" -MSWinBackSlash- under MSWin use forward slash (/) for directory separators\n",
@@ -4816,7 +4859,8 @@
" -nobibfudge or -nobibtexfudge - don't change directory when running bibtex\n",
" -nodependents - Do not show list of dependent files after processing\n",
" -noemulate-aux-dir - use -aux-directory option with *latex\n",
- " -noindexfudge or -nomakeindexfudge - don't change directory when running makeindex\n",
+ " -noindexfudge or -nomakeindexfudge - don't change directory when running\n",
+ " makeindex\n",
" -norc - omit automatic reading of system, user and project rc files\n",
" -output-directory=dir or -outdir=dir\n",
" - set name of directory for output files\n",
@@ -5187,7 +5231,7 @@
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. ",
+ warn "==== Force_mode is on, so I will continue. ",
"But there may be problems ===\n";
}
if ($control_file_missing) {
@@ -5485,10 +5529,10 @@
$ps_name = "%Z%R.ps";
$psF_name = "%Z%R.psF";
$pdf_name = "%Z%R.pdf";
- $dvi_final2 = "%X%R.pdf";
- $hnt_final2 = "%X%R.pdf";
+ $dvi_final2 = "%X%R.dvi";
+ $hnt_final2 = "%X%R.hnt";
$pdf_final2 = "%X%R.pdf";
- $ps_final2 = "%X%R.pdf";
+ $ps_final2 = "%X%R.ps";
## It would be logical for a .xdv file to be put in the out_dir,
## just like a .dvi file. But the only program, MiKTeX, that
## currently implements aux_dir, and hence allows aux_dir ne out_dir,
@@ -6293,7 +6337,7 @@
my @new_includes = ();
GRAPHICS_INCLUDE_CANDIDATE:
- while ( /<([^>]+)(>|$)/g ) {
+ while ( /<([^>\{]+)(>|\{|$)/g ) {
if ( -f $1 ) { push @new_includes, $1; }
} # GRAPHICS_INCLUDE_CANDIDATE:
@@ -6832,9 +6876,13 @@
print "$My_name: Examining '$fls_name'\n"
if not $silent;
- my $pdf_base = basename($pdf_name);
- my $log_base = basename($log_name);
- my $out_base = basename($$Pdest);
+ # For use when checking for INPUT of normal OUTPUT file:
+ my %danger_dirs = ( $aux_dir1 => 1, $out_dir1 => 1, $out2_dir1 => 1 );
+ # The keys of %vetoed are the names of INPUT files that aren't to be treated as source files.
+ # This variable is used to avoid repeated repeated warnings for the same file of this kind.
+ # Such repeats would be common, since INPUT filename lines are often repeated in the .fls file.
+ my %vetoed = ();
+
my $pwd_subst = undef; # Initial string for pwd that is to be removed to
# make relative paths, when possible. It must end
# in '/', if defined.
@@ -6865,8 +6913,10 @@
# line is UTF-8.
# So give special treatment to PWD line under Windows.
# Also to guard against any other problems, check for non-UTF-8 lines.
- if ( ($^O eq 'MSWin32') && /PWD/ && ! is_valid_utf8($_) ) { print
- "PWD line not in UTF-8. This is normal for older TeXLives (2021 and earlier).\n". "I will handle it.\n";
+ if ( ($^O eq 'MSWin32') && /PWD/ && ! is_valid_utf8($_) ) {
+ print
+ "PWD line not in UTF-8. This is normal for older TeXLives (2021 and earlier).\n".
+ " I will handle it.\n";
# Assume in CS_system, no change needed.
}
elsif ( ! is_valid_utf8($_) ) {
@@ -6914,48 +6964,99 @@
if ( (exists $$Poutputs{$file}) && (! exists $$Pinputs{$file}) ) {
$$Pfirst_read_after_write{$file} = 1;
}
- # Take precautions when the main destination file (or pdf file) or the log
- # file are listed as INPUT files in the .fls file.
- # At present, the known cases are caused by hyperxmp, which reads file metadata
- # for certain purposes (e.g., setting a current date and time, or finding the
- # pdf file size). These uses are legitimate, but the files should not be
- # treated as genuine source files for *latex.
- # Note that both the pdf and log files have in their contents strings for
- # time and date, so in general their contents don't stabilize between runs
- # of *latex. Hence adding them to the list of source files on the basis of
- # their appearance in the list of input files in the .fls file would cause
- # an incorrect infinite loop in the reruns of *latex.
+
+
+ # PRECAUTIONS for main output pdf file (and potentially others) being INPUT
+ #==========================================================================
+ #
+ # In almost all cases, the main output files (notably pdf, but
+ # also dvi, ps, xdv, hnt, and also the log file) are pure
+ # output files, and don't participate in circular dependences.
+ # However, there are known situations where at least the pdf
+ # file does. This siutation is potentially problematic, since
+ # some of these normally output-only files, including the pdf
+ # file, contain content that gives a time stamp. In a circular
+ # dependency involving such files, latexmk's normal methods
+ # give a perpetually out-of-date situation, and hence an
+ # infinite loop.
#
- # Older versions of hyperxmp (e.g., 2020/10/05 v. 5.6) reported the pdf file
- # as an input file.
- # The current version when used with xelatex reports the .log file as an
- # input file.
+ # If such a file is listed as being INPUT in the .fls file,
+ # then this needs to be detected, and special precautions
+ # taken. In the one known case where there is both such a
+ # circular dependency and the pdf file listed as INPUT in the
+ # fls file, it suffices not to put that file in the list of
+ # input files.
#
- # The test for finding the relevant .pdf (or .dvi ...) and .log files is
- # on basenames rather than full name to evade in a simple-minded way
- # alias issues with the directory part:
- if ( basename($file) eq $pdf_base ) {
- warn "$My_name: !!!!!!!!!!! Fls file lists main pdf **output** file as an input\n",
- " file for rule '$rule'. I won't treat as a source file, since that can\n",
- " lead to an infinite loop.\n",
- " This situation can be caused by the hyperxmp package in an old version,\n",
- " in which case you can ignore this message.\n";
- } elsif ( basename($file) eq $out_base ) {
- warn "$My_name: !!!!!!!!!!! Fls file lists main **output** file as an input\n",
- " file for rule '$rule'. I won't treat as a source file, since that can\n",
- " lead to an infinite loop.\n",
- " This situation can be caused by the hyperxmp package in an old version,\n",
- " in which case you can ignore this message.\n";
- } elsif ( basename($file) eq $log_base ) {
- warn "$My_name: !!!!!!!!!!! Fls file lists log file as an input file for\n",
- " rule '$rule'. I won't treat it as a source file.\n",
- " This situation can occur when the hyperxmp package is used with\n",
- " xelatex; the package reads the .log file's metadata to set current\n",
- " date and time. In this case you can safely ignore this message.\n";
- } else {
+ # Note that, in general, it is logically difficult to set up
+ # such circular dependencies within *latex to get a desired
+ # useful effect without the use of external software
+ #
+ # The known cases of the relevant kinds of circular dependency
+ # both involve the output pdf file:
+ #
+ # (a) hyperxmp in some versions, e.g., 2020/10/05 v. 5.6, reads
+ # metadata of the pdf file produced by pdflatex (to get the
+ # filesize), which results in the pdf file being reported
+ # as an INPUT file of pdflatex.
+ # Without special precautions, latexmk gets into an
+ # infinite loop. But correct functioning is achieved
+ # simply by ensuring that the pdf file is not inserted in
+ # the list of source files for *latex.
+ # More recent versions of hyperxmp work differently, and so
+ # do not cause
+ #
+ # (b) The memoize package uses non-trivial content from the pdf
+ # file. There is a clear and essential circular
+ # dependency. But given the way the package and its
+ # associated script work, the pdf file doesn't appear any
+ # where relevant to be detected by latexmk, and the package
+ # and its script take care such that all necessary reruns
+ # by latexmk get done.
+ # In addition, there is a special configuration --- see
+ # example_rcfiles/memoize_latexmkrc --- to allow memoize to
+ # be used properly with latexmk. So that doesn't entail
+ # special diagnosis here.
+ #
+ # The above illustrate that circular dependencies involving
+ # these normally output-only files can exist, legitimately. So
+ # we have to allow for the situation.
+ #
+ # The hyperxmp example shows that it does happen in reality
+ # that the main pdf output file is listed in the .fls file, and
+ # so that we do need an explicit test.
+ # But there are no other known situations for other classes of
+ # files that are normally only output (e.g., log, dvi, etc), so
+ # I'll restrict the detection to the pdf case, but in a form
+ # that can be generalized if need be.
+ #
+ # Given the vagaries of how the aux and output directories
+ # could be used, the test allows for the file being in any of
+ # the relevant directories. There is a potential issue that
+ # different strings could be used for the name of the same
+ # directories. That would entail a fancier test, but that issue
+ # has not arisen in practice so far. Since the cases where the
+ # test actually matters are already very rare, I won't handle
+ # that extra complication.
+
+ my ($base, $path, $ext) = fileparseA( $file );
+ if ( exists ($vetoed{$file}) ) {
+ }
+ elsif ( ( $base eq $root_filename )
+ && ( $ext eq '.pdf' )
+ && ( exists $danger_dirs{$path} )
+ ) {
+ warn "$My_name: !!!!!!!!!!! Fls file lists a normal output-only file\n",
+ " '$file as an input file for rule '$rule'.\n",
+ " Hence I won't treat '$file' as an input file.\n",
+ " This kind of situation can be caused by the hyperxmp package in an old\n",
+ " version, in which case you can safely ignore this message.\n";
+ $vetoed{$file} = 1;
+ }
+ else {
$$Pinputs{$file} = 1;
- }
- }
+ }
+
+ } # end of handling INPUT line
elsif (/^\s*OUTPUT\s+(.*)$/) {
# Take precautions against aliasing of foo, ./foo and other possibilities for cwd.
my $file = $1;
@@ -8124,7 +8225,7 @@
" But a non-directory file of this name exists!\n";
}
else {
- if (mkdir $dir) {
+ if (make_path_mod($dir)) {
print "$My_name: Directory '$dir' created\n";
}
else {
@@ -9313,7 +9414,7 @@
# no output files changed), either because no input files
# changed and no run was needed, or because the
# number of passes through the rule exceeded the
- # limit. In the second case $too_many_runs is set.
+ # limit. In the second case $too_many_passes was set.
rdb_for_some( [@pre_primary, $current_primary], \&rdb_make1 );
if ($switched_primary_output) {
print "=========SWITCH OF OUTPUT WAS DONE.\n";
@@ -9340,7 +9441,7 @@
}
else { last PASS; }
}
- if ($runs == 0) {
+ if ( ($runs == 0) && (! $too_many_passes) && (! $failure) ) {
# $failure not set on this pass, so use value from previous pass:
$failure = $previous_failure;
if ($retry_msg) {
@@ -9359,9 +9460,8 @@
}
rdb_for_some( [@post_primary], \&rdb_make1 );
if ( ($runs == 0) || $too_many_passes ) {
- # If $too_many_passes is set, it should also be that
- # $runs == 0; but for safety, I also checked
- # $too_many_passes.
+ # Either nothing needed to be done,
+ # and/or a rule needed to be run more than the allowed count.
last PASS;
}
}
Modified: trunk/Master/texmf-dist/doc/man/man1/latexmk.1
===================================================================
--- trunk/Master/texmf-dist/doc/man/man1/latexmk.1 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Master/texmf-dist/doc/man/man1/latexmk.1 2024-12-13 22:37:25 UTC (rev 73112)
@@ -1,4 +1,4 @@
-.TH LATEXMK 1 "7 April 2024" ""
+.TH LATEXMK 1 "11 December 2024" ""
.SH NAME
latexmk \- generate LaTeX document
.SH SYNOPSIS
@@ -488,10 +488,12 @@
.TP
.B -dvi
Generate dvi version of document using latex.
+(And turn off any incompatible requests.)
.TP
.B -dvilua
Generate dvi version of document using lualatex instead of latex.
+(And turn off any incompatible requests.)
.TP
.B -dvi-
@@ -619,8 +621,8 @@
.TP
.B -hnt
-Generate hnt (HINT) version of document using hilatex. (And turn off dvi,
-postscript, and pdf modes.)
+Generate hnt (HINT) version of document using hilatex.
+(And turn off any incompatible requests.)
.TP
.B -jobname=STRING
@@ -716,7 +718,7 @@
.TP
.B -lualatex
Use \fIlualatex\fR. That is, use \fIlualatex\fR to process the source file(s) to
-pdf. The generation of dvi and postscript files is turned off.
+pdf. The generation of dvi, hnt, postscript and xdv files is turned off.
This option is equivalent to using the following set of options
@@ -882,13 +884,13 @@
\fIlatexmk\fR emulates it in a way suitable for the context of
\fIlatexmk\fR and its workflows.
-If FORMAT is dvi, then dvi output is turned on, and postscript and pdf
+-If FORMAT is dvi, then dvi output is turned on, and postscript, pdf and xdv
output are turned off. This is equivalent to using the options \fB-dvi -ps-
--pdf-\fR.
+-pdf- -xdv-\fR.
-If FORMAT is pdf, then pdf output is turned on, and dvi and postscript
+If FORMAT is pdf, then pdf output is turned on, and dvi, postscript and xdv
output are turned off. This is equivalent to using the options \fB-pdf -ps-
--dvi-\fR.
+-dvi- -xdv-\fR.
If FORMAT is anything else, \fIlatexmk\fR gives an error.
@@ -916,7 +918,10 @@
.TP
.B -pdf
-Generate pdf version of document using \fIpdflatex\fR. (If you wish
+Generate pdf version of document using \fIpdflatex\fR.
+(And turn off any incompatible requests.)
+
+(If you wish
to use \fIlualatex\fR or \fIxelatex\fR, you can use whichever of the
options \fB-pdflua\fR, \fB-pdfxe\fR, \fB-lualatex\fR or \fB-xelatex\fR
applies.) To configure
@@ -927,6 +932,7 @@
.B -pdfdvi
Generate dvi file and then pdf version of document from the dvi file, by
default using dvipdf.
+(And turn off any incompatible requests.)
The program used to compile the document to dvi is \fIlatex\fR by default,
but this can be changed to \fIdvilulatex\fR by the use of the \fB-dvilua\fR
@@ -935,11 +941,13 @@
.TP
.B -pdflua
Generate pdf version of document using \fIlualatex\fR.
+(And turn off any incompatible requests.)
.TP
.B -pdfps
Generate dvi file, ps file from the dvi file, and then pdf file from the
ps file.
+(And turn off any incompatible requests.)
The program used to compile the document to dvi is \fIlatex\fR by default,
but this can be changed to \fIdvilulatex\fR by the use of the \fB-dvilua\fR
@@ -947,7 +955,10 @@
.TP
.B -pdfxe
-Generate pdf version of document using \fIxelatex\fR. Note that to
+Generate pdf version of document using \fIxelatex\fR.
+(And turn off any incompatible requests.)
+
+Note that to
optimize processing time, \fIlatexmk\fR uses \fIxelatex\fR to generate
an .xdv file rather than a pdf file directly. Only after possibly
multiple runs to generate a fully up-to-date .xdv file does \fIlatexmk\fR
@@ -977,8 +988,8 @@
.TP
.B -pdflatex
-This sets the generation of pdf files by \fIpdflatex\fR, and turns off the
-generation of dvi and ps files.
+Set the generation of pdf files by \fIpdflatex\fR.
+(And turn off any incompatible requests.)
\fINote: to set the \fRcommand\fI used when pdflatex is specified, see the
\fB-pdflatex="COMMAND"\fI option.\fR
@@ -1052,6 +1063,7 @@
.TP
.B -ps
Generate postscript version of document.
+(And turn off any incompatible requests.)
.TP
.B -ps-
@@ -1338,10 +1350,10 @@
Opposite of \fB-silent\fR. This is the default setting.
.TP
-.B -view=default\fR,\fB -view=dvi\fR,\fB -view=ps\fR,\fB -view=pdf\fR,\fB -view=none
+.B -view=default\fR,\fB -view=dvi\fR,\fB -view=hnt\fR,\fB -view=ps\fR,\fB -view=pdf\fR,\fB -view=none
Set the kind of file used when previewing is requested (e.g., by the
\fB-pv\fR or \fB-pvc\fR switches). The default is to view the "highest"
-kind of requested file (in the low-to-high order .dvi, .ps, .pdf).
+kind of requested file (in the low-to-high order .dvi, .hnt, .ps, .pdf).
Note the possibility \fB-view=none\fR where no viewer is opened at
all. One example of is use is in conjunction with the \fB-pvc\fR
@@ -1363,15 +1375,18 @@
.TP
.B -xdv
Generate xdv version of document using xelatex.
+(And turn off any incompatible requests.)
.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.
+Use \fIxelatex\fR. That is, use \fIxelatex\fR to process the source
+file(s). This will cause generation of a pdf (but indirectly through a xdv
+file).
+(And turn off any incompatible requests.)
-This option is equivalent to using the following set of options
+This option is equivalent to using the following option
- -pdfxe -dvi- -ps-
+ -pdfxe
[\fINote\fR: Note that the method of implementation of this option,
but not its intended primary effect, differ from some earlier versions
@@ -1393,12 +1408,12 @@
the \fB-pdfxe\fR option for why \fIlatexmk\fR makes a .xdv file rather than
a .pdf file when \fIxelatex\fR is used.
-An example of the use of the \fB-pdfxelatex\fR option:
+An example of the use of the \fB-xelatex\fR option:
- latexmk -pdfxe -pdfxelatex="xelatex --shell-escape %O %S" foo.tex
+ latexmk -pdfxe -xelatex="xelatex --shell-escape %O %S" foo.tex
\fINote: This option when provided with the COMMAND argument only sets the
-command for invoking lualatex; it does not turn on the use of
+command for invoking xelatex; it does not turn on the use of
lualatex. That is done by other options or in an initialization file.\fR
.PP
@@ -3695,6 +3710,7 @@
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".
+
.TP
.B $use_make_for_missing_files [0]
Whether to use \fImake\fR to try and make files that are missing after
@@ -3709,12 +3725,29 @@
Makefile. See the section "USING \fIlatexmk\fR WITH \fImake\fR" for
how to do this. The intent of calling \fImake\fR from \fIlatexmk\fR
is merely to detect dependencies.
+
.TP
+.B $user_deleted_file_treated_as_changed [0]
+Whether when testing for changed files, a user file that changes status
+from existing to non-existing should be regarded as changed.
+
+The default value is 0, which implies that if a user file (as opposed to a
+generated file) has been deleted since the previous run, then no
+recompilation should be done. The reasoning is that a rerun would simply
+produce an error.
+
+If the value is 1, then disappearance of a user file is treated as
+triggering a rerun, but only in non-preview-continuous mode.
+
+If the value is 2, then disappearance of a user file is treated as
+triggering a rerun, always.
+
+.TP
.B $view ["default"]
Which kind of file is to be previewed if a previewer is used. The
-possible values are "default", "dvi", "ps", "pdf". The value
+possible values are "default", "dvi", "hnt", "ps", "pdf", "none". The value
of "default" means that the "highest" of the kinds of file generated is
-to be used (among .dvi, .ps and .pdf).
+to be used (among .dvi, .hnt, .ps and .pdf).
.TP
.B $warnings_as_errors [0]
@@ -4214,7 +4247,7 @@
In simple cases, the subroutine can be an anonymous subroutine defined in
the call to add_hooks,
- add_hook( 'after_main_pdf', sub{ print \"TEST\\n\"; return 0; } );
+ add_hook( 'after_main_pdf', sub{ print "TEST\\n"; return 0; } );
Observe that on success, the subroutine should return 0 (like a call to
Perl's system subroutine), so normally this should be coded explicitly. If
@@ -4718,7 +4751,7 @@
harvested too easily.)
.SH AUTHOR
Current version, by John Collins
-(Version 4.85).
+(Version 4.86).
Report bugs etc to his e-mail (jcc8 at psu.edu).
Released version can be obtained from CTAN:
Modified: trunk/Master/texmf-dist/doc/man/man1/latexmk.man1.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/support/latexmk/CHANGES
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexmk/CHANGES 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Master/texmf-dist/doc/support/latexmk/CHANGES 2024-12-13 22:37:25 UTC (rev 73112)
@@ -926,3 +926,23 @@
reported an error, and latexmk treated that incorrectly as a fatal
error.
+From v. 4.85 to 4.86
+ Document variable $user_deleted_file_treated_as_changed.
+ Correct problems when main pdf output file is detected as an INPUT file in
+ the .fls file. (That sometimes affected dependency detection of
+ included graphics files with the same basename as the main .tex
+ document.)
+ Updates to example_rcfiles/xr_latexmkrc, example_rcfiles/pythontex_latexmkrc,
+ example_rcfiles/splitindex_latexmkrc, example_rcfiles/bib2gls_latexmkrc.
+ Correct detection of graphics includes in .log file.
+ Apply autoflush to STDOUT, so that when STDERR and STDOUT are redirected
+ to the same place, the output is correctly ordered.
+ Add base name to the list of items reported with the -dir-report and
+ -dir-report-only options.
+ With -dir-report-only make report for each tex file to be processed.
+ Fix failure of -c and -C with $cleanup_includes_generated = 1; when
+ engine is lualatex or hilatex.
+ Documentation updates.
+ Correct problem that necessary necessary directory/ies not created in aux
+ dir when \include'd file has more than one level of subdirectory.
+ Correct message about up-to-date files when $max_repeat runs exceeded.
Modified: trunk/Master/texmf-dist/doc/support/latexmk/INSTALL
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexmk/INSTALL 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Master/texmf-dist/doc/support/latexmk/INSTALL 2024-12-13 22:37:25 UTC (rev 73112)
@@ -1,6 +1,6 @@
INSTALLING latexmk
==================
- (Version 4.85, 7 Apr. 2024)
+ (Version 4.86, 11 Dec. 2024)
John Collins
Physics Department
Modified: trunk/Master/texmf-dist/doc/support/latexmk/README
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexmk/README 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Master/texmf-dist/doc/support/latexmk/README 2024-12-13 22:37:25 UTC (rev 73112)
@@ -1,5 +1,5 @@
-Latexmk, version 4.85, 7 Apr 2024
----------------------------------
+Latexmk, version 4.86, 11 Dec 2024
+----------------------------------
Latexmk completely automates the process of generating a LaTeX
document. Essentially, it is a highly specialized cousin of the
Modified: trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/bib2gls_latexmkrc
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/bib2gls_latexmkrc 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/bib2gls_latexmkrc 2024-12-13 22:37:25 UTC (rev 73112)
@@ -1,51 +1,61 @@
# Implements use of bib2gls with glossaries-extra.
-# Version of 4 Feb 2024.
+# Version of 14 Oct 2024.
# Thanks to Marcel Ilg for a suggestion.
-# !!! ONLY WORKS WITH VERSION 4.54 or higher of latexmk
+push @generated_exts, 'glg', '%R*.glstex';
-push @generated_exts, 'glstex', 'glg';
-
# For case that \GlsXtrLoadResources is used and so glstex file (first one)
# has same name as .aux file.
-add_cus_dep('aux', 'glstex', 0, 'run_bib2gls');
+add_cus_dep( 'aux', 'glstex', 0, 'run_bib2gls' );
# For case that \glsxtrresourcefile is used and so glstex file (first one)
# has same name as .bib file.
-add_cus_dep('bib', 'glstex', 0, 'run_bib2gls_alt');
+add_cus_dep( 'bib', 'glstex', 0, 'run_bib2gls_alt' );
sub run_bib2gls {
my $ret = 0;
- if ( $silent ) {
- $ret = system "bib2gls --silent --group '$_[0]'";
- } else {
- $ret = system "bib2gls --group '$_[0]'";
- };
-
- # bib2gls puts output files in current directory.
- # At least put main glstex in same directory as aux file to satisfy
- # definition of custom dependency.
my ($base, $path) = fileparse( $_[0] );
- if ($path && -e "$base.glstex") {
- rename "$base.glstex", "$path$base.glstex";
- }
-
+ # Default encoding assumed by bib2gls is the system CS, which on
+ # Windows is normally *not* CP65001 (aka UTF-8). But the aux and log
+ # files are UTF-8, at least with the default settings of TeX Live.
+ # So we tell bib2gls about this.
+ # With the options as given here, the .glg will be encoded in the system
+ # CS, which will be suitable for latexmk's use, since that is the CS for
+ # communicating with the file system.
+ # (**Warning**, it is simpler to do this rather than using, the option
+ # --default-encoding to set everything to UTF-8, for then that would
+ # apply also to the .glg, which would entail having to convert filenames
+ # in the .glg file to the system CS.)
+ my @bib2gls_cmd = (
+ "--tex-encoding", "UTF-8",
+ "--log-encoding", "UTF-8",
+ "--group",
+ "--dir",
+ $path,
+ $base
+ );
+ if ($silent) { unshift @bib2gls_cmd, "--silent"; }
+ unshift @bib2gls_cmd, "bib2gls";
+ print "Running '@bib2gls_cmd'...\n";
+ $ret = system @bib2gls_cmd;
+
if ($ret) {
warn "Run_bib2gls: Error, so I won't analyze .glg file\n";
return $ret;
}
- # Analyze log file.
- my $log = "$_[0].glg";
- if ( open( my $log_fh, '<', $log) ) {
- while (<$log_fh>) {
+ # Analyze bib2gls's log file:
+ my $glg = "$_[0].glg";
+ if ( open( my $glg_fh, '<', $glg) ) {
+ rdb_add_generated( $glg );
+ while (<$glg_fh>) {
s/\s*$//;
if (/^Reading\s+(.+)$/) { rdb_ensure_file( $rule, $1 ); }
if (/^Writing\s+(.+)$/) { rdb_add_generated( $1 ); }
}
- close $log_fh;
+ close $glg_fh;
}
else {
- warn "Run_bib2gls: Cannot read log file '$log': $!\n";
+ warn "Run_bib2gls: Cannot read log file '$glg': $!\n";
}
return $ret;
}
Modified: trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/pythontex-latexmkrc 2024-12-13 22:37:25 UTC (rev 73112)
@@ -1,16 +1,24 @@
# Support for pythontex in v. 0.16 or higher, with latexmk 4.62 or higher
#
# What these definitions provide/do:
-# 1. Variable specifying command string for invoking pythontex
+# 1. Variable specifying command string for invoking the pythontex program.
# 2. Addition to %extra_rule_spec of template for pythontex rule. This
-# tells latexmkrc to create the rule when it is initializing for
-# processing a TeX file.
+# tells latexmk to create the rule when it is initializing its rule
+# network for processing a .tex file.
# 3. A subroutine mypythontex that the pythontex rule is defined to
# call. This runs pythontex and then sets dependency information.
# 4. Settings for the files generated by the pythontex package and the
# pythontex program so that the files are deleted in a clean-up
# operation.
+#
+# 5. There are two parts to the dependency information
+# a. The files **generated** by pythontex.
+# This happens without any special assistance from the document.
+# b. The files **read** by python.
+# At present this needs support with some code in the document.
+# See the document at the end of this file for an example.
+
$clean_ext .= " pythontex-files-%R/* pythontex-files-%R";
push @generated_exts, 'pytxcode';
@@ -44,3 +52,53 @@
}
return $ret;
}
+
+# ==============================================
+# Sample document that writes dependency information
+# To use it you need to save this file as e.g., test.tex,
+# and to create a data file name data.txt, with whatever content you like.
+#
+#\documentclass{article}
+#\usepackage{pythontex}
+#
+#%================
+#% Macro to write list of dependent files to where latexmk will find it,
+#% when configured with the code in pythontex_latexmkrc.
+#\newcommand{\pycachedeps}{\py{cache_dependencies()}}
+#%\AtEndDocument{\pycachedeps}
+#
+#% Python code used by above.
+#\begin{pycode}
+#def cache_dependencies():
+# s = '';
+# for item in pytex._dependencies:
+# s += "%PythonTeX dependency: '" + item + "';\n"
+# return s;
+#\end{pycode}
+#%================
+#
+#\begin{document}
+#
+#Test of using pythontex with dependency information.
+#
+#% Python code to access a particular file, together with use of a pythontex
+#% subroutine to add the file to pythontex's list of source files.
+#\begin{pycode}
+#pytex.add_dependencies("data.txt")
+#n = "data.txt"
+#f = open( n, "r" )
+#print( "From '", n, "', first line is: \\\\", f.readline(), "" )
+#f.close
+#\end{pycode}
+#
+#A big loop, which takes a few seconds to run in python. This is just to illustra
+#\begin{pycode}
+#j = -20
+#for i in range(0,15000000):
+# j = j + i
+#print(j)
+#\end{pycode}
+#
+#% Cache dependencies (in .pytxmcr file):
+#\pycachedeps
+#\end{document}
Modified: trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/splitindex_latexmkrc
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/splitindex_latexmkrc 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/splitindex_latexmkrc 2024-12-13 22:37:25 UTC (rev 73112)
@@ -1,32 +1,112 @@
-$makeindex = 'internal splitindex2 %S %D %R %B %O';
+# Definitions for use of splitindex package: Arrange to use the splitindex
+# program instead of makeindex when needed, otherwise to do standard run of
+# makeindex.
+
+# John Collins and Ernst Reissner, 2024-09-27.
+
+
+# Specify extra files that need to be cleaned up when splitindex is in use:
$clean_ext .= " %R-*.ind %R-*.idx %R-*.ilg %R-*.ind";
-sub splitindex2 {
- # Use splitindex instead of makeindex.
- # The splitindex programe starts from an .idx file, makes a set of
- # other .idx files for separate indexes, and then runs makeindex to
- # make corresponding .ind files.
- # However, it is possible that the document uses the splitindex
- # package, but in a way compatible with the standard methods
- # compatible with makeindex, i.e., with a single index and with the
- # use of the \printindex command.
- # Then we need to invoke makeindex.
- # In addition, latexmk assumes that makeindex or its replacement makes
- # an .ind file from an .idx file, and latexmk gives an error if it
- # doesn't exist, so we need to make an .ind file.
- # Both problems are solved by running makeindex and then splitindex.
- # Note: errors are returned by makeindex and splitindex for things
- # like a missing input file. No error is returned for lines in an
- # input file that are in an incorrect format; they are simply
- # ignored. So no problem is caused by lines in the .idx file
- # that are generated by splitindex in a format incompatible with
- # makeindex.
- my ($source, $dest, $root, $base, @opts) = @_;
+# Use an internal subroutine to do the processing. **Important**: Pass the
+# name of the source file, etc as arguments obtained by place-holder
+# substitution instead of having the subroutine use variables like
+# $$Psource. This is because by default latexmk temporarily changes
+# directory to the aux directory before the invoking the command (or
+# whatever) specified by $makeindex. The change of directory is to avoid
+# some deficiencies in the standard makeindex program. See the latexmk
+# documentation for further information. After the change of directory, the
+# value of $$Psource will typically be wrong. Instead we use placeholders
+# for the relevant quantities, since after doing the change of directory,
+# latexmk's internal processing adjusts the substitutions for %S, %D etc
+# appropriately. Also, include the string for aux_dir in the arguments, as
+# needed for the treatment of dependencies.
- my $ret1 = system( "makeindex", $source );
- my $ret2 = system( "splitindex", $source );
- return $ret1 || $ret2;
+$makeindex = 'internal splitindex3 %S %D %Y %R %B %O';
+
+#-------------
+
+sub HaveMultiIdx {
+ # Subroutine to test whether (.idx) file has entries of the form given by
+ # splitindex package with multiple indexes.
+ use strict;
+ my $fileName = $_[0];
+
+ # Use a precompiled RE:
+ my $patternMultiIndex = qr/^\\indexentry\[[^\]]*\]\{/;
+
+ my $info;
+ if (! open $info, '<', $fileName ) {
+ die "In splitindex processing, the file '$fileName' was supposed to\n",
+ "exist, but I could not read it:\n$!";
+ return 0;
+ }
+ while (my $line = <$info>) {
+ if ( $line =~ $patternMultiIndex ) {
+ # We have a multi-index
+ close $info;
+ return 1;
+ }
+ }
+ close $info;
+ # There was no multi-index:
+ return 0;
}
+#-------------
-print "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n";
\ No newline at end of file
+sub splitindex3 {
+ use strict;
+ my ($source, $dest, $auxdir, $root, $base, @opts) = @_;
+
+ if (! HaveMultiIdx($source)) {
+ print "Running standard makeindex program:\n";
+ return system( "makeindex", @opts, '-o', $dest, $source );
+ }
+ # Else:
+ print "Running splitindex program:\n";
+
+ # Ensure dummy file for standard destination file exists, so that
+ # latexmk is satisfied that its expectation for the main generated file
+ # is satisfied.
+ open( my $ind_fh, '>>', $dest );
+ close $ind_fh;
+
+ # Arrange to obtain dependency information from splitindex by invoking
+ # it in a verbose mode, and redirecting its output to the standard .ilg
+ # file, and later parsing it for the relevant lines.
+ my $ilg = $dest;
+ $ilg =~ s/\.[^\.]+$/\.ilg/;
+ my $ret2 = system "splitindex -v -v \"$source\" >> \"$ilg\"";
+ if ($ret2) { return $ret2;}
+
+
+ my $ilg_fh;
+ if (! open( $ilg_fh, '<', $ilg ) ) {
+ warn "In sub splitindex, could not read '$ilg'\n";
+ return 1;
+ }
+ while (<$ilg_fh>) {
+ if ( /^New index file (.*)\s*$/ ) {
+ # .idx file generated by splitindex
+ my $idx = $1;
+ # Ensure path to idx file is correct if we've done the change of
+ # directory caused by the setting of $makeindex_fudge:
+ if ($makeindex_fudge) { $idx = $auxdir.$idx; }
+ # In addition to the .idx files that the splitindex program
+ # reports that it generates, there are corresponding .ind files
+ # generated by the instances of makeindex that are invoked by
+ # splitindex. These are important to latexmk's knowledge of
+ # the network of dependencies because they are read in by the
+ # next run of *latex.
+ my $ind = $idx;
+ $ind =~ s/\.idx$/\.ind/;
+ print "splitindex generated files '$idx' '$ind'\n";
+ rdb_add_generated( $ind, $idx );
+ }
+ }
+ close $ilg_fh;
+ return $ret2;
+}
+
+#-------------
Modified: trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xr_latexmkrc
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xr_latexmkrc 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Master/texmf-dist/doc/support/latexmk/example_rcfiles/xr_latexmkrc 2024-12-13 22:37:25 UTC (rev 73112)
@@ -1,5 +1,5 @@
# This shows how to use the xr package with latexmk.
-# John Collins 2023-03-29
+# John Collins 2023-06-25
#
# The xr package ("a system for eXternal References") is used by a document
# to make references to sections, equations, etc in other external
@@ -43,7 +43,7 @@
#--------------------
# Add a pattern for xr's log-file message about missing files to latexmk's
-# list. Latexmk's variable @file_not_found is not yet documented.
+# list.
# This line isn't necessary for v. 4.80 or later of latexmk.
push @file_not_found, '^No file\\s*(.+)\s*$';
@@ -57,7 +57,7 @@
"-aux-directory=$sub_doc_output",
"-output-directory=$sub_doc_output",
$base_name;
- if ( ($sub_doc_output ne ' ') && ($sub_doc_output ne '.') ) {
+ if ( ($sub_doc_output ne '') && ($sub_doc_output ne '.') ) {
# In this case, .aux file generated by pdflatex isn't in same
# directory as the .tex file.
# Therefore:
Modified: trunk/Master/texmf-dist/doc/support/latexmk/latexmk.pdf
===================================================================
(Binary files differ)
Modified: trunk/Master/texmf-dist/doc/support/latexmk/latexmk.txt
===================================================================
--- trunk/Master/texmf-dist/doc/support/latexmk/latexmk.txt 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Master/texmf-dist/doc/support/latexmk/latexmk.txt 2024-12-13 22:37:25 UTC (rev 73112)
@@ -61,7 +61,7 @@
- 7 April 2024 1
+ 11 December 2024 1
@@ -127,7 +127,7 @@
- 7 April 2024 2
+ 11 December 2024 2
@@ -193,7 +193,7 @@
- 7 April 2024 3
+ 11 December 2024 3
@@ -259,7 +259,7 @@
- 7 April 2024 4
+ 11 December 2024 4
@@ -325,7 +325,7 @@
- 7 April 2024 5
+ 11 December 2024 5
@@ -391,7 +391,7 @@
- 7 April 2024 6
+ 11 December 2024 6
@@ -457,7 +457,7 @@
- 7 April 2024 7
+ 11 December 2024 7
@@ -523,7 +523,7 @@
- 7 April 2024 8
+ 11 December 2024 8
@@ -568,12 +568,13 @@
ily used for debugging configuration issues.
- -dvi Generate dvi version of document using latex.
+ -dvi Generate dvi version of document using latex. (And turn off any
+ incompatible requests.)
-dvilua
Generate dvi version of document using lualatex instead of la-
- tex.
+ tex. (And turn off any incompatible requests.)
-dvi- Turn off generation of dvi version of document. (This may get
@@ -585,11 +586,10 @@
-dvilualatex="COMMAND"
This sets the string specifying the command to run dvi lualatex.
It behaves like the -pdflatex option, but sets the variable
- $dvilualatex.
- 7 April 2024 9
+ 11 December 2024 9
@@ -598,6 +598,8 @@
LATEXMK(1) General Commands Manual LATEXMK(1)
+ $dvilualatex.
+
Note: This option when provided with the COMMAND argument only
sets the command for invoking dvilualatex; it does not turn on
the use of dvilualatex. That is done by other options or in an
@@ -650,20 +652,21 @@
(Note: the above examples show are to show how to use the -e to
specify initialization code to be executed. But the particular
effect can be achieved also by the use of the -latex option with
- less problems in dealing with quoting.)
+ 11 December 2024 10
- 7 April 2024 10
-
LATEXMK(1) General Commands Manual LATEXMK(1)
+ less problems in dealing with quoting.)
+
+
-emulate-aux-dir
Emulate the use of an aux directory instead of leaving it to the
*latex programs to do it. (MiKTeX supports -aux-directory, but
@@ -715,23 +718,24 @@
-C had been given, and then do a regular make.
- -h or-non-help
- Print help information.
+ 11 December 2024 11
- 7 April 2024 11
-
LATEXMK(1) General Commands Manual LATEXMK(1)
+ -h or-non-help
+ Print help information.
+
+
-hnt Generate hnt (HINT) version of document using hilatex. (And
- turn off dvi, postscript, and pdf modes.)
+ turn off any incompatible requests.)
-jobname=STRING
@@ -781,19 +785,19 @@
-latex This sets the generation of dvi files by latex, and turns off
the generation of pdf and ps files.
- Note: to set the command used when latex is specified, see the
- -latex="COMMAND" option.
+ 11 December 2024 12
- 7 April 2024 12
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ Note: to set the command used when latex is specified, see the
+ -latex="COMMAND" option.
-latex="COMMAND"
@@ -835,8 +839,8 @@
-lualatex
Use lualatex. That is, use lualatex to process the source
- file(s) to pdf. The generation of dvi and postscript files is
- turned off.
+ file(s) to pdf. The generation of dvi, hnt, postscript and xdv
+ files is turned off.
This option is equivalent to using the following set of options
@@ -847,46 +851,45 @@
of latexmk.)
- -lualatex="COMMAND"
- This sets the string specifying the command to run lualatex. It
- behaves like the -pdflatex option, but sets the variable
+ 11 December 2024 13
- 7 April 2024 13
-
LATEXMK(1) General Commands Manual LATEXMK(1)
- $lualatex.
+ -lualatex="COMMAND"
+ This sets the string specifying the command to run lualatex. It
+ behaves like the -pdflatex option, but sets the variable $luala-
+ tex.
- Note: This option when provided with the COMMAND argument only
- sets the command for invoking lualatex; it does not turn on the
+ Note: This option when provided with the COMMAND argument only
+ sets the command for invoking lualatex; it does not turn on the
use of lualatex. That is done by other options or in an initial-
ization file.
- -M Show list of dependent files after processing. This is equiva-
+ -M Show list of dependent files after processing. This is equiva-
lent to the -deps option.
-MF file
- If a list of dependents is made, the -MF specifies the file to
+ If a list of dependents is made, the -MF specifies the file to
write it to.
-MP If a list of dependents is made, include a phony target for each
- source file. If you use the dependents list in a Makefile, the
+ source file. If you use the dependents list in a Makefile, the
dummy rules work around errors the program make gives if you re-
move header files without updating the Makefile to match.
-makeindexfudge
- Turn on the change-directory fudge for makeindex. See documen-
+ Turn on the change-directory fudge for makeindex. See documen-
tation of $makeindex_fudge for details.
@@ -902,33 +905,34 @@
-MSWinBackSlash
This option only has an effect when latexmk is running under MS-
Windows. This is that when latexmk runs a command under MS-Win-
- dows, the Windows standard directory separator "\" is used to
- separate directory components in a file name. Internally, la-
- texmk uses "/" for the directory separator character, which is
+ dows, the Windows standard directory separator "\" is used to
+ separate directory components in a file name. Internally, la-
+ texmk uses "/" for the directory separator character, which is
the character used by Unix-like systems.
This is the default behavior. However the default may have been
- overridden by a configuration file (latexmkrc file) which sets
+ overridden by a configuration file (latexmkrc file) which sets
$MSWin_back_slash=0.
- -MSWinBackSlash-
- This option only has an effect when latexmk is running under MS-
- Windows. This is that when latexmk runs a command under MS-Win-
- dows, the substitution of "\" for the separator character
- 7 April 2024 14
+ 11 December 2024 14
+
LATEXMK(1) General Commands Manual LATEXMK(1)
- between directory components of a file name is not done. Instead
+ -MSWinBackSlash-
+ This option only has an effect when latexmk is running under MS-
+ Windows. This is that when latexmk runs a command under MS-Win-
+ dows, the substitution of "\" for the separator character be-
+ tween directory components of a file name is not done. Instead
the forward slash "/" is used, the same as on Unix-like systems.
This is acceptable in most situations under MS-Windows, provided
that filenames are properly quoted, as latexmk does by default.
@@ -980,20 +984,18 @@
on first, no matter where it occurs on the command line.
- -outdir=FOO or -output-directory=FOO
+ 11 December 2024 15
- 7 April 2024 15
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ -outdir=FOO or -output-directory=FOO
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
Sets the directory for the output files of *latex.
If the aux directory is not set or is the same as the output di-
@@ -1041,17 +1043,15 @@
texmk emulates it in a way suitable for the context of latexmk
and its workflows.
- If FORMAT is dvi, then dvi output is turned on, and postscript
- and pdf output are turned off. This is equivalent to using the
- options -dvi -ps- -pdf-.
+ -If FORMAT is dvi, then dvi output is turned on, and postscript,
+ pdf and xdv output are turned off. This is equivalent to using
+ the options -dvi -ps- -pdf- -xdv-.
- If FORMAT is pdf, then pdf output is turned on, and dvi and
- postscript output are turned off. This is equivalent to using
- the options -pdf -ps- -dvi-.
+ If FORMAT is pdf, then pdf output is turned on, and dvi,
- 7 April 2024 16
+ 11 December 2024 16
@@ -1060,22 +1060,25 @@
LATEXMK(1) General Commands Manual LATEXMK(1)
+ postscript and xdv output are turned off. This is equivalent to
+ using the options -pdf -ps- -dvi- -xdv-.
+
If FORMAT is anything else, latexmk gives an error.
- -p Print out the document. By default the file to be printed is
- the first in the list postscript, pdf, dvi that is being made.
+ -p Print out the document. By default the file to be printed is
+ the first in the list postscript, pdf, dvi that is being made.
But you can use the -print=... option to change the type of file
to be printed, and you can configure this in a start up file (by
setting the $print_type variable).
- However, printing is enabled by default only under UNIX/Linux
+ However, printing is enabled by default only under UNIX/Linux
systems, where the default is to use the lpr command and only on
postscript files. In general, the correct behavior for printing
very much depends on your system's software. In particular, un-
- der MS-Windows you must have suitable program(s) available, and
- you must have configured the print commands used by latexmk.
- This can be non-trivial. See the documentation on the $lpr,
+ der MS-Windows you must have suitable program(s) available, and
+ you must have configured the print commands used by latexmk.
+ This can be non-trivial. See the documentation on the $lpr,
$lpr_dvi, and $lpr_pdf configuration variables to see how to set
the commands for printing.
@@ -1083,52 +1086,59 @@
turns them off.
- -pdf Generate pdf version of document using pdflatex. (If you wish
- to use lualatex or xelatex, you can use whichever of the options
- -pdflua, -pdfxe, -lualatex or -xelatex applies.) To configure
- latexmk to have such behavior by default, see the section on
- "Configuration/initialization (rc) files".
+ -pdf Generate pdf version of document using pdflatex. (And turn off
+ any incompatible requests.)
+ (If you wish to use lualatex or xelatex, you can use whichever
+ of the options -pdflua, -pdfxe, -lualatex or -xelatex applies.)
+ To configure latexmk to have such behavior by default, see the
+ section on "Configuration/initialization (rc) files".
+
-pdfdvi
Generate dvi file and then pdf version of document from the dvi
- file, by default using dvipdf.
+ file, by default using dvipdf. (And turn off any incompatible
+ requests.)
- The program used to compile the document to dvi is latex by de-
- fault, but this can be changed to dvilulatex by the use of the
+ The program used to compile the document to dvi is latex by de-
+ fault, but this can be changed to dvilulatex by the use of the
-dvilua option or by setting $dvi_mode to 2.
-pdflua
- Generate pdf version of document using lualatex.
+ Generate pdf version of document using lualatex. (And turn off
+ any incompatible requests.)
-pdfps Generate dvi file, ps file from the dvi file, and then pdf file
- from the ps file.
+ from the ps file. (And turn off any incompatible requests.)
- The program used to compile the document to dvi is latex by de-
- fault, but this can be changed to dvilulatex by the use of the
- -dvilua option or by setting $dvi_mode to 2.
+ The program used to compile the document to dvi is latex by
- -pdfxe Generate pdf version of document using xelatex. Note that to
- optimize processing time, latexmk uses xelatex to generate an
- .xdv file rather than a pdf file directly. Only after possibly
+ 11 December 2024 17
- 7 April 2024 17
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ default, but this can be changed to dvilulatex by the use of the
+ -dvilua option or by setting $dvi_mode to 2.
- multiple runs to generate a fully up-to-date .xdv file does la-
- texmk then call xdvipdfmx to generate the final .pdf file.
+ -pdfxe Generate pdf version of document using xelatex. (And turn off
+ any incompatible requests.)
+ Note that to optimize processing time, latexmk uses xelatex to
+ generate an .xdv file rather than a pdf file directly. Only af-
+ ter possibly multiple runs to generate a fully up-to-date .xdv
+ file does latexmk then call xdvipdfmx to generate the final .pdf
+ file.
+
(Note: The reason why latexmk arranges for xelatex to make an
.xdv file instead of the xelatex's default of a .pdf file is as
follows: When the document includes large graphics files, espe-
@@ -1152,10 +1162,10 @@
-pdflatex
- This sets the generation of pdf files by pdflatex, and turns off
- the generation of dvi and ps files.
+ Set the generation of pdf files by pdflatex. (And turn off any
+ incompatible requests.)
- Note: to set the command used when pdflatex is specified, see
+ Note: to set the command used when pdflatex is specified, see
the -pdflatex="COMMAND" option.
@@ -1167,31 +1177,31 @@
latexmk -pdf -pdflatex="pdflatex --shell-escape %O %S"
foo.tex
- The specification of the contents of the string are the same as
+ The specification of the contents of the string are the same as
for the $pdflatex configuration variable. (The option -pdflatex
- in fact sets the variable $pdflatex.) Depending on your operat-
- ing system and the command-line shell you are using, you may
- need to change the single quotes to double quotes (or something
- else).
+ in fact sets the variable $pdflatex.) Depending on your
- Note: This option when provided with the COMMAND argument only
- sets the command for invoking pdflatex; it does not turn on the
- use of pdflatex. That is done by other options or in an initial-
- ization file.
- To set the command for running latex (rather than the command
+ 11 December 2024 18
- 7 April 2024 18
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ operating system and the command-line shell you are using, you
+ may need to change the single quotes to double quotes (or some-
+ thing else).
+ Note: This option when provided with the COMMAND argument only
+ sets the command for invoking pdflatex; it does not turn on the
+ use of pdflatex. That is done by other options or in an initial-
+ ization file.
+ To set the command for running latex (rather than the command
for pdflatex) see the -latex option.
@@ -1238,28 +1248,28 @@
to be made is the one used for print out.
- -ps Generate postscript version of document.
+ 11 December 2024 19
- -ps- Turn off generation of postscript version of document. This can
- be used to override a setting in a configuration file. (It may
- get overridden by some other option that requires a postscript
- file, for example a request for printing.)
- 7 April 2024 19
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ -ps Generate postscript version of document. (And turn off any in-
+ compatible requests.)
+ -ps- Turn off generation of postscript version of document. This can
+ be used to override a setting in a configuration file. (It may
+ get overridden by some other option that requires a postscript
+ file, for example a request for printing.)
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
- -pF Postscript file filtering. The argument to this option is a
- filter which will generate a filtered postscript file with the
+ -pF Postscript file filtering. The argument to this option is a
+ filter which will generate a filtered postscript file with the
extension ".psF". All extra processing (e.g. preview, printing)
will then be performed on this filtered postscript file.
@@ -1272,15 +1282,15 @@
latexmk -ps -pF "psnup -2" foo.tex
Whether to use single or double quotes round the "psnup -2" will
- depend on your command interpreter, as used by the particular
+ depend on your command interpreter, as used by the particular
version of perl and the operating system on your computer.
- -pv Run file previewer. If the -view option is used, that will se-
+ -pv Run file previewer. If the -view option is used, that will se-
lect the kind of file to be previewed (.pdf, .ps or .dvi). Oth-
- erwise the viewer views the "highest" kind of output file that
- is made, with the ordering being .pdf, .ps, .dvi (high to low).
- This option is incompatible with the -p and -pvc options, so it
+ erwise the viewer views the "highest" kind of output file that
+ is made, with the ordering being .pdf, .ps, .dvi (high to low).
+ This option is incompatible with the -p and -pvc options, so it
turns them off.
@@ -1287,55 +1297,55 @@
-pv- Turn off -pv.
- -pvc Run a file previewer and continually update the .dvi, .ps,
+ -pvc Run a file previewer and continually update the .dvi, .ps,
and/or .pdf files whenever changes are made to source files (see
- the Description above). Which of these files is generated and
- which is viewed is governed by the other options, and is the
- same as for the -pv option. The preview-continuous option -pvc
- can only work with one file. So in this case you will normally
- only specify one filename on the command line. It is also in-
- compatible with the -p and -pv options, so it turns these op-
+ the Description above). Which of these files is generated and
+ which is viewed is governed by the other options, and is the
+ same as for the -pv option. The preview-continuous option -pvc
+ can only work with one file. So in this case you will normally
+ only specify one filename on the command line. It is also in-
+ compatible with the -p and -pv options, so it turns these op-
tions off.
- The -pvc option also turns off force mode (-f), as is normally
- best for continuous preview mode. If you really want force
+ The -pvc option also turns off force mode (-f), as is normally
+ best for continuous preview mode. If you really want force
mode, use the options in the order -pvc -f.
With a good previewer the display will be automatically updated.
- (Under some but not all versions of UNIX/Linux "gv -watch" does
- this for postscript files; this can be set by a configuration
- variable. This would also work for pdf files except for an ap-
- parent bug in gv that causes an error when the newly updated pdf
- file is read.) Many other previewers will need a manual update.
- Important note: the acroread program on MS-Windows locks the pdf
- file, and prevents new versions being written, so it is a bad
- idea to use acroread to view pdf files in preview-continuous
- mode. It is better to use a different viewer: SumatraPDF and
+ 11 December 2024 20
- 7 April 2024 20
-
LATEXMK(1) General Commands Manual LATEXMK(1)
+ (Under some but not all versions of UNIX/Linux "gv -watch" does
+ this for postscript files; this can be set by a configuration
+ variable. This would also work for pdf files except for an ap-
+ parent bug in gv that causes an error when the newly updated pdf
+ file is read.) Many other previewers will need a manual update.
+
+ Important note: the acroread program on MS-Windows locks the pdf
+ file, and prevents new versions being written, so it is a bad
+ idea to use acroread to view pdf files in preview-continuous
+ mode. It is better to use a different viewer: SumatraPDF and
gsview are good possibilities.
- There are some other methods for arranging an update, notably
- useful for many versions of xdvi and xpdf. These are best set
+ There are some other methods for arranging an update, notably
+ useful for many versions of xdvi and xpdf. These are best set
in latexmk's configuration; see below.
- Note that if latexmk dies or is stopped by the user, the
+ Note that if latexmk dies or is stopped by the user, the
"forked" previewer will continue to run. Successive invocations
- with the -pvc option will not fork new previewers, but latexmk
- will normally use the existing previewer. (At least this will
- happen when latexmk is running under an operating system where
- it knows how to determine whether an existing previewer is run-
+ with the -pvc option will not fork new previewers, but latexmk
+ will normally use the existing previewer. (At least this will
+ happen when latexmk is running under an operating system where
+ it knows how to determine whether an existing previewer is run-
ning.)
@@ -1343,9 +1353,9 @@
-pvctimeout
- Do timeout in pvc mode after period of inactivity, which is 30
+ Do timeout in pvc mode after period of inactivity, which is 30
min. by default. Inactivity means a period when latexmk has de-
- tected no file changes and hence has not taken any actions like
+ tected no file changes and hence has not taken any actions like
compiling the document.
@@ -1361,43 +1371,43 @@
-r <rcfile>
- Read the specified initialization file ("RC file") before pro-
+ Read the specified initialization file ("RC file") before pro-
cessing.
Be careful about the ordering: (1) Standard initialization files
- -- see the section below on "Configuration/initialization (RC)
- files" -- are read first. (2) Then the options on the command
- line are acted on in the order they are given. Therefore if an
- initialization file is specified by the -r option, it is read
- during this second step. Thus an initialization file specified
- with the -r option can override both the standard initialization
- files and previously specified options. But all of these can be
- overridden by later options.
+ -- see the section below on "Configuration/initialization (RC)
+ files" -- are read first. (2) Then the options on the command
+ line are acted on in the order they are given. Therefore if an
- The contents of the RC file just comprise a piece of code in the
- Perl programming language (typically a sequence of assignment
- statements); they are executed when the -r option is encountered
- during latexmk's parsing of its command line. See the -e option
+ 11 December 2024 21
- 7 April 2024 21
-
LATEXMK(1) General Commands Manual LATEXMK(1)
- for a way of giving initialization code directly on latexmk's
- command line. An error results in latexmk stopping. Multiple
+ initialization file is specified by the -r option, it is read
+ during this second step. Thus an initialization file specified
+ with the -r option can override both the standard initialization
+ files and previously specified options. But all of these can be
+ overridden by later options.
+
+ The contents of the RC file just comprise a piece of code in the
+ Perl programming language (typically a sequence of assignment
+ statements); they are executed when the -r option is encountered
+ during latexmk's parsing of its command line. See the -e option
+ for a way of giving initialization code directly on latexmk's
+ command line. An error results in latexmk stopping. Multiple
instances of the -r and -e options can be used, and they are ex-
ecuted in the order they appear on the command line.
-rc-report
- After initialization, give a list of the RC files read. (De-
+ After initialization, give a list of the RC files read. (De-
fault)
@@ -1406,10 +1416,10 @@
-recorder
- Give the -recorder option with *latex. In (most) modern ver-
- sions of these programs, this 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
+ Give the -recorder option with *latex. In (most) modern ver-
+ sions of these programs, this 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. This is the default setting of latexmk, unless overrid-
den in an initialization file.
@@ -1426,135 +1436,137 @@
-rules-
- Do not show a list of latexmk's rules and dependencies after
+ Do not show a list of latexmk's rules and dependencies after
processing. (This is the default.)
-showextraoptions
- Show the list of extra *latex options that latexmk recognizes,
- but that it simply passes through to the programs *latex when
- they are run. These options are (currently) a combination of
- those allowed by the TeXLive and MiKTeX implementations. (If a
- particular option is given to latexmk but is not handled by the
- particular implementation of *latex that is being used, that
- program will probably give a warning or an error.) These op-
- tions are very numerous, but are not listed in this documenta-
- tion because they have no effect on latexmk's actions.
+ Show the list of extra *latex options that latexmk recognizes,
+ but that it simply passes through to the programs *latex when
+ they are run. These options are (currently) a combination of
- There are a few options (e.g., -includedirectory=dir, -initial-
- ize, -ini) that are not recognized, either because they don't
- fit with latexmk's intended operations, or because they need
+ 11 December 2024 22
- 7 April 2024 22
-
LATEXMK(1) General Commands Manual LATEXMK(1)
- special processing by latexmk that isn't implemented (at least,
+ those allowed by the TeXLive and MiKTeX implementations. (If a
+ particular option is given to latexmk but is not handled by the
+ particular implementation of *latex that is being used, that
+ program will probably give a warning or an error.) These op-
+ tions are very numerous, but are not listed in this documenta-
+ tion because they have no effect on latexmk's actions.
+
+ There are a few options (e.g., -includedirectory=dir, -initial-
+ ize, -ini) that are not recognized, either because they don't
+ fit with latexmk's intended operations, or because they need
+ special processing by latexmk that isn't implemented (at least,
not yet).
- There are certain options for *latex (e.g., -recorder) that
+ There are certain options for *latex (e.g., -recorder) that
trigger special actions or behavior by latexmk itself. Depending
- on the action, they may also be passed in some form to the
+ on the action, they may also be passed in some form to the
called *latex program, and/or may affect other programs as well.
- These options do have entries in this documentation. Among
+ These options do have entries in this documentation. Among
these options are: -jobname=STRING, -aux-directory=dir, -output-
directory=DIR, -quiet, and -recorder.
- There are also options that are accepted by *latex, but instead
+ There are also options that are accepted by *latex, but instead
trigger actions purely by latexmk: -help, -version.
-silent
Run commands silently, i.e., with options that reduce the amount
- of diagnostics generated. For example, with the default set-
- tings, the command "latex -interaction=batchmode" is used for
+ of diagnostics generated. For example, with the default set-
+ tings, the command "latex -interaction=batchmode" is used for
latex, and similarly for its friends.
- See also the -logfilewarninglist and -logfilewarninglist- op-
+ See also the -logfilewarninglist and -logfilewarninglist- op-
tions.
- Also reduce the number of informational messages that latexmk
+ Also reduce the number of informational messages that latexmk
itself generates.
- To change the options used to make the commands run silently,
+ To change the options used to make the commands run silently,
you need to configure latexmk with changed values of its config-
- uration variables, the relevant ones being $bib-
- tex_silent_switch, $biber_silent_switch, $dvipdf_silent_switch,
+ uration variables, the relevant ones being $bib-
+ tex_silent_switch, $biber_silent_switch, $dvipdf_silent_switch,
$dvips_silent_switch, $dvilualatex_silent_switch, $la-
- tex_silent_switch, $lualatex_silent_switch $makein-
- dex_silent_switch, $pdflatex_silent_switch, and $xela-
+ tex_silent_switch, $lualatex_silent_switch $makein-
+ dex_silent_switch, $pdflatex_silent_switch, and $xela-
tex_silent_switch
-stdtexcmds
- Sets the commands for latex, etc, so that they are the standard
+ Sets the commands for latex, etc, so that they are the standard
ones. This is useful to override special configurations.
- The result is that $latex = 'latex %O %S', and similarly for
- $pdflatex, $lualatex, and $xelatex. (The option -no-pdf needed
+ The result is that $latex = 'latex %O %S', and similarly for
+ $pdflatex, $lualatex, and $xelatex. (The option -no-pdf needed
for $xelatex is provided automatically, given that %O appears in
- the definition.)
- -time Show time used. (On MS Windows, what is shown is clock time; on
- other systems CPU time.) See also the configuration variable
- $show_time.
+ 11 December 2024 23
- -time- Do not show time used. See also the configuration variable
- $show_time.
- 7 April 2024 23
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ the definition.)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ -time Show time used. (On MS Windows, what is shown is clock time; on
+ other systems CPU time.) See also the configuration variable
+ $show_time.
+ -time- Do not show time used. See also the configuration variable
+ $show_time.
+
+
-use-make
- When after a run of *latex, there are warnings about missing
- files (e.g., as requested by the LaTeX \input, \include, and
- \includgraphics commands), latexmk tries to make them by a cus-
- tom dependency. If no relevant custom dependency with an appro-
+ When after a run of *latex, there are warnings about missing
+ files (e.g., as requested by the LaTeX \input, \include, and
+ \includgraphics commands), latexmk tries to make them by a cus-
+ tom dependency. If no relevant custom dependency with an appro-
priate source file is found, and if the -use-make option is set,
- then as a last resort latexmk will try to use the make program
+ then as a last resort latexmk will try to use the make program
to try to make the missing files.
- Note that the filename may be specified without an extension,
- e.g., by \includegraphics{drawing} in a LaTeX file. In that
- case, latexmk will try making drawing.ext with ext set in turn
- to the possible extensions that are relevant for latex (or as
+ Note that the filename may be specified without an extension,
+ e.g., by \includegraphics{drawing} in a LaTeX file. In that
+ case, latexmk will try making drawing.ext with ext set in turn
+ to the possible extensions that are relevant for latex (or as
appropriate pdflatex, lualatex, xelatex).
- See also the documentation for the $use_make_for_missing_files
+ See also the documentation for the $use_make_for_missing_files
configuration variable.
-use-make-
- Do not use the make program to try to make missing files. (De-
+ Do not use the make program to try to make missing files. (De-
fault.)
-usepretex
Sets the command lines for latex, etc, so that they use the code
- that is defined by the variable $pre_tex_code or that is set by
+ that is defined by the variable $pre_tex_code or that is set by
the option -pretex=CODE to execute the specified TeX code before
the source file is read. This option overrides any previous de-
finition of the command lines.
- The result is that $latex = 'latex %O %P', and similarly for
- $pdflatex, $lualatex, and $xelatex. (The option -no-pdf needed
+ The result is that $latex = 'latex %O %P', and similarly for
+ $pdflatex, $lualatex, and $xelatex. (The option -no-pdf needed
for $xelatex is provided automatically, given that %O appears in
the definition.)
@@ -1565,102 +1577,101 @@
latexmk -usepretex='\AtBeginDocument{Message\par}' foo.tex
- -v or -version
- Print version number of latexmk.
- -verbose
- Opposite of -silent. This is the default setting.
+ 11 December 2024 24
- -view=default, -view=dvi, -view=ps, -view=pdf, -view=none
- Set the kind of file used when previewing is requested (e.g., by
- the -pv or -pvc switches). The default is to view the "highest"
- 7 April 2024 24
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ -v or -version
+ Print version number of latexmk.
+ -verbose
+ Opposite of -silent. This is the default setting.
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ -view=default, -view=dvi, -view=hnt, -view=ps, -view=pdf, -view=none
+ Set the kind of file used when previewing is requested (e.g., by
+ the -pv or -pvc switches). The default is to view the "highest"
+ kind of requested file (in the low-to-high order .dvi, .hnt,
+ .ps, .pdf).
- kind of requested file (in the low-to-high order .dvi, .ps,
- .pdf).
-
- Note the possibility -view=none where no viewer is opened at
- all. One example of is use is in conjunction with the -pvc op-
- tion, when you want latexmk to do a compilation automatically
- whenever source file(s) change, but do not want a previewer to
+ Note the possibility -view=none where no viewer is opened at
+ all. One example of is use is in conjunction with the -pvc op-
+ tion, when you want latexmk to do a compilation automatically
+ whenever source file(s) change, but do not want a previewer to
be opened.
-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
- and citations. Thus -Werror causes latexmk to treat such warn-
+ 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
+ and citations. Thus -Werror causes latexmk to treat such warn-
ings as errors, but only when they occur on the last run of *la-
- tex and only after processing is complete. Also can be set by
+ tex and only after processing is complete. Also can be set by
the configuration variable $warnings_as_errors.
- -xdv Generate xdv version of document using xelatex.
+ -xdv Generate xdv version of document using xelatex. (And turn off
+ any incompatible requests.)
-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.
+ Use xelatex. That is, use xelatex to process the source
+ file(s). This will cause generation of a pdf (but indirectly
+ through a xdv file). (And turn off any incompatible requests.)
- This option is equivalent to using the following set of options
+ This option is equivalent to using the following option
- -pdfxe -dvi- -ps-
+ -pdfxe
- [Note: Note that the method of implementation of this option,
- but not its intended primary effect, differ from some earlier
- versions of latexmk. Latexmk first uses xelatex to make an .xdv
- file, and does all the extra runs needed (including those of
- bibtex, etc). Only after that does it make the pdf file from
- the .xdv file, using xdvipdfmx. See the documentation for the
+ [Note: Note that the method of implementation of this option,
+ but not its intended primary effect, differ from some earlier
+ versions of latexmk. Latexmk first uses xelatex to make an .xdv
+ file, and does all the extra runs needed (including those of
+ bibtex, etc). Only after that does it make the pdf file from
+ the .xdv file, using xdvipdfmx. See the documentation for the
-pdfxe for why this is done.]
- -xelatex="COMMAND"
- This sets the string specifying the command to run xelatex. It
- sets the variable $xelatex.
- Warning: It is important to ensure that the -no-pdf is used when
- xelatex is invoked, since latexmk expects xelatex to produce an
- .xdv file, not a .pdf file. If you provide %O in the command
- specification, this will be done automatically. See the docu-
- mentation for the -pdfxe option for why latexmk makes a .xdv
- file rather than a .pdf file when xelatex is used.
+ 11 December 2024 25
- 7 April 2024 25
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ -xelatex="COMMAND"
+ This sets the string specifying the command to run xelatex. It
+ sets the variable $xelatex.
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ Warning: It is important to ensure that the -no-pdf is used when
+ xelatex is invoked, since latexmk expects xelatex to produce an
+ .xdv file, not a .pdf file. If you provide %O in the command
+ specification, this will be done automatically. See the docu-
+ mentation for the -pdfxe option for why latexmk makes a .xdv
+ file rather than a .pdf file when xelatex is used.
+ An example of the use of the -xelatex option:
- An example of the use of the -pdfxelatex option:
-
- latexmk -pdfxe -pdfxelatex="xelatex --shell-escape %O %S"
+ latexmk -pdfxe -xelatex="xelatex --shell-escape %O %S"
foo.tex
- Note: This option when provided with the COMMAND argument only
- sets the command for invoking lualatex; it does not turn on the
+ Note: This option when provided with the COMMAND argument only
+ sets the command for invoking xelatex; it does not turn on the
use of lualatex. That is done by other options or in an initial-
ization file.
@@ -1667,11 +1678,11 @@
Compatibility between options
- The preview-continuous option -pvc can only work with one file. So in
- this case you will normally only specify one filename on the command
+ The preview-continuous option -pvc can only work with one file. So in
+ this case you will normally only specify one filename on the command
line.
- Options -p, -pv and -pvc are mutually exclusive. So each of these op-
+ Options -p, -pv and -pvc are mutually exclusive. So each of these op-
tions turns the others off.
@@ -1696,36 +1707,37 @@
-DEALING WITH ERRORS, PROBLEMS, ETC
- Some possibilities:
- 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
+ 11 December 2024 26
- 7 April 2024 26
-
LATEXMK(1) General Commands Manual LATEXMK(1)
- programs. Your first priority in dealing with errors should be to ex-
- amine what went wrong with the individual programs. Then you need to
- correct the causes of errors in the runs of these programs. (Often
- these come from errors in the source document, but they could also be
- about missing LaTeX packages, etc.)
+DEALING WITH ERRORS, PROBLEMS, ETC
+ Some possibilities:
+ 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
+ what went wrong with the individual programs. Then you need to correct
+ the causes of errors in the runs of these programs. (Often these come
+ from errors in the source document, but they could also be about miss-
+ ing LaTeX packages, etc.)
+
c. If latexmk doesn't run the programs the way you would like, then you
need to look in this documentation at the list of command line options
and then at the sections on configuration/initialization files. A lot
@@ -1762,30 +1774,29 @@
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.
+ 11 December 2024 27
+LATEXMK(1) General Commands Manual LATEXMK(1)
- 7 April 2024 27
+ 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)
-
AUXILIARY AND OUTPUT DIRECTORIES
Running *latex and the associated programs generate a number of files,
it is often convenient to arrange for the generated files to be in a
@@ -1829,36 +1840,36 @@
separate aux and output directories. Latexmk deals with this by being
able to emulating a separate aux directory: In this method it invokes
*latex with just an -output-directory option, with the directory set
- not to the desired output directory, but to the aux directory. After
- running *latex, it moves the relevant final output file(s) to the in-
- tended output directory. Emulation can be turned on by setting the
- configuration variable $emulate_aux to one in a configuration file or
- by using latexmk's -emulate-aux-dir option. The emulation method works
- equally well if MiKTeX is used.
- Latexmk also turns emulation on if it is found to be needed, as fol-
- lows. Suppose emulation is initially off, but the aux and output di-
- rectories are different. Then latexmk invokes *latex with an -aux-di-
- rectory option and after the run finds that it hasn't been obeyed,
+ 11 December 2024 28
- 7 April 2024 28
-
LATEXMK(1) General Commands Manual LATEXMK(1)
- notably because the .log file is in the output directory rather than
- the aux directory. Latexmk then sets emulation on, and retries. Con-
- ceivably, it could move all the appropriate generated files from the
- output directory to the aux directory; but there is such a large vari-
- ety of possibilities for these files that this is hard to identify all
- of them reliably except for simple cases.
+ not to the desired output directory, but to the aux directory. After
+ running *latex, it moves the relevant final output file(s) to the in-
+ tended output directory. Emulation can be turned on by setting the
+ configuration variable $emulate_aux to one in a configuration file or
+ by using latexmk's -emulate-aux-dir option. The emulation method works
+ equally well if MiKTeX is used.
+ Latexmk also turns emulation on if it is found to be needed, as fol-
+ lows. Suppose emulation is initially off, but the aux and output di-
+ rectories are different. Then latexmk invokes *latex with an -aux-di-
+ rectory option and after the run finds that it hasn't been obeyed, no-
+ tably because the .log file is in the output directory rather than the
+ aux directory. Latexmk then sets emulation on, and retries. Conceiv-
+ ably, it could move all the appropriate generated files from the output
+ directory to the aux directory; but there is such a large variety of
+ possibilities for these files that this is hard to identify all of them
+ reliably except for simple cases.
+
Note that the emulation issue only arises when the user has arranged
for the the aux and output directories to be different. When instead
they are equal, e.g., because the user only set the $out_dir variable,
@@ -1895,29 +1906,29 @@
the default is to set it equal to the output directory. For the output
directory, the default is to be the current directory.
- For the turning on and off of the emulation mode, there is the configu-
- ration variable $emulate_aux and the options -emulate-aux-dir, -emu-
- late-aux-dir-, -noemulate-aux-dir.
- Interaction with -cd option: When the -cd option is used (or the equiv-
- alent setting of $do_cd variable), then latexmk changes the working di-
- rectory to the document directory before invoking *latex. If the aux
- and/or output directories are given by relative paths, e.g., by -out-
- dir=output for a directory named "output", then the directories are
- relative to the document directory, rather than relative to the working
+ 11 December 2024 29
- 7 April 2024 29
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ For the turning on and off of the emulation mode, there is the configu-
+ ration variable $emulate_aux and the options -emulate-aux-dir, -emu-
+ late-aux-dir-, -noemulate-aux-dir.
+ Interaction with -cd option: When the -cd option is used (or the equiv-
+ alent setting of $do_cd variable), then latexmk changes the working di-
+ rectory to the document directory before invoking *latex. If the aux
+ and/or output directories are given by relative paths, e.g., by -out-
+ dir=output for a directory named "output", then the directories are
+ relative to the document directory, rather than relative to the working
directory that was in effect when latexmk was invoked. This matches the
behavior of *latex as invoked with the provided command line directory
argument(s) after the change of working directory to the document di-
@@ -1962,6 +1973,17 @@
variable openout_any to "a" (as in "all"), to override the default
"paranoid" setting.
+
+
+ 11 December 2024 30
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
Certain names of aux and output directories not allowed on Microsoft
Windows: It is natural to want to use the name "aux" for the aux direc-
tory, e.g., by using the option -auxdir=aux. But on Microsoft operat-
@@ -1972,18 +1994,6 @@
Location of .fls file: Much of the dependency information that latexmk
uses comes from the .fls file generated when *latex is invoked with the
-
-
-
- 7 April 2024 30
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
-recorder option, which latexmk does by default. It may seem rational
that this is written to the aux directory. But in fact versions of
MiKTeX prior to Oct. 2020 wrote it to the output directory. Later ver-
@@ -2029,27 +2039,26 @@
useful to force output to be of the .dvi format by inserting \pdfout-
put=0 in the preamble of the document.
- Another example is where the document uses graphics file of the .pdf,
- .jpg, and png types. With the default setting for the graphicx pack-
- age, these can be processed in compilation to .pdf but not with compi-
- lation to .dvi. In this case, it is useful to insert \pdfoutput=1 in
- the preamble of the document to force compilation to .pdf output for-
- mat.
- In all of these cases, it is needed that latexmk has to adjust its pro-
- cessing to deal with a mismatch between the actual output format (out
+ 11 December 2024 31
- 7 April 2024 31
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ Another example is where the document uses graphics file of the .pdf,
+ .jpg, and png types. With the default setting for the graphicx pack-
+ age, these can be processed in compilation to .pdf but not with compi-
+ lation to .dvi. In this case, it is useful to insert \pdfoutput=1 in
+ the preamble of the document to force compilation to .pdf output for-
+ mat.
-
+ In all of these cases, it is needed that latexmk has to adjust its pro-
+ cessing to deal with a mismatch between the actual output format (out
of .pdf, .dvi, .xdv) and the initially expected output, if possible.
Latexmk does this provided the following conditions are met.
@@ -2095,19 +2104,10 @@
The
directories are searched in the following order, and latexmk uses
the first such file it finds (if any):
- "/etc",
- "/opt/local/share/latexmk",
- "/usr/local/share/latexmk",
- "/usr/local/lib/latexmk".
- On a MS-Windows system it looks just in "C:\latexmk".
- On a cygwin system (i.e., a MS-Windows system in which Perl is that
- of cygwin), latexmk looks in the directories
- "/cygdrive/c/latexmk",
- "/etc",
- 7 April 2024 32
+ 11 December 2024 32
@@ -2116,9 +2116,18 @@
LATEXMK(1) General Commands Manual LATEXMK(1)
+ "/etc",
"/opt/local/share/latexmk",
"/usr/local/share/latexmk",
"/usr/local/lib/latexmk".
+ On a MS-Windows system it looks just in "C:\latexmk".
+ On a cygwin system (i.e., a MS-Windows system in which Perl is that
+ of cygwin), latexmk looks in the directories
+ "/cygdrive/c/latexmk",
+ "/etc",
+ "/opt/local/share/latexmk",
+ "/usr/local/share/latexmk",
+ "/usr/local/lib/latexmk".
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.
@@ -2161,25 +2170,25 @@
Note that command line options are obeyed in the order in which they
are written; thus any RC file specified on the command line with the -r
- option can override previous options but can be itself overridden by
- later options on the command line. There is also the -e option, which
- allows initialization code to be specified in latexmk's command line.
- For possible examples of code for in an RC file, see the directory ex-
- ample_rcfiles in the distribution of latexmk (e.g., at http://mir-
- ror.ctan.org/support/latexmk/example_rcfiles).
+ 11 December 2024 33
- 7 April 2024 33
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ 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.
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ For possible examples of code for in an RC file, see the directory ex-
+ ample_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
@@ -2228,26 +2237,25 @@
bilities listed here do not apply to the $kpsewhich variable; see its
documentation.)
- Placeholders: Supposed you wanted latexmk to use the command elatex in
- place of the regular latex command, and suppose moreover that you
- wanted to give it the option "--shell-escape". You could do this by
- the following setting:
- $latex = 'elatex --shell-escape %O %S';
- The two items starting with the % character are placeholders. These
+ 11 December 2024 34
- 7 April 2024 34
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ Placeholders: Supposed you wanted latexmk to use the command elatex in
+ place of the regular latex command, and suppose moreover that you
+ wanted to give it the option "--shell-escape". You could do this by
+ the following setting:
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ $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
@@ -2293,19 +2301,11 @@
%T The name of the primary tex file.
- %U If the variable $pre_tex_code is non-empty, then its value is
- substituted for %U (appropriately quoted). Otherwise it is re-
- placed by a null string.
- %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
- 7 April 2024 35
+ 11 December 2024 35
@@ -2314,6 +2314,15 @@
LATEXMK(1) General Commands Manual LATEXMK(1)
+ %U If the variable $pre_tex_code is non-empty, then its value is
+ substituted for %U (appropriately quoted). Otherwise it is re-
+ placed by a null string.
+
+ %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.
@@ -2359,27 +2368,27 @@
Notes: (1) In some circumstances, latexmk will always run a command de-
tached. 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
+ 11 December 2024 36
- 7 April 2024 36
-
LATEXMK(1) General Commands Manual LATEXMK(1)
+ 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 en-
closed in double quotes, as in
@@ -2425,26 +2434,26 @@
$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.
- 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:
+ 11 December 2024 37
- 7 April 2024 37
+LATEXMK(1) General Commands Manual LATEXMK(1)
-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';
@@ -2491,27 +2500,28 @@
Here, the UNIX command separator ; is replaced by &&. In addition,
there is a problem that some versions of Perl on MS-Windows do not obey
- the command separator; this problem is overcome by explicitly invoking
- the MS-Windows command-line processor cmd.exe.
-LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
- In this section are specified the variables whose values can be ad-
- justed to configure latexmk. (See the earlier section "Configura-
- tion/Initialization (rc) Files" for the files where the configurations
- are done.)
+ 11 December 2024 38
- 7 April 2024 38
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ the command separator; this problem is overcome by explicitly invoking
+ the MS-Windows command-line processor cmd.exe.
+LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES
+ In this section are specified the variables whose values can be ad-
+ justed to configure latexmk. (See the earlier section "Configura-
+ tion/Initialization (rc) Files" for the files where the configurations
+ are done.)
+
Default values are indicated in brackets. Note that for variables that
are boolean in character, concerning whether latexmk does or does not
behave in a certain way, a non-zero value, normally 1, indicates true,
@@ -2555,29 +2565,30 @@
$always_view_file_via_temporary [0]
Whether .ps and .pdf files are initially to be made in a tempo-
- rary directory and then moved to the final location. (This ap-
- plies to dvips, dvipdf, and ps2pdf operations, and the filtering
- operators on .dvi and .ps files. It does not apply to pdflatex,
- unfortunately, since pdflatex provides no way of specifying a
- chosen name for the output file.)
+ rary directory and then moved to the final location. (This
- This use of a temporary file solves a problem that the making of
- these files can occupy a substantial time. If a viewer (notably
- gv) sees that the file has changed, it may read the new file be-
- fore the program writing the file has not yet finished its work,
- which can cause havoc.
+ 11 December 2024 39
- 7 April 2024 39
-
LATEXMK(1) General Commands Manual LATEXMK(1)
+ applies to dvips, dvipdf, and ps2pdf operations, and the filter-
+ ing operators on .dvi and .ps files. It does not apply to
+ pdflatex, unfortunately, since pdflatex provides no way of spec-
+ ifying a chosen name for the output file.)
+
+ This use of a temporary file solves a problem that the making of
+ these files can occupy a substantial time. If a viewer (notably
+ gv) sees that the file has changed, it may read the new file be-
+ fore the program writing the file has not yet finished its work,
+ which can cause havoc.
+
See the $pvc_view_file_via_temporary variable for a setting that
applies only if preview-continuous mode (-pvc option) is used.
See $tmpdir for the setting of the directory where the temporary
@@ -2622,28 +2633,27 @@
The aux directory, i.e., the directory in which auxiliary files
(aux, log, etc) are to be written by a run of *latex.
- If this variable is not set, but $out_dir is set, then latexmk
- takes the aux directory to equal the output directory which is
- the directory to which final output files are to be written.
- If neither variable is set, then the current directory when *la-
- tex is invoked is used both for the aux and output directories.
- If the aux and output directories are distinct, then the aux di-
- rectory contains all generated files with the exception of "fi-
- nal output files", which are defined to be .dvi, .ps, .pdf,
+ 11 December 2024 40
- 7 April 2024 40
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ If this variable is not set, but $out_dir is set, then latexmk
+ takes the aux directory to equal the output directory which is
+ the directory to which final output files are to be written.
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ If neither variable is set, then the current directory when *la-
+ tex is invoked is used both for the aux and output directories.
-
+ If the aux and output directories are distinct, then the aux di-
+ rectory contains all generated files with the exception of "fi-
+ nal output files", which are defined to be .dvi, .ps, .pdf,
.synctex, and .synctex.gz files.
See the section AUXILIARY AND OUTPUT DIRECTORIES for more de-
@@ -2690,26 +2700,24 @@
occurring inside constructs.
- $banner [0]
- If nonzero, the banner message is printed across each page when
- converting the dvi file to postscript. Without modifying the
- variable $banner_message, this is equivalent to specifying the
- -d option.
- Note that if $banner is nonzero, the $postscript_mode is assumed
- and the postscript file is always generated, even if it is newer
+ 11 December 2024 41
- 7 April 2024 41
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ $banner [0]
+ If nonzero, the banner message is printed across each page when
+ converting the dvi file to postscript. Without modifying the
+ variable $banner_message, this is equivalent to specifying the
+ -d option.
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
+ Note that if $banner is nonzero, the $postscript_mode is assumed
+ and the postscript file is always generated, even if it is newer
than the dvi file.
$banner_intensity [0.95]
@@ -2756,26 +2764,25 @@
rent version of latexmk, since it now uses a better method of
searching for files using the kpsewhich command. However, if
your system is an unusual one without the kpsewhich command, you
- may need to set the variable @BIBINPUTS.
- $biber ["biber %O %S"]
- The biber processing program.
+ 11 December 2024 42
- 7 April 2024 42
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ may need to set the variable @BIBINPUTS.
+ $biber ["biber %O %S"]
+ The biber processing program.
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
$biber_silent_switch ["--onlylog"]
Switch(es) for the biber processing program when silent mode is
on.
@@ -2823,17 +2830,10 @@
The possible values of $bibtex_use are:
0: never use bibtex or biber; never delete .bbl files in a
- cleanup.
- 1: only use bibtex or biber if the bib file(s) exist; never
- delete .bbl files in a cleanup.
- 1.5: only use bibtex or biber if the bib files exist;
- conditionally delete .bbl files in a cleanup (i.e., delete
- them only when
- the bib files all exist).
- 7 April 2024 43
+ 11 December 2024 43
@@ -2842,6 +2842,13 @@
LATEXMK(1) General Commands Manual LATEXMK(1)
+ cleanup.
+ 1: only use bibtex or biber if the bib file(s) exist; never
+ delete .bbl files in a cleanup.
+ 1.5: only use bibtex or biber if the bib files exist;
+ conditionally delete .bbl files in a cleanup (i.e., delete
+ them only when
+ the bib files all exist).
2: run bibtex or biber whenever it appears necessary to update
the bbl file(s), without testing for the existence of the bib
files; always delete .bbl files in a cleanup.
@@ -2889,25 +2896,26 @@
This variable is equivalent to specifying one of the -c or -C
options. But there should be no need to set this variable from
- an RC file.
- $clean_ext [""]
- Extra extensions of files for latexmk to remove when any of the
- clean-up options (-c or -C) is selected. The value of this
- variable is a string containing the extensions separated by
- spaces.
+ 11 December 2024 44
- 7 April 2024 44
-
LATEXMK(1) General Commands Manual LATEXMK(1)
+ an RC file.
+
+ $clean_ext [""]
+ Extra extensions of files for latexmk to remove when any of the
+ clean-up options (-c or -C) is selected. The value of this
+ variable is a string containing the extensions separated by
+ spaces.
+
It is also possible to specify a more general pattern of file to
be deleted, by using the place holder %R, as in commands, and it
is also possible to use wildcards. Thus setting
@@ -2953,99 +2961,100 @@
array @generated_exts.
$clean_full_ext [""]
- Extra extensions of files for latexmk to remove when the -C op-
- tion is selected, i.e., extensions of files to remove when the
- .dvi, etc files are to be cleaned-up.
+ Extra extensions of files for latexmk to remove when the -C
- More general patterns are allowed, as for $clean_ext.
- The files specified by $clean_full_ext to be deleted are rela-
- tive to the directory specified by $out_dir.
+ 11 December 2024 45
- 7 April 2024 45
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ option is selected, i.e., extensions of files to remove when the
+ .dvi, etc files are to be cleaned-up.
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ More general patterns are allowed, as for $clean_ext.
+ The files specified by $clean_full_ext to be deleted are rela-
+ tive to the directory specified by $out_dir.
+
$compiling_cmd [""], $failure_cmd [""], $warning_cmd [""], $success_cmd
[""]
- These variables specify commands that are executed at certain
- points of compilations. One motivation for their existence is
- to allow very useful convenient visual indications of compila-
- tion status even when the window receiving the screen output of
- the compilation is hidden. This is particularly useful in pre-
+ These variables specify commands that are executed at certain
+ points of compilations. One motivation for their existence is
+ to allow very useful convenient visual indications of compila-
+ tion status even when the window receiving the screen output of
+ the compilation is hidden. This is particularly useful in pre-
view-continuous mode.
- The commands are executed at the following points: $compil-
- ing_cmd at the start of compilation, $success_cmd at the end of
- a completely successful compilation, $failure_cmd at the end of
+ The commands are executed at the following points: $compil-
+ ing_cmd at the start of compilation, $success_cmd at the end of
+ 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-
+ of above variables is undefined or blank (the default situa-
tion), then the corresponding command is not executed.
- 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
+ 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
+ $compiling_cmd = "xdotool search --name \"%D\" set_window
--name \"%D compiling\"";
- $success_cmd = "xdotool search --name \"%D\" set_window
+ $success_cmd = "xdotool search --name \"%D\" set_window
--name \"%D OK\"";
$warning_cmd = "xdotool search --name \"%D\" ".
"set_window --name \"%D CITE/REF ISSUE\"";
- $failure_cmd = "xdotool search --name \"%D\" set_window
+ $failure_cmd = "xdotool search --name \"%D\" set_window
--name \"%D FAILURE\"";
- These assume that the program xdotool is installed, that the
- previewer is using an X-Window system for display, and that the
- title of the window contains the name of the displayed file, as
- it normally does. When the commands are executed, the place-
- holder string %D is replaced by the name of the destination
+ These assume that the program xdotool is installed, that the
+ previewer is using an X-Window system for display, and that the
+ title of the window contains the name of the displayed file, as
+ it normally does. When the commands are executed, the place-
+ holder string %D is replaced by the name of the destination
file, which is the previewed file. The above commands result in
an appropriate string being appended to the filename in the win-
dow title: " compiling", " OK", or " FAILURE".
- Other placeholders that can be used are %S, %T, and %R, with %S
- and %T normally being identical. These can be useful for a com-
- mand changing the title of the edit window. The visual indica-
- tion in a window title can useful, since the user does not have
- to keep shifting attention to the (possibly hidden) compilation
- 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
+ 11 December 2024 46
- 7 April 2024 46
-
LATEXMK(1) General Commands Manual LATEXMK(1)
- "internal" keyword in the definitions to get the subroutine to
+ Other placeholders that can be used are %S, %T, and %R, with %S
+ and %T normally being identical. These can be useful for a com-
+ mand changing the title of the edit window. The visual indica-
+ tion in a window title can useful, since the user does not have
+ to keep shifting attention to the (possibly hidden) compilation
+ window to know the status of the compilation.
+
+ 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
+ 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.
@@ -3054,15 +3063,15 @@
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 de-
- fault list. In that case you can specify the excluded files in
+ fault 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
+ 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
@@ -3072,10 +3081,10 @@
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 @de-
- fault_files and having to update the list every time you change
+ fault_files and having to update the list every time you change
the set of files to be processed.
- Notes: 1. This variable has no effect except when no files are
+ 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.
@@ -3082,30 +3091,30 @@
@default_files [("*.tex")]
Default list of files to be processed.
- If no filenames are specified on the command line, latexmk
- processes all tex files specified in the @default_files vari-
- able, which by default is set to all tex files ("*.tex") in the
- current directory. This is a convenience: just run latexmk and
- it will process an appropriate set of files. But sometimes you
- want only some of these files to be processed. In this case you
- 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.
+ If no filenames are specified on the command line, latexmk
+ processes all tex files specified in the @default_files vari-
+ able, which by default is set to all tex files ("*.tex") in the
+ 11 December 2024 47
- 7 April 2024 47
-
LATEXMK(1) General Commands Manual LATEXMK(1)
+ current directory. This is a convenience: just run latexmk and
+ it will process an appropriate set of files. But sometimes you
+ want only some of these files to be processed. In this case you
+ 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:
@default_files = ("paper_current");
@@ -3114,23 +3123,23 @@
@default_files = ("*.tex", "*.dtx");
- Note that more than file may be given, and that the default ex-
+ Note that more than file may be given, and that the default ex-
tension 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 up-
+ 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 up-
dating 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.
@@ -3137,42 +3146,43 @@
$deps_escape ["none"]
This variable determines which kind of escaping of space charac-
ters to use in dependency lists. The possible values are "none",
- "unix", "nmake", corresponding respectively to no escaping, es-
- caping with a "\" suitable for standard Unix make, and escaping
+ "unix", "nmake", corresponding respectively to no escaping, es-
+ caping with a "\" suitable for standard Unix make, and escaping
with "^", suitable for Microsoft's nmake.
- Currently the only character escaped is a space, since that is
- particularly common in file names and directory names. There
- are other characters that would need escaping if a dependency
+ Currently the only character escaped is a space, since that is
+ particularly common in file names and directory names. There
+ are other characters that would need escaping if a dependency
list is to be used as-is by a make program; but those characters
(e.g., "$") commonly cause difficulties when used for .tex docu-
- ments. Moreover, the detailed rules for which characters need
+ ments. Moreover, the detailed rules for which characters need
to be escaped depends on the version of make.
- $deps_file ["-"]
- Name of file to receive list(s) of dependencies at the end of a
- run, to be used if $dependents_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
+ 11 December 2024 48
- 7 April 2024 48
-
LATEXMK(1) General Commands Manual LATEXMK(1)
- behavior is not to do this, which is the same as the behavior of
+ $deps_file ["-"]
+ Name of file to receive list(s) of dependencies at the end of a
+ run, to be used if $dependents_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 be-
+ havior is not to do this, which is the same as the behavior of
*latex programs. This variable is set by the -cd and -cd- op-
tions on latexmk's command line.
@@ -3218,183 +3228,181 @@
that equally applies to $dvilualatex_silent_switch.
- $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
- system has associated with .dvi files.]
- Important note: Normally you will want to have a previewer run
- detached, so that latexmk doesn't wait for the previewer to
+ 11 December 2024 49
- 7 April 2024 49
+LATEXMK(1) General Commands Manual LATEXMK(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
+ system has associated with .dvi files.]
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
- terminate before continuing its work. So normally you should
- prefix the command by "start ", which flags to latexmk that it
- should do the detaching of the previewer itself (by whatever
- method is appropriate to the operating system). But sometimes
+ 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
+ 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 -dALLOWPSTRANSPARENCY %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
+ Command to convert .dvi to .pdf file. A common reconfiguration
+ is to use the dvipdfm command, which needs its arguments in a
different order:
$dvipdf = "dvipdfm %O -o %D %S";
- WARNING: The default dvipdf script generates pdf files with
+ WARNING: The default dvipdf script generates pdf files with
bitmapped fonts, which do not look good when viewed by acroread.
- That script should be modified to give dvips the options "-P
+ That script should be modified to give dvips the options "-P
pdf" to ensure that type 1 fonts are used in the pdf file.
$dvipdf_silent_switch ["-q"]
Switch(es) for dvipdf program when silent mode is on.
- N.B. The standard dvipdf program runs silently, so adding the
- silent switch has no effect, but is actually innocuous. But if
- an alternative program is used, e.g., dvipdfmx, then the silent
- switch has an effect. The default setting is correct for
+ N.B. The standard dvipdf program runs silently, so adding the
+ silent switch has no effect, but is actually innocuous. But if
+ an alternative program is used, e.g., dvipdfmx, then the silent
+ switch has an effect. The default setting is correct for
dvipdfm and dvipdfmx.
$dvips ["dvips %O -o %D %S"]
- The program to used as a filter to convert a .dvi file to a .ps
- file. If pdf is going to be generated from pdf, then the value
- of the $dvips_pdf_switch variable -- see below -- will be in-
+ 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 in-
cluded in the options substituted for "%O".
$dvips_landscape ["dvips -tlandscape %O -o %D %S"]
- The program to used as a filter to convert a .dvi file to a .ps
+ The program to used as a filter to convert a .dvi file to a .ps
file in landscape mode.
- $dvips_pdf_switch ["-P pdf"]
- Switch(es) for dvips program when pdf file is to be generated
- from .ps file.
- $dvips_silent_switch ["-q"]
- Switch(es) for dvips program when silent mode is on.
- $dvi_update_command [""]
- When the dvi previewer is set to be updated by running a
+ 11 December 2024 50
- 7 April 2024 50
-
LATEXMK(1) General Commands Manual LATEXMK(1)
- command, 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 exam-
- ple for the analogous case of a pdf previewer.
+ $dvips_pdf_switch ["-P pdf"]
+ Switch(es) for dvips program when pdf file is to be generated
+ from .ps file.
+ $dvips_silent_switch ["-q"]
+ Switch(es) for dvips program when silent mode is on.
+
+ $dvi_update_command [""]
+ When the dvi previewer is set to be updated by running a com-
+ mand, this is the command that is run. See the information for
+ the variable $dvi_update_method for further information, and see
+ information on the variable $pdf_update_method for an example
+ for the analogous case of a pdf previewer.
+
$dvi_update_method [2 under UNIX, 1 under MS-Windows]
- How the dvi viewer updates its display when the dvi file has
- changed. The values here apply equally to the $pdf_up-
+ How the dvi viewer updates its display when the dvi file has
+ changed. The values here apply equally to the $pdf_up-
date_method and to the $ps_update_method variables.
0 => update is automatic,
1=> manual update by user, which may only mean a mouse click
on the viewer's window or may mean a more serious action.
- 2 => Send the signal, whose number is in the variable
- $dvi_update_signal. The default value under UNIX is suitable
+ 2 => Send the signal, whose number is in the variable
+ $dvi_update_signal. The default value under UNIX is suitable
for xdvi.
- 3 => Viewer cannot do an update, because it locks the file.
+ 3 => Viewer cannot do an update, because it locks the file.
(As with acroread under MS-Windows.)
- 4 => run a command to do the update. The command is speci-
+ 4 => run a command to do the update. The command is speci-
fied by the variable $dvi_update_command.
- See information on the variable $pdf_update_method for an exam-
+ See information on the variable $pdf_update_method for an exam-
ple of updating by command.
$dvi_update_signal [Under UNIX: SIGUSR1, which is a system-dependent
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 ap-
+ 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 ap-
propriate for xdvi on a UNIX system.
$emulate_aux [1]
- Whether to emulate the use of aux directory when $aux_dir and
+ Whether to emulate the use of aux directory when $aux_dir and
$out_dir are different, rather than using the -aux-directory op-
- tion for the *latex programs. (MiKTeX supports -aux-directory,
+ tion for the *latex programs. (MiKTeX supports -aux-directory,
but TeXLive doesn't.)
- If you use a version of *latex that doesn't support -aux-direc-
- tory, e.g., TeXLive, latexmk will automatically switch aux_dir
+ If you use a version of *latex that doesn't support -aux-direc-
+ tory, e.g., TeXLive, latexmk will automatically switch aux_dir
emulation on after the first run of *latex, because it will find
the .log file in the wrong place. But it is better to set $emu-
- late_aux to 1 in an rc file, or equivalently to use the -emu-
+ late_aux to 1 in an rc file, or equivalently to use the -emu-
late-aux-dir option. This emulation mode works equally well with
MiKTeX.
- Aux directory emulation means that when *latex is invoked, the
- output directory provided to *latex is set to be the desired aux
- directory. After that, any files that need to be in the output
- directory will be moved there by latexmk. (These are the files
- with extensions .dvi, .ps, .pdf, .synctex, .synctex.gz, and, de-
- pending on the setting of the $fls_uses_out_dir variable, also
- the .fls file.)
+ Aux directory emulation means that when *latex is invoked, the
+ 11 December 2024 51
- 7 April 2024 51
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ output directory provided to *latex is set to be the desired aux
+ directory. After that, any files that need to be in the output
+ directory will be moved there by latexmk. (These are the files
+ with extensions .dvi, .ps, .pdf, .synctex, .synctex.gz, and, de-
+ pending on the setting of the $fls_uses_out_dir variable, also
+ the .fls file.)
-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.
@file_not_found
- This an array of Perl regular expressions that are patterns to
- find messages in the .log file from a run of *latex that indi-
- cate that a file was looked for and not found. To see the cur-
- rent default set, you should look at the definition of
+ This an array of Perl regular expressions that are patterns to
+ find messages in the .log file from a run of *latex that indi-
+ cate that a file was looked for and not found. To see the cur-
+ rent default set, you should look at the definition of
@file_not_found in the latexmk.pl file.
- In the regular expression, the string for the name of the miss-
- ing file should be enclosed in parentheses. That carries the
- implication that after latexmk gets a successful match to the
- pattern, the variable $1 is set to the filename, which is then
+ In the regular expression, the string for the name of the miss-
+ ing file should be enclosed in parentheses. That carries the
+ implication that after latexmk gets a successful match to the
+ pattern, the variable $1 is set to the filename, which is then
picked up by latexmk.
- If you happen to encounter a package that gives a missing file
- message of a different form than one that matches one of the
+ If you happen to encounter a package that gives a missing file
+ message of a different form than one that matches one of the
built-in patterns, you can add another pattern to the array. An
example would be
@@ -3407,27 +3415,19 @@
But the corresponding string specification in the push statement
has to have the backslashes doubled.
- This regular expression matches a line that starts with 'No
- file', then has one or more white space characters, then any
- number of characters forming the filename, then possible white
- space, and finally the end of the line. (See documentation on
+ This regular expression matches a line that starts with 'No
+ file', then has one or more white space characters, then any
+ number of characters forming the filename, then possible white
+ space, and finally the end of the line. (See documentation on
Perl regular expressions for details.)
$filetime_causality_threshold [5]
- The use of this variable is as follows: At a number of places,
- latexmk needs to determine whether a particular file has been
- produced during a just-concluded run of some rule/program or is
- leftover from a previous run. (An example is the production of a
- .bcf file by the biblatex package during a run of *latex to pro-
- vide bibliographic information to the biber program. If a .bcf
- file is not produced during a current run of *latex, but is
- leftover from a previous run, then latexmk has to conclude that
- the .tex document has changed so that biber is no longer to be
+ The use of this variable is as follows: At a number of places,
- 7 April 2024 52
+ 11 December 2024 52
@@ -3436,111 +3436,119 @@
LATEXMK(1) General Commands Manual LATEXMK(1)
+ latexmk needs to determine whether a particular file has been
+ produced during a just-concluded run of some rule/program or is
+ leftover from a previous run. (An example is the production of a
+ .bcf file by the biblatex package during a run of *latex to pro-
+ vide bibliographic information to the biber program. If a .bcf
+ file is not produced during a current run of *latex, but is
+ leftover from a previous run, then latexmk has to conclude that
+ the .tex document has changed so that biber is no longer to be
used.)
- Latexmk's criterion that a file has been produced during a run
- is that the modification time of the file is more recent than
- the system time at the beginning of the run. Bascially, if the
- modification time is earlier than this, then it is a leftover
+ Latexmk's criterion that a file has been produced during a run
+ is that the modification time of the file is more recent than
+ the system time at the beginning of the run. Bascially, if the
+ modification time is earlier than this, then it is a leftover
from a previous run. However, a naive use of the criterion can,
- among other things, run afoul of the granularity of how file
- times are stored in some file systems, which means it is possi-
- ble that the filesystem's reported time for a file might be a
- second or more earlier than the actual modification time, the
+ among other things, run afoul of the granularity of how file
+ times are stored in some file systems, which means it is possi-
+ ble that the filesystem's reported time for a file might be a
+ second or more earlier than the actual modification time, the
exact difference being quite random.
- The variable $filetime_causality_threshold allows an appopriate
- sloppiness in latexmk's use of file modification time. It can
- be quite generous; it should merely be less than the time scale
- on which a human user makes changes to source files for a docu-
+ The variable $filetime_causality_threshold allows an appopriate
+ sloppiness in latexmk's use of file modification time. It can
+ be quite generous; it should merely be less than the time scale
+ on which a human user makes changes to source files for a docu-
ment (or to configuration files, etc).
$fls_uses_out_dir [0]
- This variable determines whether or not the .fls file should be
- in the output directory instead of the natural directory, which
+ This variable determines whether or not the .fls file should be
+ in the output directory instead of the natural directory, which
is the aux directory. If the variable is nonzero, the .fls file
is to be in the output directory. See the section AUXILIARY AND
- OUTPUT DIRECTORIES for more details about these directories.
- The rationale for the existence of the variable
+ OUTPUT DIRECTORIES for more details about these directories.
+ The rationale for the existence of the variable
$fls_uses_aux_dir is explained there.
In all cases, if latexmk finds that an .fls file has been gener-
- ated in the opposite directory to the one specified by
- $fls_uses_out_dir, it copies the file to the other directory
- (aux or output directory as appropriate). The file is copied
- rather than simply moved, to avoid potential clashes with other
- software that assumes the .fls file is generated in the direc-
- tory it was written to by *latex. Thus the effect an incorrect
+ ated in the opposite directory to the one specified by
+ $fls_uses_out_dir, it copies the file to the other directory
+ (aux or output directory as appropriate). The file is copied
+ rather than simply moved, to avoid potential clashes with other
+ software that assumes the .fls file is generated in the direc-
+ tory it was written to by *latex. Thus the effect an incorrect
setting of $fls_uses_out_dir is only to cause a superfluous copy
of the .fls file to be generated.
$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', 'bcf', 'fls', 'idx', 'ind', 'lof', 'lot',
- 'out', 'toc', 'blg', 'ilg', 'log', 'xdv' )]
- This contains a list of extensions for files that are generated
- during processing, and that should be deleted during a main
- clean up operation, as invoked by the command line option -c.
- (The use of -C or -gg gives this clean up and more.)
+ 11 December 2024 53
- 7 April 2024 53
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ @generated_exts [( 'aux', 'bcf', 'fls', 'idx', 'ind', 'lof', 'lot',
+ 'out', 'toc', 'blg', 'ilg', 'log', 'xdv' )]
+ This contains a list of extensions for files that are generated
+ during processing, and that should be deleted during a main
+ clean up operation, as invoked by the command line option -c.
+ (The use of -C or -gg gives this clean up and more.)
- The default values are extensions for standard files generated
- by *latex, bibtex, and the like. (Note that the clean up also
- deletes the fdb_latexmk file, but that's separately coded into
+ The default values are extensions for standard files generated
+ by *latex, bibtex, and the like. (Note that the clean up also
+ deletes the fdb_latexmk file, but that's separately coded into
latexmk, currently.)
- After initialization of latexmk and the processing of its com-
- mand line, the items in clean_ext are appended to @gener-
- ated_exts. So these two variables have the same meaning (con-
+ After initialization of latexmk and the processing of its com-
+ mand line, the items in clean_ext are appended to @gener-
+ ated_exts. So these two variables have the same meaning (con-
trary to older versions of latexmk).
- The items in @generated_exts are normally extensions of files,
- whose base name is the same as the main tex file. But it is
- also possible to specify patterns including that basename ---
+ The items in @generated_exts are normally extensions of files,
+ whose base name is the same as the main tex file. But it is
+ also possible to specify patterns including that basename ---
see the explanation of the variable $clean_ext.
In addition to specifying files to be deleted in a clean up, la-
- texmk uses the same specification to assist its examination of
- changes in source files: Under some situations it needs to find
- those changes in files (since a previous run) that are expected
- to be due to the user editing a file. This contrasts with the
+ texmk uses the same specification to assist its examination of
+ changes in source files: Under some situations it needs to find
+ those changes in files (since a previous run) that are expected
+ to be due to the user editing a file. This contrasts with the
cases of files that are generated by some program run by latexmk
- and that differ from the results of the previous run. This use
- of @generated_exts is normally unimportant, given the usual ac-
- curacy of latexmk's other ways of determining these generated
+ and that differ from the results of the previous run. This use
+ of @generated_exts is normally unimportant, given the usual ac-
+ curacy of latexmk's other ways of determining these generated
files.
- 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 ex-
- tensions. (This extension is used by the RevTeX package, for
+ tensions. (This extension is used by the RevTeX package, for
example.)
$go_mode [0]
- If nonzero, process files regardless of timestamps, and is then
+ If nonzero, process files regardless of timestamps, and is then
equivalent to the -g option.
@@ -3547,19 +3555,11 @@
%hash_calc_ignore_pattern
!!!This variable is for experts only!!!
- The general rule latexmk uses for determining when an extra run
- of some program is needed is that one of the source files has
- changed. But consider for example a latex package that causes
- an encapsulated postscript file (an "eps" file) to be made that
- is to be read in on the next run. The file contains a comment
- line giving its creation date and time. On the next run the
- time changes, latex sees that the eps file has changed, and
- therefore reruns latex. This causes an infinite loop, that is
- only terminated because latexmk has a limit on the number of
+ The general rule latexmk uses for determining when an extra run
- 7 April 2024 54
+ 11 December 2024 54
@@ -3568,6 +3568,14 @@
LATEXMK(1) General Commands Manual LATEXMK(1)
+ 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
runs to guard against pathological situations.
But the changing line has no real effect, since it is a comment.
@@ -3576,31 +3584,31 @@
$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 expression. (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 ex-
+ ing a regular expression. (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 ex-
tension .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 ex-
- pression. The simplest method is separate the different simple
- patterns by a vertical bar character (indicating "alternation"
+ 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 ex-
+ pression. The simplest method is separate the different simple
+ patterns by a vertical bar character (indicating "alternation"
in the jargon of regular expressions). For example,
- $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate: |^%%Ti-
+ $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate: |^%%Ti-
tle: ';
causes lines starting with either "^%%CreationDate: " or "^%%Ti-
tle: " 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'};
@@ -3611,170 +3619,170 @@
$hnt_mode [0]
- Whether to generate a hnt version of the document by use of hi-
+ Whether to generate a hnt version of the document by use of hi-
latex. Can be turned on by the use of the -hnt option.
- $jobname [""]
- This specifies the jobname, i.e., the basename that is used for
- generated files (.aux, .log, .dvi, .ps, .pdf, etc). If this
- variable is a null string, then the basename is the basename of
- the main tex file. (At present, the string in $jobname should
- not contain spaces.)
+ 11 December 2024 55
- 7 April 2024 55
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ $jobname [""]
+ This specifies the jobname, i.e., the basename that is used for
+ generated files (.aux, .log, .dvi, .ps, .pdf, etc). If this
+ variable is a null string, then the basename is the basename of
+ the main tex file. (At present, the string in $jobname should
+ not contain spaces.)
- The placeholder '%A' is permitted. This will be substituted by
+ The placeholder '%A' is permitted. This will be substituted by
the basename of the TeX file. The primary purpose is when a va-
- riety of tex files are to be processed, and you want to use a
- different jobname for each but one that is distinct for each.
- Thus if you wanted to compare compilations of a set of files on
+ riety of tex files are to be processed, and you want to use a
+ different jobname for each but one that is distinct for each.
+ Thus if you wanted to compare compilations of a set of files on
different operating systems, with distinct filenames for all the
cases, you could set
$jobname = "%A-$^O";
- in an initialization file. (Here $^O is a variable provided by
+ in an initialization file. (Here $^O is a variable provided by
perl that contains perl's name for the operating system.)
- Suppose you had .tex files test1.tex and test2.tex. Then when
+ Suppose you had .tex files test1.tex and test2.tex. Then when
you run
latexmk -pdf *.tex
- both files will be compiled. The .aux, .log, and .pdf files
- will have basenames test1-MSWin32 ante test2-MSWin32 on a MS-
+ both files will be compiled. The .aux, .log, and .pdf files
+ will have basenames test1-MSWin32 ante test2-MSWin32 on a MS-
Windows system, test1-darwin and test2-darwin on an OS-X system,
and a variety of similar cases on linux systems.
$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-
+ 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, no-
tably 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,
+ 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 la-
+ (For advanced users: Because of the different way in which la-
texmk uses the command specified in $kpsewhich, some of the pos-
sibilities listed in the FORMAT OF COMMAND SPECIFICATIONS do not
- apply. The internal and start keywords are not available. A
+ 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
+ 11 December 2024 56
- 7 April 2024 56
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ .bib files.
- are also shown.) Without these diagnostics there is nothing
- visible in latexmk's screen output about invocations of kpse-
+ $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-
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"]
- Specifies the command line for the LaTeX processing program.
- Note that as with other programs, you can use this variable not
- just to change the name of the program used, but also specify
+ Specifies the command line for the LaTeX processing program.
+ Note that as with other programs, 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 %O %S";
- To do a coordinated setting of all of $dvilualatex, $hilatex,
+ To do a coordinated setting of all of $dvilualatex, $hilatex,
$latex, $pdflatex, $lualatex, and $xelatex, see the section "Ad-
vanced Configuration".
%latex_input_extensions
- This variable specifies the extensions tried by latexmk when it
- finds that a LaTeX run resulted in an error that a file has not
- been found, and the file is given without an extension. This
- typically happens when LaTeX commands of the form \input{file}
- or \includegraphics{figure}, when the relevant source file does
+ This variable specifies the extensions tried by latexmk when it
+ finds that a LaTeX run resulted in an error that a file has not
+ been found, and the file is given without an extension. This
+ typically happens when LaTeX commands of the form \input{file}
+ or \includegraphics{figure}, when the relevant source file does
not exist.
- In this situation, latexmk searches for custom dependencies to
- make the missing file(s), but restricts it to the extensions
- specified by the variable %latex_input_extensions. The default
+ In this situation, latexmk searches for custom dependencies to
+ make the missing file(s), but restricts it to the extensions
+ specified by the variable %latex_input_extensions. The default
extensions are 'tex' and 'eps'.
- (For Perl experts: %latex_input_extensions is a hash whose keys
- are the extensions. The values are irrelevant.) Two subrou-
- tines are provided for manipulating this and the related vari-
- able %pdflatex_input_extensions, add_input_ext and remove_in-
- put_ext. They are used as in the following examples are possi-
+ (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_in-
+ put_ext. They are used as in the following examples are possi-
ble lines in an initialization file:
remove_input_ext( 'latex', 'tex' );
- removes the extension 'tex' from latex_input_extensions
- add_input_ext( 'latex', 'asdf' );
- add the extension 'asdf to latex_input_extensions. (Naturally
- with such an extension, you should have made an appropriate cus-
- tom dependency for latexmk, and should also have done the appro-
- priate programming in the LaTeX source file to enable the file
+ 11 December 2024 57
- 7 April 2024 57
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ removes the extension 'tex' from latex_input_extensions
+ add_input_ext( 'latex', 'asdf' );
- to be read. The standard extensions are handled by LaTeX and
+ add the extension 'asdf to latex_input_extensions. (Naturally
+ with such an extension, you should have made an appropriate cus-
+ tom dependency for latexmk, and should also have done the appro-
+ priate programming in the LaTeX source file to enable the file
+ to be read. The standard extensions are handled by LaTeX and
its graphics/graphicx packages.)
$latex_silent_switch ["-interaction=batchmode"]
- Switch(es) for the LaTeX processing program when silent mode is
+ 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-er-
@@ -3784,7 +3792,7 @@
$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":
@@ -3791,12 +3799,12 @@
$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.
@@ -3806,50 +3814,50 @@
$lpr_pdf ["NONE lpr_pdf"]
The printing program to print pdf files.
- Under MS-Windows you could set this to use gsview, if it is in-
+ Under MS-Windows you could set this to use gsview, if it is in-
stalled, 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
- the name: this is necessary because one part of the command name
- ("Program Files") contains a space which would otherwise be mis-
- interpreted.
+ If gsview is installed in a different directory, you will need
- $lualatex ["lualatex %O %S"]
- Specifies the command line for the LaTeX processing program that
- is to be used when the lualatex program is called for (e.g., by
+ 11 December 2024 58
- 7 April 2024 58
-
LATEXMK(1) General Commands Manual LATEXMK(1)
+ 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"]
+ Specifies the command line for the LaTeX processing program that
+ is to be used when the lualatex program is called for (e.g., by
the option -lualatex.
- To do a coordinated setting of all of $dvilualatex, $hilatex,
+ To do a coordinated setting of all of $dvilualatex, $hilatex,
$latex, $pdflatex, $lualatex, and $xelatex, see the section "Ad-
vanced Configuration".
%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 \in-
- put{file} or \includegraphics{figure}, when the relevant source
+ 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 \in-
+ put{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 de-
+ 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 de-
fault extensions are 'tex', 'pdf', 'jpg, and 'png'.
See details of the %latex_input_extensions for other information
@@ -3856,10 +3864,10 @@
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"]
@@ -3869,37 +3877,36 @@
The index processing program.
$makeindex_fudge [0]
- When using makeindex, whether to change directory to $aux_dir
- before running makeindex. Set to 1 if $aux_dir is not an ex-
- plicit subdirectory of current directory, otherwise makeindex
+ When using makeindex, whether to change directory to $aux_dir
+ before running makeindex. Set to 1 if $aux_dir is not an ex-
+ plicit subdirectory of current directory, otherwise makeindex
will refuse to write its output and log files, for security rea-
sons.
$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 before de-
- ciding that there may be an infinite loop and that it needs to
- bail out, rather than rerunning *latex 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
+ 11 December 2024 59
- 7 April 2024 59
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ $max_repeat [5]
+ The maximum number of times latexmk will run *latex before de-
+ ciding that there may be an infinite loop and that it needs to
+ bail out, rather than rerunning *latex 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 *la-
+ tex generates files to be read in on a later run.)
- *latex generates files to be read in on a later run.)
-
$MSWin_back_slash [1]
This configuration variable only has an effect when latexmk is
running under MS-Windows. With the default value of 1 for this
@@ -3944,54 +3951,55 @@
fault, then other generated files are in effect written to the
output directory.
- If $out_dir is blank, the output directory is the current direc-
- tory at the invocation of *latex; this is equivalent to setting
- $out_dir to '.'.
+ If $out_dir is blank, the output directory is the current
- See the section AUXILIARY AND OUTPUT DIRECTORIES for more de-
- tails.
+ 11 December 2024 60
- 7 April 2024 60
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ directory at the invocation of *latex; this is equivalent to
+ setting $out_dir to '.'.
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ See the section AUXILIARY AND OUTPUT DIRECTORIES for more de-
+ tails.
+
$out2_dir [""]
(Experimental new feature.)
- If non-blank, this variable specifies the final-output direc-
- tory, i.e., the directory for the final output files. If this
- variable is blank (its default value), the final-output direc-
+ If non-blank, this variable specifies the final-output direc-
+ tory, i.e., the directory for the final output files. If this
+ variable is blank (its default value), the final-output direc-
tory is the same as the output directory.
See the description of the option -out2dir for an explanation of
- the rationale for the idea of separate output and final-output
+ the rationale for the idea of separate output and final-output
directories.
- If the final-output directory is different from the output di-
- rectory, then after a full round of compilations of the docu-
- ment, the relevant set of files is copied here from the output
- directory. The files copied are specified by the @out2_exts
+ If the final-output directory is different from the output di-
+ rectory, then after a full round of compilations of the docu-
+ ment, the relevant set of files is copied here from the output
+ directory. The files copied are specified by the @out2_exts
variable, and by default are those with extensions 'hnt', 'pdf',
- 'ps', 'synctex', 'synctex.gz', and a basename the same as for
+ 'ps', 'synctex', 'synctex.gz', and a basename the same as for
the main *latex compilation.
@out2_exts [( 'hnt', 'pdf', 'ps', 'synctex', 'synctex.gz' )]
- This variable lists the extensions of the files to be copied to
- the final-output directory. The basename of the files is that
- for the main *latex compilation (corresponding to the value
- specified by the placeholder %R). More general names may be
- specified in the same way as for the @generated_exts variable,
+ This variable lists the extensions of the files to be copied to
+ the final-output directory. The basename of the files is that
+ for the main *latex compilation (corresponding to the value
+ specified by the placeholder %R). More general names may be
+ specified in the same way as for the @generated_exts variable,
by inclusion of %R in a pattern, e.g.,
push @out2_exts, '%R-2up.pdf';
@@ -3999,37 +4007,37 @@
$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-
+ 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 us-
ing lualatex, using the command specified by the $lualatex vari-
- able. If equal to 5, generate a pdf version (and an xdv ver-
- sion) of the document using xelatex, using the commands speci-
- fied by the $xelatex and xdvipdfmx variables.
+ able. If equal to 5, generate a pdf version (and an xdv ver-
+ sion) of the document using xelatex, using the commands
- 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. But this may be overridden by the document.
- $pdflatex ["pdflatex %O %S"]
- Specifies the command line for the LaTeX processing program in a
+ 11 December 2024 61
- 7 April 2024 61
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ specified 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
+ made. But this may be overridden by the document.
+ $pdflatex ["pdflatex %O %S"]
+ Specifies the command line for 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
@@ -4037,28 +4045,28 @@
$pdflatex = "pdflatex --shell-escape %O %S";
- (In some earlier versions of latexmk, you needed to use an as-
- signment to $pdflatex to allow the use of lualatex or xelatex
+ (In some earlier versions of latexmk, you needed to use an as-
+ signment 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.)
- To do a coordinated setting of all of $dvilualatex, $hilatex,
+ To do a coordinated setting of all of $dvilualatex, $hilatex,
$latex, $pdflatex, $lualatex, and $xelatex, see the section "Ad-
vanced Configuration".
%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 \in-
- put{file} or \includegraphics{figure}, when the relevant source
+ 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 \in-
+ put{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 de-
+ 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 de-
fault extensions are 'tex', 'pdf', 'jpg, and 'png'.
See details of the %latex_input_extensions for other information
@@ -4065,66 +4073,67 @@
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 """; un-
- der more recent versions of Windows, this will cause to be run
- whatever command the system has associated with .pdf files. But
- this may be undesirable if this association is to acroread --
- see the notes in the explanation of the -pvc option.]
+ On MS-Windows, the default is changed to "cmd /c start """; un-
+ der more recent versions of Windows, this will cause to be run
- 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.
+ 11 December 2024 62
- 7 April 2024 62
-
LATEXMK(1) General Commands Manual LATEXMK(1)
- 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
+ whatever command the system has associated with .pdf files. But
+ this may be undesirable if this association is to acroread --
+ see the notes in the explanation of the -pvc option.]
+
+ On OS-X the default is changed to "open %S", which results in
+ OS-X starting up (and detaching) the viewer associated with the
+ file. By default, for pdf files this association is to OS-X's
+ preview, which is quite satisfactory.
+
+ WARNING: Problem under MS-Windows: if acroread is used as the
+ pdf previewer, and it is actually viewing a pdf file, the pdf
+ file cannot be updated. Thus makes acroread a bad choice of
+ previewer if you use latexmk's previous-continuous mode (option
-pvc) under MS-windows. This problem does not occur if, for ex-
ample, SumatraPDF or gsview is used to view pdf files.
- Important note: Normally you will want to have a previewer run
+ Important note: Normally you will want to have a previewer run
detached, so that latexmk doesn't wait for the previewer to ter-
- minate before continuing its work. So normally you should pre-
- fix the command by "start ", which flags to latexmk that it
- should do the detaching of the previewer itself (by whatever
- method is appropriate to the operating system). But sometimes
+ minate before continuing its work. So normally you should pre-
+ fix the command by "start ", which flags to latexmk that it
+ should do the detaching of the previewer itself (by whatever
+ method is appropriate to the operating system). But sometimes
letting latexmk do the detaching is not appropriate (for a vari-
- ety of non-trivial reasons), so you should put the "start " bit
+ ety of non-trivial reasons), so you should put the "start " bit
in yourself, whenever it is needed.
$pdf_update_command [""]
- When the pdf previewer is set to be updated by running a com-
- mand, this is the command that is run. See the information for
+ When the pdf previewer is set to be updated by running a com-
+ mand, this is the command that is run. See the information for
the variable $pdf_update_method.
$pdf_update_method [1 under UNIX, 3 under MS-Windows]
- How the pdf viewer updates its display when the pdf file has
- changed. See the information on the variable $dvi_update_method
+ How the pdf viewer updates its display when the pdf file has
+ changed. See the information on the variable $dvi_update_method
for the codes. (Note that information needs be changed slightly
- so that for the value 4, to run a command to do the update, the
- command is specified by the variable $pdf_update_command, and
- for the value 2, to specify update by signal, the signal is
+ so that for the value 4, to run a command to do the update, the
+ command is specified by the variable $pdf_update_command, and
+ for the value 2, to specify update by signal, the signal is
specified by $pdf_update_signal.)
Note that acroread under MS-Windows (but not UNIX) locks the pdf
@@ -4137,52 +4146,52 @@
$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 up-
- dating to be done in response to a command, and the third set-
- ting sets the update command.
+ 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 up-
+ dating to be done in response to a command, and the third
- $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 ap-
- propriate for gv on a UNIX system.
+ 11 December 2024 63
- 7 April 2024 63
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ setting sets the update command.
+ $pdf_update_signal [Under UNIX: SIGHUP, which is a system-dependent
+ value]
+ The number of the signal that is sent to the pdf viewer when it
+ is updated by sending a signal -- see the information on the
+ variable $pdf_update_method. The default value is the one ap-
+ propriate 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.
$pre_tex_code ['']
- Sets TeX code to be executed before inputting the source file.
- This works if the relevant one of $latex, etc contains a suit-
+ Sets TeX code to be executed before inputting the source file.
+ This works if the relevant one of $latex, etc contains a suit-
able command line with a %P or %U substitution. For example you
could do
@@ -4189,7 +4198,7 @@
$latex = 'latex %O %P';
$pre_tex_code = '\AtBeginDocument{An initial message\par}';
- To set all of $latex, $pdflatex, $lualatex, and $xelatex you
+ To set all of $latex, $pdflatex, $lualatex, and $xelatex you
could use the subroutine alt_tex_cmds:
&alt_tex_cmds;
@@ -4198,54 +4207,53 @@
$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.
+ to the -pv option. Which previewer is run depends on the other
+ settings, see the command line options -view=, and the variable
- $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.
+ 11 December 2024 64
- 7 April 2024 64
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ $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.
@@ -4254,46 +4262,47 @@
$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-
+ The command to invoke a ps-previewer. (The default under MS-
Windows will cause to be run whatever command the system has as-
sociated 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.
+ Important note: Normally you will want to have a previewer run
+ detached, so that latexmk doesn't wait for the previewer to
+ 11 December 2024 65
- 7 April 2024 65
-
LATEXMK(1) General Commands Manual LATEXMK(1)
+ terminate before continuing its work. So normally you should
+ prefix the command by "start ", which flags to latexmk that it
+ should do the detaching of the previewer itself (by whatever
+ method is appropriate to the operating system). But sometimes
+ letting latexmk do the detaching is not appropriate (for a vari-
+ ety of non-trivial reasons), so you should put the "start " bit
+ in yourself, whenever it is needed.
+
+
$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.
@@ -4340,26 +4349,26 @@
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 cannot correctly deal with TeX files whose names contain
- spaces. Latexmk's quoting only ensures that such filenames are
- correctly treated by the operating system in passing arguments
- to programs.)
+ 11 December 2024 66
- 7 April 2024 66
-
LATEXMK(1) General Commands Manual LATEXMK(1)
+ 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 cannot correctly deal with TeX files whose names contain
+ spaces. Latexmk's quoting only ensures that such filenames are
+ correctly treated by the operating system in passing arguments
+ to programs.)
+
$rc_report [1]
After initialization, whether to give a list of the RC files
read.
@@ -4405,27 +4414,27 @@
software is running under an emulator for the other kind of op-
erating 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 time used, both the total and for individual
- steps.
- Note: On MS Windows, this is clock time. On other OSs it is the
- CPU time used (by latexmk and the child processes it invokes).
+ 11 December 2024 67
- 7 April 2024 67
+LATEXMK(1) General Commands Manual LATEXMK(1)
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ goes, of course, for unusual operating systems that are not in
+ the MSWin, Linux, OS-X, Unix collection.)
+ $show_time [0]
+ Whether to show time used, both the total and for individual
+ steps.
+ Note: On MS Windows, this is clock time. On other OSs it is the
+ CPU time used (by latexmk and the child processes it invokes).
The OS-dependence is because of a limitation of Windows. If you
wish to force the use of clock instead of CPU time, you can set
@@ -4473,125 +4482,156 @@
compilation may take well under a second.
- $texfile_search [""]
- 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
- then latexmk replaces @default_files with the filenames in
+ 11 December 2024 68
- 7 April 2024 68
+LATEXMK(1) General Commands Manual LATEXMK(1)
+ $texfile_search [""]
+ This is an obsolete variable, replaced by the @default_files
+ variable.
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ 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".
-
- $texfile_search to which is added "*.tex".
-
$success_cmd [undefined]
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 $tm-
- pdir to the value of the first of whichever of the system envi-
- ronment variables TMPDIR or TEMP exists, otherwise to the cur-
- rent 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
+ The default under MSWindows (including cygwin), is to set $tm-
+ pdir to the value of the first of whichever of the system envi-
+ ronment variables TMPDIR or TEMP exists, otherwise to the cur-
+ rent 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, 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 pro-
+ a run of *latex, 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 pro-
gram.
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
- value of "default" means that the "highest" of the kinds of file
- generated is to be used (among .dvi, .ps and .pdf).
+ $user_deleted_file_treated_as_changed [0]
+ Whether when testing for changed files, a user file that changes
+ status from existing to non-existing should be regarded as
+ changed.
- $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.
+ The default value is 0, which implies that if a user file (as
+ opposed to a generated file) has been deleted since the previous
+ run, then no recompilation should be done. The reasoning is
+ that a rerun would simply produce an error.
- 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 la-
- texmk to treat such warnings as errors, but only when they occur
- on the last run of *latex and only after processing is complete.
+ If the value is 1, then disappearance of a user file is treated
+ as triggering a rerun, but only in non-preview-continuous mode.
+ If the value is 2, then disappearance of a user file is treated
- 7 April 2024 69
+ 11 December 2024 69
+
LATEXMK(1) General Commands Manual LATEXMK(1)
- A non-zero value $warnings_as_errors can be set by the command-
+ as triggering a rerun, always.
+
+
+ $view ["default"]
+ Which kind of file is to be previewed if a previewer is used.
+ The possible values are "default", "dvi", "hnt", "ps", "pdf",
+ "none". The value of "default" means that the "highest" of the
+ kinds of file generated is to be used (among .dvi, .hnt, .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 la-
+ texmk to treat such warnings as errors, but only when they occur
+ on the last run of *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
+ 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 *latex are generally
- needed to resolve references and citations, what matters is not
+ 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-
+ 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
+ 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.)
+
+
+
+
+ 11 December 2024 70
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
$xdv_mode [0]
- If one, generate an xdv version of the document by use of xela-
+ If one, generate an xdv version of the document by use of xela-
tex.
$xdvipdfmx ["xdvipdfmx -E -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"]
@@ -4598,58 +4638,58 @@
Switch(es) for the xdvipdfmx program when silent mode is on.
$xelatex ["xelatex %O %S"]
- Specifies the command line for the LaTeX processing program of
- when the xelatex program is called for. See the documentation
- of the -xelatex option for some special properties of latexmk's
+ Specifies the command line for the LaTeX processing program of
+ when the xelatex program is called for. See the documentation
+ of the -xelatex option for some special properties of latexmk's
use of xelatex.
- Note about xelatex: latexmk uses xelatex to make an .xdv rather
- than .pdf file, with the .pdf file being created in a separate
+ Note about xelatex: latexmk uses xelatex to make an .xdv rather
+ than .pdf file, with the .pdf file being created in a separate
step. This is enforced by the use of the -no-pdf option. If %O
- is part of the command for invoking xelatex, then latexmk will
+ is part of the command for invoking xelatex, then latexmk will
insert the -no-pdf option automatically, otherwise you must pro-
- vide the option yourself. See the documentation for the -pdfxe
+ vide the option yourself. See the documentation for the -pdfxe
option for why latexmk makes a .xdv file rather than a .pdf file
when xelatex is used.
+ To do a coordinated setting of all of $dvilualatex, $hilatex,
+ $latex, $pdflatex, $lualatex, and $xelatex, see the section "Ad-
+ vanced Configuration".
+ %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 \in-
+ put{file} or \includegraphics{figure}, when the relevant source
+ file does not exist.
- 7 April 2024 70
+ 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 de-
+ fault extensions are 'tex', 'pdf', 'jpg, and 'png'.
+ 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
+ $xelatex) when silent mode is on.
+ See details of the $latex_silent_switch for other information
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ 11 December 2024 71
- To do a coordinated setting of all of $dvilualatex, $hilatex,
- $latex, $pdflatex, $lualatex, and $xelatex, see the section "Ad-
- vanced Configuration".
- %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 \in-
- put{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 de-
- fault extensions are 'tex', 'pdf', 'jpg, and 'png'.
- See details of the %latex_input_extensions for other information
- that equally applies to %xelatex_input_extensions.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- $xelatex_silent_switch ["-interaction=batchmode"]
- 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
that equally applies to $xelatex_silent_switch.
@@ -4656,7 +4696,7 @@
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.
@@ -4664,9 +4704,9 @@
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.
A better method is to use the subroutines that allow convenient manipu-
@@ -4678,20 +4718,8 @@
The arguments are as follows:
-
-
-
- 7 April 2024 71
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
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:
@@ -4698,27 +4726,39 @@
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.
+ we are converting from doesn't exist, then no action is taken.
Generally, the appropriate value of must is zero.
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 func-
- tion should return 0 if it was successful and a nonzero number
+ 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
+ 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
+
+
+
+ 11 December 2024 72
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
new one.
- The subroutine remove_cus_dep removes the specified custom dependency.
+ 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.
@@ -4725,169 +4765,158 @@
How custom dependencies are used:
An instance of a custom dependency rule is created whenever latexmk de-
- tects that a run of *latex needs to read a file, like a graphics file,
- whose extension is the to-extension of a custom dependency. Then la-
- texmk examines whether a file exists with the same name, but with the
- corresponding from-extension, as specified in the custom-dependency.
- If it does, then a corresponding instance of the custom dependency is
- created, after which the rule is invoked whenever the destination file
+ tects that a run of *latex needs to read a file, like a graphics file,
+ whose extension is the to-extension of a custom dependency. Then la-
+ texmk examines whether a file exists with the same name, but with the
+ corresponding from-extension, as specified in the custom-dependency.
+ If it does, then a corresponding instance of the custom dependency is
+ created, after which the rule is invoked whenever the destination file
(the one with the to-extension) is out-of-date with respect to the cor-
responding source file.
- To make the new destination file, the Perl subroutine specified in the
+ 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,
+ 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,
experts could do something much more elaborate.
- One item in the specification of each custom-dependency rule, labeled
- "must" above, specifies how the rule should be applied when the source
+ One 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.
-
-
- 7 April 2024 72
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
- When latex reports that an input file (e.g., a graphics file) does not
+ When latex reports that an input file (e.g., a graphics file) does not
exist, latexmk tries to find a source file and a custom dependency that
can be used to make it. If it succeeds, then it creates an instance of
- the custom dependency and invokes it to make the missing file, after
+ the custom dependency and invokes it to make the missing file, after
which the next pass of latex etc will be able to read the newly created
file.
- Note for advanced usage: The operating system's environment variable
+ Note for advanced usage: The operating system's environment variable
TEXINPUTS can be used to specify a search path for finding files by la-
- tex etc. Correspondingly, when a missing file is reported, latexmk
- looks in the directories specified in TEXINPUTS as well as in the cur-
- rent directory, to find a source file from which an instance of a cus-
+ tex etc. Correspondingly, when a missing file is reported, latexmk
+ looks in the directories specified in TEXINPUTS as well as in the cur-
+ rent directory, to find a source file from which an instance of a cus-
tom dependency can be used to make the missing file.
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' );
+
+
+
+ 11 December 2024 73
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
sub fig2eps {
system( "fig2dev -Leps \"$_[0].fig\" \"$_[0].eps\"" );
}
- The first line adds a custom dependency that converts a file with ex-
+ The first line adds a custom dependency that converts a file with ex-
tension "fig", as created by the xfig program, to an encapsulated post-
- script file, with extension "eps". The remaining lines define a sub-
- routine 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
+ script file, with extension "eps". The remaining lines define a sub-
+ routine 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, lualatex or xelatex instead of latex, then you
+ If you use pdflatex, lualatex or xelatex 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 (im-
+ plemented 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 nor-
+ mally 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.
- 7 April 2024 73
+ 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
+ 11 December 2024 74
-LATEXMK(1) General Commands Manual LATEXMK(1)
- 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\"" );
- }
+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 (im-
- plemented 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 nor-
- mally 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
+ 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
+ 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();
-
-
-
- 7 April 2024 74
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
in an initialization file.
@@ -4894,29 +4923,41 @@
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 la-
+ file. This method has been available since very old versions of la-
texmk, and many examples can be found, e.g., on the web.
- However in later versions of latexmk the internal structure of the im-
+ However in later versions of latexmk the internal structure of the im-
plementation of its "rules" for the steps of processing, including cus-
tom dependencies, became much more powerful. The function implementing
a custom dependency is executed within a special context where a number
- of extra variables and subroutines are defined. Publicly documented
- ones, intended to be long-term stable, are listed below, under the
+ of extra variables and subroutines are defined. Publicly documented
+ 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 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
+ The only index-file conversion built-in to latexmk is from an ".idx"
+ file written on one run of *latex 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
+
+
+
+ 11 December 2024 75
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
+ 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 extension .ndx to
- .nnd. The most elementary method is to define a custom dependency as
+ will need to get latexmk to convert files with the extension .ndx to
+ .nnd. The most elementary method is to define a custom dependency as
follows:
add_cus_dep( 'ndx', 'nnd', 0, 'ndx2nnd' );
@@ -4925,14 +4966,14 @@
}
push @generated_exts, 'ndx', 'nnd';
- 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' );
@@ -4942,18 +4983,6 @@
}
push @generated_exts, 'ndx', 'nnd', 'adx', 'and';
-
-
-
- 7 April 2024 75
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
You could also instead use
add_cus_dep( 'ndx', 'nnd', 0, 'dx2nd' );
@@ -4963,37 +4992,49 @@
}
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 and is always later than
+ .ndx file is written during a run of *latex 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 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
+ 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
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.
+ 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.
+
+
+
+ 11 December 2024 76
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
For real experts: See the %hash_calc_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.
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";
@@ -5001,93 +5042,81 @@
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
+ this is what is used in the rc files.
+ In this section, I include first, a description of a number of vari-
+ ables and subroutines that provide, among other things, access to la-
+ texmk's internal data structures for handling dependencies. Then I de-
+ scribe the hook mechanism whereby at certain points in the processing,
+ latexmk can call user-defined subroutines.
+ 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
- 7 April 2024 76
+ 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
-LATEXMK(1) General Commands Manual LATEXMK(1)
+ 11 December 2024 77
-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
- this is what is used in the rc files.
- In this section, I include first, a description of a number of vari-
- ables and subroutines that provide, among other things, access to la-
- texmk's internal data structures for handling dependencies. Then I de-
- scribe the hook mechanism whereby at certain points in the processing,
- latexmk can call user-defined subroutines.
- 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
+LATEXMK(1) General Commands Manual LATEXMK(1)
- 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-
+ 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
+ When you use a subroutine for processing a rule, all the possibilities
of Perl programming are available, of course. In addition, some of la-
- texmk's internal variables and subroutines are available. The ones
- listed below are intended to be available to (advanced) users, and
+ texmk'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
$$Pbase
- This gives the basename for the rule. Generally, it determines
- the names of generated files. E.g., for a run of *latex, the
+ This gives the basename for the rule. Generally, it determines
+ the names of generated files. E.g., for a run of *latex, the
name of the .log file is the aux directory concatenated with the
basename and then `.log'.
- For a *latex rule, the basename is without a directory compo-
- nent. For other rules, it includes the directory component (if
+ For a *latex rule, the basename is without a directory compo-
+ nent. For other rules, it includes the directory component (if
any is used).
This (annoying) difference is associated with the different ways
- in which the commands invoked by latexmk work when the command
+ in which the commands invoked by latexmk work when the command
line includes a name for a source file that includes a directory
-
-
-
- 7 April 2024 77
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
component. For the *latex commands, the directory of the source
- file is irrelevant to the directory component the generated
+ file is irrelevant to the directory component the generated
files, which instead is determined by the values in the -aux-di-
rectory and/or -output-directory options.
@@ -5096,21 +5125,33 @@
with a changed extension.
Note the double dollar signs: In Perl terms, the variable $Pbase
- is a reference to a variable that contains the basename. The
- second dollar sign derefences the reference to give the actual
- value. (A reference is is used rather like a pointer, and the
- `P' (for `pointer') at the start of the variable name is a con-
- vention used in latexmk to indicate that the variable is a ref-
+ is a reference to a variable that contains the basename. The
+ second dollar sign derefences the reference to give the actual
+ value. (A reference is is used rather like a pointer, and the
+ `P' (for `pointer') at the start of the variable name is a con-
+ vention used in latexmk to indicate that the variable is a ref-
erence variable.)
$$Pdest
- This gives the name of the main output file if any. Note the
+ This gives the name of the main output file if any. Note the
double dollar signs.
$$Psource
This gives the name of the primary source file. Note the double
+
+
+
+ 11 December 2024 78
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
dollar signs.
@@ -5118,11 +5159,11 @@
See the section `Hooks' for more details.
This adds the subroutine specified in the second argument to la-
- texmk's stack of hooks specified by the stack name. It returns
- 1 on sucess, and zero otherwise (e.g., if the specified hook
+ texmk's stack of hooks specified by the stack name. It returns
+ 1 on sucess, and zero otherwise (e.g., if the specified hook
stack doesn't exist).
- The subroutine can be specified by a reference to the subrou-
+ The subroutine can be specified by a reference to the subrou-
tine, as in
add_hook( 'after_xlatex_analysis', mmz_analyze )
@@ -5130,70 +5171,71 @@
Given that the subroutine mmz_analyze has been defined in the rc
file.
- The subroutine can be specified by a string whose value is the
+ The subroutine can be specified by a string whose value is the
name of the subroutine, e.g.,
add_hook( 'after_xlatex_analysis', 'mmz_analyze' )
- In simple cases, the subroutine can be an anonymous subroutine
+ In simple cases, the subroutine can be an anonymous subroutine
defined in the call to add_hooks,
- add_hook( 'after_main_pdf', sub{ print
+ add_hook( 'after_main_pdf', sub{ print "TEST\n"; return 0; }
+ );
+ Observe that on success, the subroutine should return 0 (like a
+ call to Perl's system subroutine), so normally this should be
+ coded explicitly. If a hook subroutine returns a non-zero
+ value, latexmk treats that as an error condition.
- 7 April 2024 78
+ ensure_path( var, values ...)
+ The first parameter is the name of one of the system's environ-
+ ment variables for search paths. The remaining parameters are
+ values that should be in the variable. For each of the value
+ parameters, if it isn't already in the variable, then it is
+ prepended to the variable; in that case the environment variable
+ is created if it doesn't already exist. For separating values,
+ the character appropriate the the operating system is used --
+ see the configuration variable $search_path_separator.
+ Example:
+ ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );
+ (In this example, the trailing '//' is documented by TeX systems
+ to mean that *latex search for files in the specified directory
-LATEXMK(1) General Commands Manual LATEXMK(1)
- Observe that on success, the subroutine should return 0 (like a
- call to Perl's system subroutine), so normally this should be
- coded explicitly. If a hook subroutine returns a non-zero
- value, latexmk treats that as an error condition.
+ 11 December 2024 79
- ensure_path( var, values ...)
- The first parameter is the name of one of the system's environ-
- ment variables for search paths. The remaining parameters are
- values that should be in the variable. For each of the value
- parameters, if it isn't already in the variable, then it is
- prepended to the variable; in that case the environment variable
- is created if it doesn't already exist. For separating values,
- the character appropriate the the operating system is used --
- see the configuration variable $search_path_separator.
- Example:
+LATEXMK(1) General Commands Manual LATEXMK(1)
- ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );
- (In this example, the trailing '//' is documented by TeX systems
- to mean that *latex search for files in the specified directory
and in all subdirectories.)
- Technically ensure_path works by setting Perl's variable
- $ENV{var}, where var is the name of the target variable. The
- changed value is then passed as an environment variable to any
+ Technically ensure_path works by setting Perl's variable
+ $ENV{var}, where var is the name of the target variable. The
+ changed value is then passed as an environment variable to any
invoked programs.
pushd( path ), popd()
- These subroutines are used when it is needed to temporarily
+ These subroutines are used when it is needed to temporarily
change the working directory, as in
pushd( 'some_directory' );
- ... Processing done with 'some_directory' as the working
+ ... Processing done with 'some_directory' as the working
directory
popd()
- They perform exactly the same function as the commands of the
+ They perform exactly the same function as the commands of the
same names in operating system command shells like bash on Unix,
and cmd.exe on the Windows.
@@ -5200,101 +5242,90 @@
rdb_add_generated( file, ... )
This subroutine is to be used in the context of a rule, that is,
- from within a subroutine that is carrying out processing of a
+ from within a subroutine that is carrying out processing of a
rule. Such is the case for the subroutine implementing a custom
- dependency, or the subroutine invoked by using the "internal"
- keyword in the command specification like that in the variable
+ dependency, or the subroutine invoked by using the "internal"
+ keyword in the command specification like that in the variable
$latex.
+ Its arguments are a sequence of filenames which are generated
+ during the running of the rule. The names might arise from an
+ analysis of the results of the run, e.g., in a log file, or from
+ knowledge of properties of the specific rule. Calling
+ rdb_add_generated with these filenames ensures that these files
+ are flagged as generated by the rule in latexmk's internal data
+ structures. Basically, no action is taken if the files have al-
+ ready been flagged as generated.
+ A main purpose of using this subroutine is for the situation
+ when a generated file is also the source file for some rule, so
+ that latexmk can correctly link the dependency information in
+ its network of rules.
+ Note: Unlike some other subroutines in this section, there is no
+ argument for a rule for rdb_add_generated. Instead, the subrou-
+ tine is to be invoked during the processing of a rule when la-
+ texmk has set up an appropriate context (i.e., appropriate vari-
+ ables). In contrast, subroutines with a rule argument can be
+ used also outside a rule context.
- 7 April 2024 79
+ rdb_ensure_file( $rule, file )
+ This subroutine ensures that the given file is among the source
+ 11 December 2024 80
-LATEXMK(1) General Commands Manual LATEXMK(1)
- Its arguments are a sequence of filenames which are generated
- during the running of the rule. The names might arise from an
- analysis of the results of the run, e.g., in a log file, or from
- knowledge of properties of the specific rule. Calling
- rdb_add_generated with these filenames ensures that these files
- are flagged as generated by the rule in latexmk's internal data
- structures. Basically, no action is taken if the files have al-
- ready been flagged as generated.
- A main purpose of using this subroutine is for the situation
- when a generated file is also the source file for some rule, so
- that latexmk can correctly link the dependency information in
- its network of rules.
- Note: Unlike some other subroutines in this section, there is no
- argument for a rule for rdb_add_generated. Instead, the subrou-
- tine is to be invoked during the processing of a rule when la-
- texmk has set up an appropriate context (i.e., appropriate vari-
- ables). In contrast, subroutines with a rule argument can be
- used also outside a rule context.
+LATEXMK(1) General Commands Manual LATEXMK(1)
- rdb_ensure_file( $rule, file )
- This subroutine 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
+ 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
+ default methods don't find the dependency. Almost always the
+ first argument is the name of the rule currently being
processed, 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, exceltex_la-
- texmkrc and texinfo-latexmkrc. These illustrate typical cases
- where latexmk's normal processing fails to detect certain extra
+ 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, exceltex_la-
+ texmkrc and texinfo-latexmkrc. These illustrate typical cases
+ where latexmk's normal processing fails to detect certain extra
source files.
Note that rdb_ensure_file only has one filename argument, unlike
other subroutines in this section. If you want to apply its ac-
- tion to multiple files, you will need one call to rdb_en-
+ tion to multiple files, you will need one call to rdb_en-
sure_file for each file.
rdb_ensure_files_here( file, ... )
Like subroutine rdb_ensure_files, except that (a) it assumes the
- context is of a rule, and the files are to be added to the
+ context is of a rule, and the files are to be added to the
source list for that rule; (b) multiple files are allowed.
rdb_remove_files( $rule, file, ... )
- This subroutine removes one or more files from the dependency
+ This subroutine removes one or more files from the dependency
list for the given rule.
-
-
- 7 April 2024 80
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
rdb_remove_generated( file, ... )
This subroutine is to be used in the context of a rule, that is,
- from within a subroutine that is carrying out processing of a
- rule. It performs the opposite action to rdb_add_generated.
- Its effect is to ensure that the given filenames are not listed
- in latexmk's internal data structures as being generated by the
+ from within a subroutine that is carrying out processing of a
+ rule. It performs the opposite action to rdb_add_generated.
+ Its effect is to ensure that the given filenames are not listed
+ in latexmk's internal data structures as being generated by the
rule.
rdb_list_source( $rule )
- This subroutine returns the list of source files (i.e., the de-
+ This subroutine returns the list of source files (i.e., the de-
pendency list) for the given rule.
@@ -5302,14 +5333,26 @@
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.
+ in the newly specified list of files are removed from the
+
+ 11 December 2024 81
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
+ dependency 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
@@ -5338,18 +5381,6 @@
In addition, latexmk makes allowance for the possiblity that
files are hosted on a different computer than that running la-
texmk and that the system clock times on the two computers are
-
-
-
- 7 April 2024 81
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
mismatched. Latexmk automatically detects (and reports) any
significant mismatch and corrects for it.
@@ -5374,6 +5405,17 @@
To be able to use the string provided by the -pretex option (if any),
you can use
+
+
+ 11 December 2024 82
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
&alt_tex_cmds;
This results in $latex = 'latex %O %P', etc. Again note the ampersand
@@ -5405,17 +5447,6 @@
ment/pre-release versions of latex, etc, which have names, 'latex-dev',
'pdflatex-dev', etc, you could use
-
-
- 7 April 2024 82
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
set_tex_cmds( '%C-dev %O %S' );
This results in $latex = 'latex-dev %O %S', etc. (The pre-release pro-
@@ -5439,6 +5470,18 @@
Note that the hook mechanism is newly made public in v. 4.84 of la-
texmk. It is subject to change and improvement as experience is
+
+
+
+ 11 December 2024 83
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
gained.
The hooks are arranged in named hook stacks, and a hook subroutine is
@@ -5470,18 +5513,6 @@
stack provide a useful way of adding items to the dependency infor-
mation
associated with particular packages and that latexmk doesn't
-
-
-
- 7 April 2024 83
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
automatically deal with.
@@ -5505,6 +5536,18 @@
These subroutines are called before latexmk does any of its own
file
+
+
+
+ 11 December 2024 84
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
deletion; thus the hook subroutines have access to all the gener-
ated
files that give package-specific information.
@@ -5538,16 +5581,6 @@
-
- 7 April 2024 84
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
Advanced configuration: Using latexmk with make
This section is targeted only at advanced users who use the make pro-
gram for complex projects, as for software development, with the depen-
@@ -5569,6 +5602,18 @@
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
+
+
+
+ 11 December 2024 85
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
equivalent of pattern rules in Makefiles.
Nevertheless there are projects for which a Makefile is appropriate,
@@ -5602,18 +5647,6 @@
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
-
-
-
- 7 April 2024 85
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
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
@@ -5635,6 +5668,18 @@
TARGETS = document1.pdf document2.pdf
DEPS_DIR = .deps
+
+
+
+ 11 December 2024 86
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
LATEXMK = latexmk -recorder -use-make -deps \
-e 'warn qq(In Makefile, turn off custom dependencies\n);' \
-e '@cus_dep_list = ();' \
@@ -5668,18 +5713,6 @@
tion, which improves its detection of files generated during a run of
pdflatex; such files should not be in the dependency list. The -e op-
tions are used to turn off all custom dependencies, and to document
-
-
-
- 7 April 2024 86
-
-
-
-
-
-LATEXMK(1) General Commands Manual LATEXMK(1)
-
-
this. Instead the -use-make is used to delegate the making of missing
files to make itself.
@@ -5700,13 +5733,25 @@
Generally, such special characters are best avoided.
By default, latexmk does no escaping of this kind, and the user will
- have to arrange to deal with the issue separately, if the relevant spe-
- cial characters are used. Note that the rules for escaping depend on
- which make program is used, and on its version.
+ have to arrange to deal with the issue separately, if the relevant
- One special case is of spaces, since those are particularly prevalent,
- notably in standard choices of name for a user's home directory. So
- latexmk does provide an option to escape spaces. See the option
+
+
+ 11 December 2024 87
+
+
+
+
+
+LATEXMK(1) General Commands Manual LATEXMK(1)
+
+
+ special characters are used. Note that the rules for escaping depend
+ on which make program is used, and on its version.
+
+ One special case is of spaces, since those are particularly prevalent,
+ notably in standard choices of name for a user's home directory. So
+ latexmk does provide an option to escape spaces. See the option
-deps_escape=... and the variable $deps_escape for details.
@@ -5713,11 +5758,11 @@
NON_ASCII CHARACTERS IN FILENAMES, RC FILES, ETC
Modern operating systems and file systems allow non-ASCII characters in
- the names of files and directories that encompass the full Unicode
+ the names of files and directories that encompass the full Unicode
range. Mostly, latexmk deals with these correctly. However, there are
- some situations in which there are problems, notably on Microsoft Win-
+ some situations in which there are problems, notably on Microsoft Win-
dows. Prior to version 4.77, latexmk had problems with non-ASCII file-
- names on Windows, even though there were no corresponding problems on
+ names on Windows, even though there were no corresponding problems on
macOS and Linux. These problems are corrected in the present version.
DETAILS TO BE FILLED IN
@@ -5730,47 +5775,47 @@
BUGS (SELECTED)
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 es-
+ pecially 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 stan-
+ dard form to avoid being harvested too easily.)
+AUTHOR
+ Current version, by John Collins (Version 4.86). Report bugs etc to
- 7 April 2024 87
+ 11 December 2024 88
-LATEXMK(1) General Commands Manual LATEXMK(1)
- (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.)
+LATEXMK(1) General Commands Manual LATEXMK(1)
-THANKS TO
- Authors of previous versions. Many users with their feedback, and es-
- pecially 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 stan-
- dard form to avoid being harvested too easily.)
-AUTHOR
- Current version, by John Collins (Version 4.85). Report bugs etc to
his e-mail (jcc8 at psu.edu).
- Released version can be obtained from CTAN:
- <http://www.ctan.org/pkg/latexmk/>, and from the author's website
+ Released version can be obtained from CTAN:
+ <http://www.ctan.org/pkg/latexmk/>, and from the author's website
<https://www.cantab.net/users/johncollins/latexmk/>.
Modifications and enhancements by Evan McLean (Version 2.0)
Original script called "go" by David J. Musliner (RCS Version 3.2)
@@ -5803,6 +5848,27 @@
- 7 April 2024 88
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 11 December 2024 89
+
+
Modified: trunk/Master/texmf-dist/scripts/latexmk/latexmk.pl
===================================================================
--- trunk/Master/texmf-dist/scripts/latexmk/latexmk.pl 2024-12-13 00:42:13 UTC (rev 73111)
+++ trunk/Master/texmf-dist/scripts/latexmk/latexmk.pl 2024-12-13 22:37:25 UTC (rev 73112)
@@ -47,10 +47,16 @@
# blocks.
$my_name = 'latexmk';
$My_name = 'Latexmk';
- $version_num = '4.85';
- $version_details = "$My_name, John Collins, 7 Apr. 2024. Version $version_num";
+ $version_num = '4.86';
+ $version_details = "$My_name, John Collins, 11 Dec. 2024. Version $version_num";
}
+# Ensure that when STDERR and STDOUT are both redirected, the results are
+# in the order they are written. Otherwise, the default situation for
+# redirected output is that STDERR is always autoflushed, but STDOUT is
+# not, and therefore output does not appear in the order is was written.
+STDOUT->autoflush(1);
+
use Config;
use File::Basename;
use File::Copy;
@@ -1227,7 +1233,7 @@
# compilation of .tex file tests for file existence and
# adjusts behavior accordingly, instead of simply giving an
# error.
-our $max_repeat = 5; # Maximum times I repeat latex. Normally
+our $max_repeat = 5; # Maximum times I repeat latex. Normally
# 3 would be sufficient: 1st run generates aux file,
# 2nd run picks up aux file, and maybe toc, lof which
# contain out-of-date information, e.g., wrong page
@@ -2033,16 +2039,18 @@
elsif (/^-dir-report$/) { $aux_out_dir_report = 1; }
elsif (/^-dir-report-$/) { $aux_out_dir_report = 0; }
elsif (/^-dvi$/) { $dvi_mode = 1;
- $hnt_mode = 0;
+ $hnt_mode = $xdv_mode = 0;
+ # Postscript mode OK
if ( ($pdf_mode != 2) && ($pdf_mode != 3) ) {
- # if pdf_mode is not via dvi or pdf, turn it off
+ # if pdf_mode is not via dvi or ps, turn it off
$pdf_mode = 0;
}
}
elsif (/^-dvilua$/) { $dvi_mode = 2;
- $hnt_mode = 0;
+ $hnt_mode = $xdv_mode = 0;
+ # Postscript mode OK
if ( ($pdf_mode != 2) && ($pdf_mode != 3) ) {
- # if pdf_mode is not via dvi or pdf, turn it off
+ # if pdf_mode is not via dvi or ps, turn it off
$pdf_mode = 0;
}
}
@@ -2064,7 +2072,7 @@
}
elsif ( /^-h$/ || /^-help$/ ) { &print_help; exit;}
elsif (/^-hnt$/) { $hnt_mode = 1;
- $dvi_mode = $postscript_mode = $pdf_mode = 0;
+ $dvi_mode = $postscript_mode = $pdf_mode = $xdv_mode = 0;
}
elsif (/^-jobname=(.*)$/) {
$jobname = $1;
@@ -2071,11 +2079,13 @@
}
elsif (/^-l$/) { $landscape_mode = 1; }
elsif (/^-l-$/) { $landscape_mode = 0; }
- elsif ( /^-latex$/ ) {
- $pdf_mode = 0;
- $postscript_mode = 0;
- $dvi_mode = 1;
- $hnt_mode = 0;
+ elsif ( /^-latex$/ ) { $dvi_mode = 1;
+ $hnt_mode = $postscript_mode = $xdv_mode = 0;
+ # Postscript mode OK
+ if ( ($pdf_mode != 2) && ($pdf_mode != 3) ) {
+ # if pdf_mode is not via dvi or ps, turn it off
+ $pdf_mode = 0;
+ }
}
elsif (/^-latex=(.*)$/) {
$latex = $1;
@@ -2093,7 +2103,7 @@
{ $silence_logfile_warnings = 1; }
elsif ( /^-lualatex$/ || /^-pdflualatex$/ ) {
$pdf_mode = 4;
- $dvi_mode = $hnt_mode = $postscript_mode = 0;
+ $dvi_mode = $hnt_mode = $postscript_mode = $xdv_mode = 0;
}
# See below for -lualatex=...
# See above for -M
@@ -2132,15 +2142,16 @@
my $format = $1;
if ($format eq 'dvi' ) {
$dvi_mode = 1;
- $hnt_mode = 0;
+ $hnt_mode = $xdv_mode = 0;
+ # Postscript mode OK
if ( ($pdf_mode != 2) && ($pdf_mode != 3) ) {
- # if pdf_mode is not via dvi or pdf, turn it off
+ # if pdf_mode is not via dvi or ps, turn it off
$pdf_mode = 0;
}
}
elsif ($format eq 'pdf' ) {
$pdf_mode = 1;
- $dvi_mode = $hnt_mode = $postscript_mode = 0;
+ $dvi_mode = $hnt_mode = $postscript_mode = $xdv_mode = 0;
}
else {
warn "$My_name: unknown format in option '$_'\n";
@@ -2152,16 +2163,16 @@
$preview_mode = 0;
}
elsif (/^-p-$/) { $printout_mode = 0; }
- elsif (/^-pdf$/) { $pdf_mode = 1; $dvi_mode = $hnt_mode = $postscript_mode = 0; }
+ elsif (/^-pdf$/) { $pdf_mode = 1; $dvi_mode = $hnt_mode = $postscript_mode = $xdv_mode = 0; }
elsif (/^-pdf-$/) { $pdf_mode = 0; }
- elsif (/^-pdfdvi$/){ $pdf_mode = 3; $hnt_mode = 0; }
- elsif (/^-pdflua$/){ $pdf_mode = 4; $dvi_mode = $hnt_mode = $postscript_mode = 0; }
- elsif (/^-pdfps$/) { $pdf_mode = 2; $hnt_mode = 0; }
+ elsif (/^-pdfdvi$/){ $pdf_mode = 3; $hnt_mode = $xdv_mode = 0; }
+ elsif (/^-pdflua$/){ $pdf_mode = 4; $dvi_mode = $hnt_mode = $postscript_mode = $xdv_mode = 0; }
+ elsif (/^-pdfps$/) { $pdf_mode = 2; $hnt_mode = $xdv_mode = 0; }
elsif (/^-pdfxe$/) { $pdf_mode = 5; $dvi_mode = $hnt_mode = $postscript_mode = 0; }
elsif (/^-pdflatex$/) {
$pdflatex = "pdflatex %O %S";
$pdf_mode = 1;
- $dvi_mode = $hnt_mode = $postscript_mode = 0;
+ $dvi_mode = $hnt_mode = $postscript_mode = $xdv_mode = 0;
}
elsif (/^-pdflatex=(.*)$/) {
$pdflatex = $1;
@@ -2186,6 +2197,8 @@
}
}
elsif (/^-ps$/) { $postscript_mode = 1;
+ # dvi mode OK
+ $hnt_mode = $xdv_mode = 0;
if ( ($pdf_mode != 2) && ($pdf_mode != 3) ) {
# if pdf_mode is not via dvi or pdf, turn it off
$pdf_mode = 0;
@@ -2254,10 +2267,17 @@
elsif (/^-view=ps$/) { $view = "ps";}
elsif (/^-view=pdf$/) { $view = "pdf"; }
elsif (/^-Werror$/){ $warnings_as_errors = 1; }
- elsif (/^-xdv$/) { $xdv_mode = 1; }
+ elsif (/^-xdv$/) { $xdv_mode = 1;
+ $dvi_mode = $hnt_mode = $postscript_mode = 0;
+ if ( $pdf_mode != 5 ) {
+ # if pdf_mode is not by xelatex
+ $pdf_mode = 0;
+ }
+}
elsif (/^-xdv-$/) { $xdv_mode = 0; }
elsif ( /^-xelatex$/ || /^-pdfxelatex$/ ) {
$pdf_mode = 5;
+ # Xdv mode OK, since use xelatex to make xdv file
$dvi_mode = $hnt_mode = $postscript_mode = 0;
}
# See above for -xelatex=...
@@ -2590,10 +2610,11 @@
# If default viewer requested, use "highest" of dvi, ps and pdf
# that was requested by user.
# No explicit request means view dvi.
- $view = "dvi";
- if ( $hnt_mode ) { $view = "hnt"; }
if ( $pdf_mode ) { $view = "pdf"; }
- if ( $postscript_mode ) { $view = "ps"; }
+ elsif ( $postscript_mode ) { $view = "ps"; }
+ elsif ( $xdv_mode ) { $view = "none"; }
+ elsif ( $hnt_mode ) { $view = "hnt"; }
+ else { $view = "dvi"; }
}
# Determine requests.
@@ -2625,6 +2646,19 @@
" I replaced it by $pdf_mode, to be compatible with those other requests.\n";
}
}
+if ( $xdv_mode && $pdf_mode ) {
+ my %disallowed = ();
+ foreach (1,2,3,4) { $disallowed{$_} = 1; }
+ if ($disallowed{$pdf_mode}) {
+ warn
+ "$My_name: \$pdf_mode = $pdf_mode is incompatible with dvi and postscript modes\n",
+ " which are required by other requests.\n";
+ if ($postscript_mode) { $pdf_mode = 2; }
+ else { $pdf_mode = 3; }
+ warn
+ " I replaced it by $pdf_mode, to be compatible with those other requests.\n";
+ }
+}
if ( $pdf_mode == 0 ) {
$pdf_method = '';
}
@@ -2779,6 +2813,7 @@
my $start_time = time();
$Prun_time = \$start_time;
+
FILE:
foreach $filename ( @file_list )
{
@@ -2825,6 +2860,18 @@
# not known until after the call to normalize_aux_out_ETC:
&set_aux_out_options;
&set_names; # Names of standard files
+ if ($diagnostics || $aux_out_dir_report ) {
+ print "$My_name: Cwd: '", good_cwd(), "'\n";
+ print "$My_name: Normalized aux dir, out dir, out2 dir:\n",
+ " '$aux_dir', '$out_dir', '$out2_dir'\n";
+ print "$My_name: Combining forms of aux dir, out dir, out2 dir:\n",
+ " '$aux_dir1', '$out_dir1', '$out2_dir1'\n";
+ print "$My_name: Base name of generated files:\n",
+ " '$root_filename'\n";
+ if ($aux_out_dir_report == 2) {
+ next FILE;
+ }
+ }
# For use under error conditions:
@default_includes = ($texfile_name, $aux_main);
@@ -3355,17 +3402,6 @@
# So the following is only needed for TeXLive.
$ENV{TEXMFOUTPUT} = $aux_dir;
}
-
- if ($diagnostics || $aux_out_dir_report ) {
- print "$My_name: Cwd: '", good_cwd(), "'\n";
- print "$My_name: Normalized aux dir and out dirs:\n",
- " '$aux_dir', '$out_dir', '$out2_dir'\n";
- print "$My_name: and combining forms:\n '$aux_dir1', '$out_dir1', '$out2_dir1'\n";
- if ($aux_out_dir_report == 2) {
- exit 0;
- }
- }
-
} #END normalize_aux_out_ETC
#############################################################
@@ -3529,6 +3565,7 @@
elsif ($pdf_mode == 5) { rdb_activate( 'xdvipdfmx' ); $current_primary = 'xelatex'; }
if ($dvi_mode == 2) { $current_primary = 'dvilualatex'; }
if ($hnt_mode) { $current_primary = 'hilatex'; }
+ if ($xdv_mode) { $current_primary = 'xelatex'; }
rdb_activate( $current_primary );
@@ -3537,7 +3574,6 @@
if ($postscript_mode) { $target_files{$ps_final} = 1; }
if ($pdf_mode) { $target_files{$pdf_final} = 1; }
if ($xdv_mode) { $target_files{$xdv_final} = 1; }
-
&rdb_set_rule_net;
} # END rdb_initialize_rules
@@ -3936,7 +3972,7 @@
}
}
}
- elsif ( $rule =~ /^(latex|lualtex|pdflatex|xelatex)/ ) {
+ elsif ( exists $possible_primaries{$rule} ) {
foreach my $key (keys %$PHdest) {
$other_generated{$key} = 1;
}
@@ -4735,7 +4771,8 @@
" -bibtex-cond - use bibtex when needed, but only if the bib file exists\n",
" -bibtex-cond1 - use bibtex when needed, but only if the bib file exists;\n",
" on cleanup delete bbl file only if bib file exists\n",
- " -bibfudge or -bibtexfudge - change directory to output directory when running bibtex\n",
+ " -bibfudge or -bibtexfudge - change directory to output directory when\n",
+ " running bibtex\n",
" -bibfudge- or -bibtexfudge- - don't change directory when running bibtex\n",
" -bm <message> - Print message across the page when converting to postscript\n",
" -bi <intensity> - Set contrast or intensity of banner\n",
@@ -4761,10 +4798,11 @@
" and turn on showing of dependency list\n",
" -dF <filter> - Filter to apply to dvi file\n",
" -dir-report - Before processing a tex file, report aux and out dir settings\n",
+ " Report includes cwd and basename of output files\n",
" -dir-report- - Before processing a tex file, do not report aux and out dir\n",
" settings\n",
- " -dir-report-only - Report aux and out dir settings after initialization\n",
- " and previous option processing, and then stop\n",
+ " -dir-report-only - Report aux and out dir settings after initialization for\n",
+ " each tex file, without compiling it\n",
" -dvi - generate dvi by latex\n",
" -dvilua - generate dvi by dvilualatex\n",
" -dvi- - turn off required dvi\n",
@@ -4784,9 +4822,11 @@
" -g- - Turn off -g and -gg\n",
" -h - print help\n",
" -hnt - generate hnt by hilatex\n",
- " -help - print help\n",
- " -indexfudge or -makeindexfudge - change directory to output directory when running makeindex\n",
- " -indexfudge- or -makeindexfudge- - don't change directory when running makeindex\n",
+ " -help - print help\n",
+ " -indexfudge or -makeindexfudge - change directory to output directory when\n",
+ " running makeindex\n",
+ " -indexfudge- or -makeindexfudge- - don't change directory when running\n",
+ " makeindex\n",
" -jobname=STRING - set basename of output file(s) to STRING.\n",
" (Like --jobname=STRING on command line for many current\n",
" implementations of latex/pdflatex.)\n",
@@ -4803,9 +4843,12 @@
" and turn dvi/ps modes off\n",
" -M - Show list of dependent files after processing\n",
" -MF file - Specifies name of file to receives list dependent files\n",
- " -MP - List of dependent files includes phony target for each source file.\n",
- " -makeindexfudge - change directory to output directory when running makeindex\n",
- " -makeindexfudge-- don't change directory to output directory when running makeindex\n",
+ " -MP - List of dependent files includes phony target for each source\n",
+ " file.\n",
+ " -makeindexfudge - change directory to output directory when running\n",
+ " makeindex\n",
+ " -makeindexfudge- - don't change directory to output directory when\n",
+ " running makeindex\n",
" -MSWinBackSlash under MSWin use backslash (\\) for directory separators\n",
" for filenames given to called programs\n",
" -MSWinBackSlash- under MSWin use forward slash (/) for directory separators\n",
@@ -4816,7 +4859,8 @@
" -nobibfudge or -nobibtexfudge - don't change directory when running bibtex\n",
" -nodependents - Do not show list of dependent files after processing\n",
" -noemulate-aux-dir - use -aux-directory option with *latex\n",
- " -noindexfudge or -nomakeindexfudge - don't change directory when running makeindex\n",
+ " -noindexfudge or -nomakeindexfudge - don't change directory when running\n",
+ " makeindex\n",
" -norc - omit automatic reading of system, user and project rc files\n",
" -output-directory=dir or -outdir=dir\n",
" - set name of directory for output files\n",
@@ -5187,7 +5231,7 @@
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. ",
+ warn "==== Force_mode is on, so I will continue. ",
"But there may be problems ===\n";
}
if ($control_file_missing) {
@@ -5485,10 +5529,10 @@
$ps_name = "%Z%R.ps";
$psF_name = "%Z%R.psF";
$pdf_name = "%Z%R.pdf";
- $dvi_final2 = "%X%R.pdf";
- $hnt_final2 = "%X%R.pdf";
+ $dvi_final2 = "%X%R.dvi";
+ $hnt_final2 = "%X%R.hnt";
$pdf_final2 = "%X%R.pdf";
- $ps_final2 = "%X%R.pdf";
+ $ps_final2 = "%X%R.ps";
## It would be logical for a .xdv file to be put in the out_dir,
## just like a .dvi file. But the only program, MiKTeX, that
## currently implements aux_dir, and hence allows aux_dir ne out_dir,
@@ -6293,7 +6337,7 @@
my @new_includes = ();
GRAPHICS_INCLUDE_CANDIDATE:
- while ( /<([^>]+)(>|$)/g ) {
+ while ( /<([^>\{]+)(>|\{|$)/g ) {
if ( -f $1 ) { push @new_includes, $1; }
} # GRAPHICS_INCLUDE_CANDIDATE:
@@ -6832,9 +6876,13 @@
print "$My_name: Examining '$fls_name'\n"
if not $silent;
- my $pdf_base = basename($pdf_name);
- my $log_base = basename($log_name);
- my $out_base = basename($$Pdest);
+ # For use when checking for INPUT of normal OUTPUT file:
+ my %danger_dirs = ( $aux_dir1 => 1, $out_dir1 => 1, $out2_dir1 => 1 );
+ # The keys of %vetoed are the names of INPUT files that aren't to be treated as source files.
+ # This variable is used to avoid repeated repeated warnings for the same file of this kind.
+ # Such repeats would be common, since INPUT filename lines are often repeated in the .fls file.
+ my %vetoed = ();
+
my $pwd_subst = undef; # Initial string for pwd that is to be removed to
# make relative paths, when possible. It must end
# in '/', if defined.
@@ -6865,8 +6913,10 @@
# line is UTF-8.
# So give special treatment to PWD line under Windows.
# Also to guard against any other problems, check for non-UTF-8 lines.
- if ( ($^O eq 'MSWin32') && /PWD/ && ! is_valid_utf8($_) ) { print
- "PWD line not in UTF-8. This is normal for older TeXLives (2021 and earlier).\n". "I will handle it.\n";
+ if ( ($^O eq 'MSWin32') && /PWD/ && ! is_valid_utf8($_) ) {
+ print
+ "PWD line not in UTF-8. This is normal for older TeXLives (2021 and earlier).\n".
+ " I will handle it.\n";
# Assume in CS_system, no change needed.
}
elsif ( ! is_valid_utf8($_) ) {
@@ -6914,48 +6964,99 @@
if ( (exists $$Poutputs{$file}) && (! exists $$Pinputs{$file}) ) {
$$Pfirst_read_after_write{$file} = 1;
}
- # Take precautions when the main destination file (or pdf file) or the log
- # file are listed as INPUT files in the .fls file.
- # At present, the known cases are caused by hyperxmp, which reads file metadata
- # for certain purposes (e.g., setting a current date and time, or finding the
- # pdf file size). These uses are legitimate, but the files should not be
- # treated as genuine source files for *latex.
- # Note that both the pdf and log files have in their contents strings for
- # time and date, so in general their contents don't stabilize between runs
- # of *latex. Hence adding them to the list of source files on the basis of
- # their appearance in the list of input files in the .fls file would cause
- # an incorrect infinite loop in the reruns of *latex.
+
+
+ # PRECAUTIONS for main output pdf file (and potentially others) being INPUT
+ #==========================================================================
+ #
+ # In almost all cases, the main output files (notably pdf, but
+ # also dvi, ps, xdv, hnt, and also the log file) are pure
+ # output files, and don't participate in circular dependences.
+ # However, there are known situations where at least the pdf
+ # file does. This siutation is potentially problematic, since
+ # some of these normally output-only files, including the pdf
+ # file, contain content that gives a time stamp. In a circular
+ # dependency involving such files, latexmk's normal methods
+ # give a perpetually out-of-date situation, and hence an
+ # infinite loop.
#
- # Older versions of hyperxmp (e.g., 2020/10/05 v. 5.6) reported the pdf file
- # as an input file.
- # The current version when used with xelatex reports the .log file as an
- # input file.
+ # If such a file is listed as being INPUT in the .fls file,
+ # then this needs to be detected, and special precautions
+ # taken. In the one known case where there is both such a
+ # circular dependency and the pdf file listed as INPUT in the
+ # fls file, it suffices not to put that file in the list of
+ # input files.
#
- # The test for finding the relevant .pdf (or .dvi ...) and .log files is
- # on basenames rather than full name to evade in a simple-minded way
- # alias issues with the directory part:
- if ( basename($file) eq $pdf_base ) {
- warn "$My_name: !!!!!!!!!!! Fls file lists main pdf **output** file as an input\n",
- " file for rule '$rule'. I won't treat as a source file, since that can\n",
- " lead to an infinite loop.\n",
- " This situation can be caused by the hyperxmp package in an old version,\n",
- " in which case you can ignore this message.\n";
- } elsif ( basename($file) eq $out_base ) {
- warn "$My_name: !!!!!!!!!!! Fls file lists main **output** file as an input\n",
- " file for rule '$rule'. I won't treat as a source file, since that can\n",
- " lead to an infinite loop.\n",
- " This situation can be caused by the hyperxmp package in an old version,\n",
- " in which case you can ignore this message.\n";
- } elsif ( basename($file) eq $log_base ) {
- warn "$My_name: !!!!!!!!!!! Fls file lists log file as an input file for\n",
- " rule '$rule'. I won't treat it as a source file.\n",
- " This situation can occur when the hyperxmp package is used with\n",
- " xelatex; the package reads the .log file's metadata to set current\n",
- " date and time. In this case you can safely ignore this message.\n";
- } else {
+ # Note that, in general, it is logically difficult to set up
+ # such circular dependencies within *latex to get a desired
+ # useful effect without the use of external software
+ #
+ # The known cases of the relevant kinds of circular dependency
+ # both involve the output pdf file:
+ #
+ # (a) hyperxmp in some versions, e.g., 2020/10/05 v. 5.6, reads
+ # metadata of the pdf file produced by pdflatex (to get the
+ # filesize), which results in the pdf file being reported
+ # as an INPUT file of pdflatex.
+ # Without special precautions, latexmk gets into an
+ # infinite loop. But correct functioning is achieved
+ # simply by ensuring that the pdf file is not inserted in
+ # the list of source files for *latex.
+ # More recent versions of hyperxmp work differently, and so
+ # do not cause
+ #
+ # (b) The memoize package uses non-trivial content from the pdf
+ # file. There is a clear and essential circular
+ # dependency. But given the way the package and its
+ # associated script work, the pdf file doesn't appear any
+ # where relevant to be detected by latexmk, and the package
+ # and its script take care such that all necessary reruns
+ # by latexmk get done.
+ # In addition, there is a special configuration --- see
+ # example_rcfiles/memoize_latexmkrc --- to allow memoize to
+ # be used properly with latexmk. So that doesn't entail
+ # special diagnosis here.
+ #
+ # The above illustrate that circular dependencies involving
+ # these normally output-only files can exist, legitimately. So
+ # we have to allow for the situation.
+ #
+ # The hyperxmp example shows that it does happen in reality
+ # that the main pdf output file is listed in the .fls file, and
+ # so that we do need an explicit test.
+ # But there are no other known situations for other classes of
+ # files that are normally only output (e.g., log, dvi, etc), so
+ # I'll restrict the detection to the pdf case, but in a form
+ # that can be generalized if need be.
+ #
+ # Given the vagaries of how the aux and output directories
+ # could be used, the test allows for the file being in any of
+ # the relevant directories. There is a potential issue that
+ # different strings could be used for the name of the same
+ # directories. That would entail a fancier test, but that issue
+ # has not arisen in practice so far. Since the cases where the
+ # test actually matters are already very rare, I won't handle
+ # that extra complication.
+
+ my ($base, $path, $ext) = fileparseA( $file );
+ if ( exists ($vetoed{$file}) ) {
+ }
+ elsif ( ( $base eq $root_filename )
+ && ( $ext eq '.pdf' )
+ && ( exists $danger_dirs{$path} )
+ ) {
+ warn "$My_name: !!!!!!!!!!! Fls file lists a normal output-only file\n",
+ " '$file as an input file for rule '$rule'.\n",
+ " Hence I won't treat '$file' as an input file.\n",
+ " This kind of situation can be caused by the hyperxmp package in an old\n",
+ " version, in which case you can safely ignore this message.\n";
+ $vetoed{$file} = 1;
+ }
+ else {
$$Pinputs{$file} = 1;
- }
- }
+ }
+
+ } # end of handling INPUT line
elsif (/^\s*OUTPUT\s+(.*)$/) {
# Take precautions against aliasing of foo, ./foo and other possibilities for cwd.
my $file = $1;
@@ -8124,7 +8225,7 @@
" But a non-directory file of this name exists!\n";
}
else {
- if (mkdir $dir) {
+ if (make_path_mod($dir)) {
print "$My_name: Directory '$dir' created\n";
}
else {
@@ -9313,7 +9414,7 @@
# no output files changed), either because no input files
# changed and no run was needed, or because the
# number of passes through the rule exceeded the
- # limit. In the second case $too_many_runs is set.
+ # limit. In the second case $too_many_passes was set.
rdb_for_some( [@pre_primary, $current_primary], \&rdb_make1 );
if ($switched_primary_output) {
print "=========SWITCH OF OUTPUT WAS DONE.\n";
@@ -9340,7 +9441,7 @@
}
else { last PASS; }
}
- if ($runs == 0) {
+ if ( ($runs == 0) && (! $too_many_passes) && (! $failure) ) {
# $failure not set on this pass, so use value from previous pass:
$failure = $previous_failure;
if ($retry_msg) {
@@ -9359,9 +9460,8 @@
}
rdb_for_some( [@post_primary], \&rdb_make1 );
if ( ($runs == 0) || $too_many_passes ) {
- # If $too_many_passes is set, it should also be that
- # $runs == 0; but for safety, I also checked
- # $too_many_passes.
+ # Either nothing needed to be done,
+ # and/or a rule needed to be run more than the allowed count.
last PASS;
}
}
More information about the tex-live-commits
mailing list.