From f7fc4ad3995d7f6ebbed20c20bf06e3a9176ea04 Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Wed, 9 Jun 2021 03:03:06 +0000 Subject: CTAN sync 202106090303 --- support/latexmk/CHANGES | 10 + support/latexmk/INSTALL | 2 +- support/latexmk/README | 8 +- support/latexmk/latexmk.1 | 90 +- support/latexmk/latexmk.pdf | Bin 193225 -> 196426 bytes support/latexmk/latexmk.pl | 71 +- support/latexmk/latexmk.txt | 2792 ++++++++++++++++++++++--------------------- 7 files changed, 1617 insertions(+), 1356 deletions(-) (limited to 'support/latexmk') diff --git a/support/latexmk/CHANGES b/support/latexmk/CHANGES index 84b949bbd2..fc6f77891e 100644 --- a/support/latexmk/CHANGES +++ b/support/latexmk/CHANGES @@ -768,3 +768,13 @@ From v. 4.73 to 4.74 Remove some informational messages (about rc files, and the state of aux and dir settings after normalization). +From v. 4.74 to 4.74b + When emulating aux_dir, put .synctex.gz .synctex files in out_dir (as + done by MiKTeX, and needed for their use). + Turn emulate aux_dir off by default, to match behavior on older versions + of latexmk (BACKWARDS INCOMPATIBLE with 4.73 and 4.74.) + Add end-of-all-runs warning if emulate aux_dir needed to be turned on, + when it was initially off. + Add .synctex and .synctex.gz to list of extensions to clear by default. + Turn back on default to report rc files read. + Add options -rc-report, -rc-report-, -dir_report, -dir_report-. diff --git a/support/latexmk/INSTALL b/support/latexmk/INSTALL index 916c1097d8..dacf6919bf 100644 --- a/support/latexmk/INSTALL +++ b/support/latexmk/INSTALL @@ -1,6 +1,6 @@ INSTALLING latexmk ================== - (Version 4.74, 16 May 2021) + (Version 4.74b, 29 May 2021) John Collins Physics Department diff --git a/support/latexmk/README b/support/latexmk/README index ce7d3ff66f..8b0c72f96c 100644 --- a/support/latexmk/README +++ b/support/latexmk/README @@ -1,4 +1,4 @@ -Latexmk, version 4.74, 16 May 2021 +Latexmk, version 4.74b, 29 May 2021 ---------------------------------- Latexmk completely automates the process of generating a LaTeX @@ -87,7 +87,7 @@ NOTES:- John Collins ---------------------------- "latexmk -h" ---------------------------- -Latexmk 4.74: Automatic LaTeX document generation routine +Latexmk 4.74b: Automatic LaTeX document generation routine Usage: latexmk [latexmk_options] [filename ...] @@ -123,6 +123,8 @@ Usage: latexmk [latexmk_options] [filename ...] -deps-out=file - Set name of output file for dependency list, and turn on showing of dependency list -dF - Filter to apply to dvi file + -dir-report - Before processing a tex file, report aux and out dir settings + -dir-report- - Before processing a tex file, do not report aux and out dir settings -dvi - generate dvi -dvi- - turn off required dvi -e - Execute specified Perl code (as part of latexmk start-up @@ -211,6 +213,8 @@ Usage: latexmk [latexmk_options] [filename ...] -r - Read custom RC file (N.B. This file could override options specified earlier on the command line.) + -rc-report - After initialization, report names of rc files read + -rc-report- - After initialization, do not report names of rc files read -recorder - Use -recorder option for *latex (to give list of input and output files) -recorder- - Do not use -recorder option for *latex diff --git a/support/latexmk/latexmk.1 b/support/latexmk/latexmk.1 index 7149072b67..0c3bd60853 100644 --- a/support/latexmk/latexmk.1 +++ b/support/latexmk/latexmk.1 @@ -1,4 +1,4 @@ -.TH LATEXMK 1 "16 May 2021" "" +.TH LATEXMK 1 "29 May 2021" "" .SH NAME latexmk \- generate LaTeX document .SH SYNOPSIS @@ -464,6 +464,17 @@ Print detailed diagnostics during a run. This may help for debugging problems or to understand \fIlatexmk\fR's behavior in difficult situations. +.TP +.B -dir-report +For each .tex file processed, list the settings for aux and out +directories, after they have been normalized from the settings specified +during initialization. See the description of the variable +\fB$aux_out_dir_report\fR for more details. + +.TP +.B -dir-report- +Do not report the settings for aux and out directories. (Default) + .TP .B -dvi Generate dvi version of document. @@ -524,6 +535,22 @@ The last two examples will NOT work with UNIX/Linux command shells. particular effect can be achieved also by the use of the \fB-latex\fR option with less problems in dealing with quoting.) +.TP +.B -emulate-aux-dir +Emulate -aux-directory instead of leaving it to the *latex programs +to do it. (MiKTeX supports -aux-directory, but TeXLive doesn't.) + +For more details see the explanation for the configuration variable +\fI$emulate_aux\fR. + +.TP +.B -emulate-aux-dir- +Turn off emulatation -aux-directory and leave it to the *latex program +to handle the case that aux_dir is not equal to out_dir. Note that if you +use TeXLive, which doesn't support -aux-directory, 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. + .TP .B -f Force \fIlatexmk\fR to continue document processing despite errors. @@ -758,6 +785,15 @@ Never run bibtex or biber. Equivalent to the \fB-bibtex-\fR option. Turn off the change-directory fudge for bibtex. See documentation of \fI$bibtex_fudge\fR for details. +.TP +.B -noemulate-aux-dir +Turn aux_dir emulation off. Same as \fI-emulate-aux-dir-\fR. + +.TP +.B -nomakeindexfudge +Turn off the change-directory fudge for makeindex. See documentation of +\fI$makeindex_fudge\fR for details. + .TP .B -norc Turn off the automatic reading of initialization (rc) files. @@ -767,11 +803,6 @@ command line options are obeyed in the order they are encountered. But \fB-norc\fR is an exception to this rule: it is acted on first, no matter where it occurs on the command line. -.TP -.B -nomakeindexfudge -Turn off the change-directory fudge for makeindex. See documentation of -\fI$makeindex_fudge\fR for details. - .TP .B -outdir=FOO \fRor\fB -output-directory=FOO @@ -1088,6 +1119,14 @@ error results in \fIlatexmk\fR stopping. Multiple instances of the \fB-r\fR and \fB-e\fR options can be used, and they are executed in the order they appear on the command line. +.TP +.B -rc-report +After initialization, give a list of the RC files read. (Default) + +.TP +.B -rc-report- +After initialization, do not give a list of the RC files read. (Default) + .TP .B -recorder Give the -recorder option with \fI*latex\fR. In @@ -1939,6 +1978,23 @@ what directory names are suitable. If you also use the \fB-cd\fR option, and \fI$out_dir\fR (or \fI$aux_dir\fR) contains a relative path, then the path is interpreted relative to the document directory. + +.TP +.B $aux_out_dir_report [0] +For each .tex file processed, list the settings for aux and out +directories, after they have been normalized from the settings specified +during initialization. + +This report gives a reminder of where to look for output. + +The report has to be done per file, because of possible directory changes +for each file. In the simplest cases, the result is the same as originally +specified. In general, e.g., with an absolute directory specified, the +normalization helps performance and cleans up output to the screen. It also +avoids situations where a file in the current directory is refered to by +different names, e.g., "file.aux" and "./file.aux", which can be annoying. + + .TP .B $banner [0] If nonzero, the banner message is printed across each page when @@ -2272,6 +2328,7 @@ Whether to display a list(s) of dependencies at the end of a run. Name of file to receive list(s) of dependencies at the end of a run, to be used if \fI$dependesnt_list\fR is set. If the filename is "-", then the dependency list is set to stdout (i.e., normally the screen). + .TP .B $do_cd [0] Whether to change working directory to the directory specified for the @@ -2382,6 +2439,22 @@ 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 \fI$dvi_update_method\fR. The default value is the one appropriate for \fIxdvi\fR on a UNIX system. +.TP +.B $emulate_aux [0] +Whether to emulate the use of aux_dir when $aux_dir and $out_dir are +different, rather than using the -aux-directory option for the *latex +programs. (MiKTeX supports -aux-directory, but TeXLive doesn't.) + +If you use a version of *latex that doesn't support -aux-directory, 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. + +Aux_directory emulation means that when *latex is invoked, the \fIoutput\fR +directory provided to *latex is set to be the aux_dir. After that, any +files that need to be in the output directory will be moved there. (These +are the files with extensions .dvi, .ps, .pdf, .fls, .synctex, .synctex.gz.) + .TP .B $failure_cmd [undefined] See the documentation for \fI$compiling_cmd\fR. @@ -3095,6 +3168,9 @@ correctly deal with TeX files whose names contain spaces. \fILatexmk\fR's quoting only ensures that such filenames are correctly treated by the operating system in passing arguments to programs.) .TP +.B $rc_report [1] +After initialization, whether to give a list of the RC files read. +.TP .B $recorder [1] Whether to use the \fB-recorder\fR option to \fI(latex\fR Use of this option results in a file of extension @@ -3919,7 +3995,7 @@ e-mail addresses are not written in their standard form to avoid being harvested too easily.) .SH AUTHOR Current version, by John Collins -(Version 4.74). +(Version 4.74b). Report bugs etc to his e-mail (jcc8 at psu.edu). Released version can be obtained from CTAN: diff --git a/support/latexmk/latexmk.pdf b/support/latexmk/latexmk.pdf index 52212066b4..97130d51f8 100644 Binary files a/support/latexmk/latexmk.pdf and b/support/latexmk/latexmk.pdf differ diff --git a/support/latexmk/latexmk.pl b/support/latexmk/latexmk.pl index 3758cf22ef..55ecc54b84 100755 --- a/support/latexmk/latexmk.pl +++ b/support/latexmk/latexmk.pl @@ -29,6 +29,18 @@ use warnings; ## ## Modification log from 14 Apr 2021 onwards in detail ## +## 29 May 2021 John Collins When emulating aux_dir, put .synctex.gz .synctex +## files in out_dir (as done by MiKTeX, and needed +## for their use). +## Turn emulate aux_dir off by default, to match older +## behavior. (BACKWARDS INCOMPATIBLE with 4.73 and +## 4.74.) +## Add end-of-all-runs warning if emulate aux_dir needed +## to be turned on, when it was initially off. +## Add .synctex to list of extensions to clear by default. +## 20 May 2021 John Collins Turn back on default to report rc files read. +## Add options -rc-report, -rc-report-, +## -dir_report, -dir_report-. ## 16 May 2021 John Collins Deal with some variable used only once warnings ## Remove by default informational messages on rc ## files read, and aux_dir and out_dir setting. @@ -82,8 +94,8 @@ use warnings; $my_name = 'latexmk'; $My_name = 'Latexmk'; -$version_num = '4.74'; -$version_details = "$My_name, John Collins, 16 May 2021"; +$version_num = '4.74b'; +$version_details = "$My_name, John Collins, 29 May 2021"; use Config; use File::Basename; @@ -266,7 +278,9 @@ $xelatex_silent_switch = '-interaction=batchmode'; # Whether to emulate -aux-directory, so we can use it on system(s) (TeXLive) # that don't support it: -$emulate_aux = 1; +$emulate_aux = 0; +# Whether emulate_aux had to be switched on during a run: +$emulate_aux_switched = 0; %input_extensions = (); # %input_extensions maps primary_rule_name to pointer to hash of file extensions @@ -283,7 +297,7 @@ $input_extensions{xelatex} = $input_extensions{pdflatex}; %allowed_output_ext = ( ".dvi" => 1, ".xdv" => 1, ".pdf" => 1 ); # Extensions of files preserved when clean up is by -c rather than -C: %small_cleanup_preserved_exts = (); -foreach ( 'dvi', 'dviF', 'ps', 'psF', 'pdf', 'synctex.gz', 'xdv' ) { +foreach ( 'dvi', 'dviF', 'ps', 'psF', 'pdf', 'synctex', 'synctex.gz', 'xdv' ) { $small_cleanup_preserved_exts{$_} = 1; } @@ -1024,7 +1038,7 @@ $recorder = 1; # Whether to use recorder option on latex/pdflatex $silent = 0; # Whether fo silence latex's messages (and others) $warnings_as_errors = 0;# Treat warnings as errors and exit with non-zero exit code $silence_logfile_warnings = 0; # Do list warnings in log file -$rc_report = 0; # Whether to report on rc files read +$rc_report = 1; # Whether to report on rc files read $aux_out_dir_report = 0; # Whether to report on aux_dir & out_dir after # initialization and normalization @@ -1609,6 +1623,8 @@ while ($_ = $ARGV[0]) $dependents_list = 1; } elsif (/^-diagnostics/) { $diagnostics = 1; } + elsif (/^-dir-report$/) { $aux_out_dir_report = 1; } + elsif (/^-dir-report-$/) { $aux_out_dir_report = 0; } elsif (/^-dvi$/) { $dvi_mode = 1; } elsif (/^-dvi-$/) { $dvi_mode = 0; } elsif (/^-emulate-aux-dir$/) { $emulate_aux = 1; } @@ -1747,6 +1763,8 @@ while ($_ = $ARGV[0]) elsif (/^-pvctimeout$/) { $pvc_timeout = 1; } elsif (/^-pvctimeout-$/) { $pvc_timeout = 0; } elsif (/^-pvctimeoutmins=(.*)$/) { $pvc_timeout_mins = $1; } + elsif (/^-rc-report$/) { $rc_report = 1; } + elsif (/^-rc-report-$/) { $rc_report = 0; } elsif (/^-recorder$/ ){ $recorder = 1; } elsif (/^-recorder-$/ ){ $recorder = 0; } elsif (/^-rules$/ ) { $rules_list = 1; } @@ -2627,7 +2645,12 @@ if ( $where_log == 2 ) { " correct the problem, even by setting emulation of aux_dir on.\n", " There is a strong suspicion of a bug in $my_name or a configuration error.\n"; } - +if ( $emulate_aux_switched ) { + warn "$My_name: I had to switch -aux-directory on after it was initially off,\n", + " because your *latex program appeared not to support it. You probably\n", + " should either use the option -emulate-aux-dir, or in a latexmkrc file\n", + " set \$emulate_aux = 1;\n"; +} # end MAIN PROGRAM ############################################################# @@ -3910,6 +3933,8 @@ sub print_help " -deps-out=file - Set name of output file for dependency list,\n", " and turn on showing of dependency list\n", " -dF - Filter to apply to dvi file\n", + " -dir-report - Before processing a tex file, report aux and out dir settings\n", + " -dir-report- - Before processing a tex file, do not report aux and out dir settings\n", " -dvi - generate dvi\n", " -dvi- - turn off required dvi\n", " -e - Execute specified Perl code (as part of latexmk start-up\n", @@ -3998,6 +4023,8 @@ sub print_help " -r - Read custom RC file\n", " (N.B. This file could override options specified earlier\n", " on the command line.)\n", + " -rc-report - After initialization, report names of rc files read\n", + " -rc-report- - After initialization, do not report names of rc files read\n", " -recorder - Use -recorder option for *latex\n", " (to give list of input and output files)\n", " -recorder- - Do not use -recorder option for *latex\n", @@ -4463,7 +4490,7 @@ sub set_names { sub move_out_files_from_aux { # Move output and fls files to out_dir # Omit 'xdv', that goes to aux_dir (as with MiKTeX). It's not final output. - foreach my $ext ( 'fls', 'dvi', 'pdf', 'ps' ) { + foreach my $ext ( 'fls', 'dvi', 'pdf', 'ps', 'synctex', 'synctex.gz' ) { # Include fls file, because MiKTeX puts it in out_dir, rather than # aux_dir, which would seem more natural. We must maintain # compatibility. @@ -5320,6 +5347,7 @@ sub find_set_log { else { warn " But emulate_aux is off. So I'll turn it on.\n"; $emulate_aux = 1; + $emulate_aux_switched = 1; foreach ( $$Pext_cmd ) { s/ -output-directory=[^ ]*(?= )//g; s/ -aux(-directory=[^ ]*)(?= )/ -output$1/g; @@ -9438,20 +9466,31 @@ sub make_path_mod { my $dir = $_[0]; my $title = $_[1]; my $ret = 0; - if ( (! -e $dir) && (! -l $dir) ) { + if ( -d $dir ) {} + elsif ( (! -e $dir) && (! -l $dir) ) { + # N.B. A link pointing to a non-existing target + # returns false for -e, so we must also check -l warn "$My_name: making $title directory '$dir'\n" if ! $silent; - make_path( $dir ); - } - elsif ( -l $dir ) { - $ret = 1; - warn "$My_name: you requested $title directory '$dir',\n", - " but there exists a symlink of the same name. I won't create a directory,\n"; + # Error handling from File::Path documentation: + make_path( $dir, {error => \my $err} ); + if ($err && @$err) { + for my $diag (@$err) { + my ($file, $message) = %$diag; + if ($file eq '') { + print "general error in making dir: $message\n"; + } + else { + print "problem making path $file: $message\n"; + } + } + $ret = 1; + } } - elsif ( ! -d $dir ) { + else { $ret = 2; warn "$My_name: you requested $title directory '$dir',\n", - " but an ordinary file of the same name exists.\n"; + " but a non-directory file/symlink of the same name exists.\n"; } return $ret; } diff --git a/support/latexmk/latexmk.txt b/support/latexmk/latexmk.txt index 406625e5ad..6d747b1861 100644 --- a/support/latexmk/latexmk.txt +++ b/support/latexmk/latexmk.txt @@ -61,7 +61,7 @@ DESCRIPTION - 16 May 2021 1 + 29 May 2021 1 @@ -127,7 +127,7 @@ LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE - 16 May 2021 2 + 29 May 2021 2 @@ -193,7 +193,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 16 May 2021 3 + 29 May 2021 3 @@ -259,7 +259,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 16 May 2021 4 + 29 May 2021 4 @@ -325,7 +325,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 16 May 2021 5 + 29 May 2021 5 @@ -391,7 +391,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 16 May 2021 6 + 29 May 2021 6 @@ -457,7 +457,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 16 May 2021 7 + 29 May 2021 7 @@ -523,7 +523,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) - 16 May 2021 8 + 29 May 2021 8 @@ -543,6 +543,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) cult situations. + -dir-report + For each .tex file processed, list the settings for aux and out + directories, after they have been normalized from the settings + specified during initialization. See the description of the + variable $aux_out_dir_report for more details. + + + -dir-report- + Do not report the settings for aux and out directories. (De- + fault) + + -dvi Generate dvi version of document. @@ -574,29 +586,29 @@ LATEXMK(1) General Commands Manual LATEXMK(1) latexmk -e '$latex=q/latex %O -shell-escape %S/' file.tex - Note that the single quotes block normal UNIX/Linux command - shells from treating the characters inside the quotes as spe- - cial. (In this example, the q/.../ construct is a Perl idiom - equivalent to using single quotes. This avoids the complica- - tions of getting a quote character inside an already quoted - string in a way that is independent of both the shell and the - operating-system.) - The above command line will NOT work under MS-Windows with - cmd.exe or command.com or 4nt.exe. For MS-Windows with these - command shells you could use + 29 May 2021 9 - 16 May 2021 9 +LATEXMK(1) General Commands Manual LATEXMK(1) -LATEXMK(1) General Commands Manual LATEXMK(1) + Note that the single quotes block normal UNIX/Linux command + shells from treating the characters inside the quotes as spe- + cial. (In this example, the q/.../ construct is a Perl idiom + equivalent to using single quotes. This avoids the complica- + tions of getting a quote character inside an already quoted + string in a way that is independent of both the shell and the + operating-system.) + The above command line will NOT work under MS-Windows with + cmd.exe or command.com or 4nt.exe. For MS-Windows with these + command shells you could use latexmk -e "$latex=q/latex %O -shell-escape %S/" file.tex @@ -613,6 +625,24 @@ LATEXMK(1) General Commands Manual LATEXMK(1) less problems in dealing with quoting.) + -emulate-aux-dir + Emulate -aux-directory instead of leaving it to the *latex pro- + grams to do it. (MiKTeX supports -aux-directory, but TeXLive + doesn't.) + + For more details see the explanation for the configuration vari- + able $emulate_aux. + + + -emulate-aux-dir- + Turn off emulatation -aux-directory and leave it to the *latex + program to handle the case that aux_dir is not equal to out_dir. + Note that if you use TeXLive, which doesn't support -aux-direc- + tory, latexmk will automatically switch aux_dir emulation on af- + ter the first run of *latex, because it will find the .log file + in the wrong place. + + -f Force latexmk to continue document processing despite errors. Normally, when latexmk detects that LaTeX or another program has found an error which will not be resolved by further processing, @@ -622,6 +652,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) or the rerunning of latex (etc) that would be done if no errors had occurred. If instead, or additionally, you want the latex (etc) program not to pause for user input after an error, you + + + + 29 May 2021 10 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + should arrange this by an option that is passed to the program, e.g., by latexmk's option -interaction=nonstopmode (which la- texmk passes to *latex). @@ -652,18 +694,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -jobname=STRING Set the basename of output files(s) to STRING, instead of the - - - - 16 May 2021 10 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - default, which is the basename of the specified TeX file. (At present, STRING should not contain spaces.) @@ -689,6 +719,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) from xelatex, the basenames would be test1-xelatex and test2-xe- latex. + + + 29 May 2021 11 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + Under MS-Windows with cmd.exe, you would need to double the per- cent sign, so that the percent character is passed to latexmk rather than being used to substitute an environment variable: @@ -718,18 +759,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) typically used to add desired options. Since the string nor- mally contains spaces, it should be quoted, e.g., - - - - 16 May 2021 11 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - latexmk -latex="latex --shell-escape %O %S" foo.tex The specification of the contents of the string are the same as @@ -755,6 +784,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) See also the $silence_logfile_warnings configuration variable. + + + + 29 May 2021 12 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + -logfilewarninglist- -logfilewarnings- After a run of *latex, do not give a list of warnings about undefined citations and references. (Default) @@ -783,20 +824,8 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 - - - - 16 May 2021 12 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - initialization file. + 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- @@ -820,8 +849,20 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -makeindexfudge- - Turn off the change-directory fudge for makeindex. See documen- - tation of $makeindex_fudge for details. + Turn off the change-directory fudge for makeindex. See + + + + 29 May 2021 13 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + + documentation of $makeindex_fudge for details. -MSWinBackSlash @@ -850,18 +891,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $MSWin_back_slash for more details. - - - - 16 May 2021 13 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - -new-viewer When in continuous-preview mode, always start a new viewer to view the generated file. By default, latexmk will, in continu- @@ -888,12 +917,19 @@ LATEXMK(1) General Commands Manual LATEXMK(1) tion of $bibtex_fudge for details. - -norc Turn off the automatic reading of initialization (rc) files. - N.B. Normally the initialization files are read and obeyed, and - then command line options are obeyed in the order they are en- - countered. But -norc is an exception to this rule: it is acted - on first, no matter where it occurs on the command line. + + 29 May 2021 14 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + + -noemulate-aux-dir + Turn aux_dir emulation off. Same as -emulate-aux-dir-. -nomakeindexfudge @@ -901,6 +937,14 @@ LATEXMK(1) General Commands Manual LATEXMK(1) tation of $makeindex_fudge for details. + -norc Turn off the automatic reading of initialization (rc) files. + + N.B. Normally the initialization files are read and obeyed, and + then command line options are obeyed in the order they are en- + countered. But -norc is an exception to this rule: it is acted + on first, no matter where it occurs on the command line. + + -outdir=FOO or -output-directory=FOO Sets the directory for the output files of *latex. This @@ -916,18 +960,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) If you also use the -cd option, and the specified output direc- tory is a relative path, then the path is interpreted relative - - - - 16 May 2021 14 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - to the document directory. @@ -950,6 +982,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -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. + + + + 29 May 2021 15 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + 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). @@ -984,16 +1028,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) Generate pdf version of document using lualatex. - - 16 May 2021 15 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - -pdfps Generate pdf version of document from the .ps file, by default using ps2pdf. @@ -1014,6 +1048,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) is produced once rather than on every run of xelatex.) + + + + 29 May 2021 16 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + -pdf- Turn off generation of pdf version of document. (This can be used to override a setting in a configuration file. It may get overridden if some other option requires the generation of a pdf @@ -1049,17 +1095,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) need to change the single quotes to double quotes (or something else). - - - 16 May 2021 16 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - 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- @@ -1079,6 +1114,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -pretex=CODE + + + + 29 May 2021 17 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + Given that CODE is some TeX code, this options sets that code to be executed before inputting source file. This only works if the command for invoking the relevant *latex is suitably config- @@ -1115,17 +1162,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -ps Generate postscript version of document. - - - 16 May 2021 17 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - -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 @@ -1145,6 +1181,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) latexmk -ps -pF "psnup -2" foo.tex + + + 29 May 2021 18 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + Whether to use single or double quotes round the "psnup -2" will depend on your command interpreter, as used by the particular version of perl and the operating system on your computer. @@ -1179,49 +1226,48 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 + 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 + in latexmk's configuration; see below. - 16 May 2021 18 + 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 + 29 May 2021 19 -LATEXMK(1) General Commands Manual LATEXMK(1) - apparent bug in gv that causes an error when the newly updated - pdf file is read.) Many other previewers will need a manual up- - date. - 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. +LATEXMK(1) General Commands Manual LATEXMK(1) - 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 - "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- - ning.) + running.) -pvc- Turn off -pvc. -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. @@ -1237,46 +1283,57 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -r - 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 + -- 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. + 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. - 16 May 2021 19 + -rc-report + After initialization, give a list of the RC files read. (De- + fault) -LATEXMK(1) General Commands Manual LATEXMK(1) + 29 May 2021 20 - 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. + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + + -rc-report- + After initialization, do not give a list of the RC files read. + (Default) -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. @@ -1293,78 +1350,77 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -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- + 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. - 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, - + 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 + trigger special actions or behavior by latexmk itself. Depending + 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 are: -jobname=STRING, -aux-directory=dir, -output- + directory=DIR, -quiet, and -recorder. - 16 May 2021 20 + 29 May 2021 21 -LATEXMK(1) General Commands Manual LATEXMK(1) - not yet). +LATEXMK(1) General Commands Manual LATEXMK(1) - 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 - called *latex program, and/or may affect other programs as well. - 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, - $dvips_silent_switch, $latex_silent_switch, $luala- - tex_silent_switch $makeindex_silent_switch, $pdfla- + uration variables, the relevant ones being $bib- + tex_silent_switch, $biber_silent_switch, $dvipdf_silent_switch, + $dvips_silent_switch, $latex_silent_switch, $luala- + tex_silent_switch $makeindex_silent_switch, $pdfla- tex_silent_switch, and $xelatex_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.) @@ -1373,15 +1429,25 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $show_time. - -time- Do not show CPU time used. See also the configuration variable + -time- Do not show CPU 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- + 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 + 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 - 16 May 2021 21 + 29 May 2021 22 @@ -1390,39 +1456,28 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - -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- - 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 - 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 + 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 + the source file is read. This option overrides any previous definition 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.) @@ -1444,99 +1499,100 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -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" + 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 + be opened. - 16 May 2021 22 + 29 May 2021 23 -LATEXMK(1) General Commands Manual LATEXMK(1) - 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 - be opened. +LATEXMK(1) General Commands Manual LATEXMK(1) -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. -xelatex Use xelatex. That is, use xelatex to process the source file(s) - to pdf. The generation of dvi and postscript files is turned + to pdf. The generation of dvi and postscript files is turned off. This option is equivalent to using the following set of options -pdfxe -dvi- -ps- - [Note: Note that the method of implementation of this option, - 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 + 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 + 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 -pdfxelatex option: - latexmk -pdfxe -pdfxelatex="xelatex --shell-escape %O %S" + latexmk -pdfxe -pdfxelatex="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 + use of lualatex. That is done by other options or in an initial- + ization file. - 16 May 2021 23 + Compatibility between options + 29 May 2021 24 -LATEXMK(1) General Commands Manual LATEXMK(1) - foo.tex - 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. +LATEXMK(1) General Commands Manual LATEXMK(1) - 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. @@ -1564,88 +1620,98 @@ EXAMPLES 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- + 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- + 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 + 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 + of latexmk's behavior is configurable to deal with particular situa- + tions. (But there is a lot of reading!) + The remainder of these notes consists of ideas for dealing with more - 16 May 2021 24 + 29 May 2021 25 -LATEXMK(1) General Commands Manual LATEXMK(1) - from errors in the source document, but they could also be about miss- - ing LaTeX packages, etc.) +LATEXMK(1) General Commands Manual LATEXMK(1) - 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 - of latexmk's behavior is configurable to deal with particular situa- - tions. (But there is a lot of reading!) - The remainder of these notes consists of ideas for dealing with more difficult situations. - d. Further tricks can involve replacing the standard commands that la- + d. Further tricks can involve replacing the standard commands that la- texmk runs by other commands or scripts. - e. For possible examples of code for use in an RC file, see the direc- - tory example_rcfiles in the distribution of latexmk (e.g., at + e. For possible examples of code for use in an RC file, see the direc- + tory example_rcfiles in the distribution of latexmk (e.g., at http://mirror.ctan.org/support/latexmk/example_rcfiles). Even if these examples don't do what you want, they may provide suitable inspiration. - f. There's a useful trick that can be used when you use lualatex in- - stead of pdflatex (and in some related situations). The problem is - that latexmk won't notice a dependency on a file, bar.baz say, that is - input by the lua code in your document instead of by the LaTeX part. - (Thus if you change bar.baz and rerun latexmk, then latexmk will think - no files have changed and not rerun lualatex, whereas if you had '\in- - put{bar.baz}' in the LaTeX part of the document, latexmk would notice - the change.) One solution is just to put the following somewhere in + f. There's a useful trick that can be used when you use lualatex in- + stead of pdflatex (and in some related situations). The problem is + that latexmk won't notice a dependency on a file, bar.baz say, that is + input by the lua code in your document instead of by the LaTeX part. + (Thus if you change bar.baz and rerun latexmk, then latexmk will think + no files have changed and not rerun lualatex, whereas if you had '\in- + put{bar.baz}' in the LaTeX part of the document, latexmk would notice + the change.) One solution is just to put the following somewhere in the LaTeX part of the document: \typeout{(bar.baz)} - This puts a line in the log file that latexmk will treat as implying - that the file bar.baz was read. (At present I don't know a way of do- - ing this automatically.) Of course, if the file has a different name, + This puts a line in the log file that latexmk will treat as implying + that the file bar.baz was read. (At present I don't know a way of do- + ing this automatically.) Of course, if the file has a different name, change bar.baz to the name of your file. g. See also the section "Advanced Configuration: Some extra resources". - h. Look on tex.stackexchange, i.e., at http://tex.stackex- - change.com/questions/tagged/latexmk Someone may have already solved + 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 + j. Or ask me (the author of latexmk). My e-mail is at the end of this documentation. ALLOWING FOR CHANGE OF OUTPUT FILE TYPE When one of the latex engines is run, the usual situation is that latex - produces a .dvi file, while pdflatex and lualatex produce a .pdf file. - For xelatex the default is to produce a .pdf file, but to optimize + produces a .dvi file, while pdflatex and lualatex produce a .pdf file. + For xelatex the default is to produce a .pdf file, but to optimize pro- + cessing time latexmk runs xelatex its -no-pdf option so that it pro- + duces an .xdv file. Further processing by latexmk takes this as a + starting point. + + However, the actual output file may differ from the normal expectation; + and then latexmk can adjust its processing to accommodate this situa- + tion. The difference in output file type can happen for two reasons: + One is that for latex, pdflatex and lualatex the document itself can + override the defaults. The other is that there may be a configuration, + or misconfiguration, such that the program that latexmk invokes to - 16 May 2021 25 + 29 May 2021 26 @@ -1654,88 +1720,78 @@ ALLOWING FOR CHANGE OF OUTPUT FILE TYPE LATEXMK(1) General Commands Manual LATEXMK(1) - processing time latexmk runs xelatex its -no-pdf option so that it pro- - duces an .xdv file. Further processing by latexmk takes this as a - starting point. + compile the document is not the expected one, or is given options in- + compatible with what latexmk initially expects. - However, the actual output file may differ from the normal expectation; - and then latexmk can adjust its processing to accommodate this situa- - tion. The difference in output file type can happen for two reasons: - One is that for latex, pdflatex and lualatex the document itself can - override the defaults. The other is that there may be a configuration, - or misconfiguration, such that the program that latexmk invokes to com- - pile the document is not the expected one, or is given options incom- - patible with what latexmk initially expects. - - Under latex and pdflatex, control of the output format by the document - is done by setting the \pdfoutput macro. Under lualatex, the \output- + Under latex and pdflatex, control of the output format by the document + is done by setting the \pdfoutput macro. Under lualatex, the \output- mode macro is used instead. One example of an important use-case for document control of the output - format is a document that uses the psfrag package to insert graphical + format is a document that uses the psfrag package to insert graphical elements in the output file. The psfrag package achieves its effects by inserting postscript code in the output of the compilation of the docu- - ment. This entails the use of compilation to a .dvi file, followed by - the use of conversion to a postscript file (either directly, as by - dvips or implicitly, as an intermediate step by dvipdf). Then it is - useful to force output to be of the .dvi format by inserting \pdfout- + ment. This entails the use of compilation to a .dvi file, followed by + the use of conversion to a postscript file (either directly, as by + dvips or implicitly, as an intermediate step by dvipdf). Then it is + 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- + 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. + 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. The first is that latexmk's $allow_switch configuration variable is set - to a non-zero value as it is by default. If this variable is zero, a + to a non-zero value as it is by default. If this variable is zero, a mismatch of filetypes in the compilation results in an erro. - The second condition for latexmk to be able to handle a change of out- - put type is that no explicit requests for .dvi or .ps output files are - made. Explicit requests are by the -dvi and -ps, -print=dvi, - -print=ps, -view=dvi, and -view=ps options, and by corresponding set- - tings of the $dvi_mode, $postscript_mode, $print_type, and $view con- - figuration variables. The print-type and view-type restrictions only + The second condition for latexmk to be able to handle a change of out- + put type is that no explicit requests for .dvi or .ps output files are + made. Explicit requests are by the -dvi and -ps, -print=dvi, + -print=ps, -view=dvi, and -view=ps options, and by corresponding set- + tings of the $dvi_mode, $postscript_mode, $print_type, and $view con- + figuration variables. The print-type and view-type restrictions only apply when printing and viewing are explicitly requested, respectively. - For this purpose, the use of the -pdfdvi and -pdfps options (and the - corresponding setting of the $pdf_mode variable) does not count as an - explicit request for the .dvi and .ps files; they are merely regarded - as a request for making a .pdf file together with an initial proposal + For this purpose, the use of the -pdfdvi and -pdfps options (and the + corresponding setting of the $pdf_mode variable) does not count as an + explicit request for the .dvi and .ps files; they are merely regarded + as a request for making a .pdf file together with an initial proposal + for the processing route to make it. + Note that when accommodating a change in output file type, there is in- + volved a substantial change in the network of rules that latexmk uses + in its actions. The second condition applied to accommodate a change + is to avoid situations where the change in the rule network is too rad- + ical to be readily handled automatically. - 16 May 2021 26 + 29 May 2021 27 -LATEXMK(1) General Commands Manual LATEXMK(1) - for the processing route to make it. - Note that when accommodating a change in output file type, there is in- - volved a substantial change in the network of rules that latexmk uses - in its actions. The second condition applied to accommodate a change - is to avoid situations where the change in the rule network is too rad- - ical to be readily handled automatically. +LATEXMK(1) General Commands Manual LATEXMK(1) CONFIGURATION/INITIALIZATION (RC) FILES - In this section is explained which configuration files are read by la- - texmk. Subsequent sections "How to Set Variables in Initialization - Files", "Format of Command Specifications", "List of Configuration - Variables Usable in Initialization Files", "Custom Dependencies", and - "Advanced Configuration" give details on what can be configured and + In this section is explained which configuration files are read by la- + texmk. Subsequent sections "How to Set Variables in Initialization + Files", "Format of Command Specifications", "List of Configuration + Variables Usable in Initialization Files", "Custom Dependencies", and + "Advanced Configuration" give details on what can be configured and how. Latexmk can be customized using initialization files, which are read at @@ -1748,7 +1804,7 @@ CONFIGURATION/INITIALIZATION (RC) FILES "/usr/local/share/latexmk/LatexMk", "/usr/local/lib/latexmk/LatexMk". On a MS-Windows system it looks for "C:\latexmk\LatexMk". - On a cygwin system (i.e., a MS-Windows system in which Perl is that + On a cygwin system (i.e., a MS-Windows system in which Perl is that of cygwin), latexmk reads the first it finds of "/cygdrive/c/latexmk/LatexMk", "/opt/local/share/latexmk/LatexMk", @@ -1758,73 +1814,73 @@ CONFIGURATION/INITIALIZATION (RC) FILES In addition, it then tries the same set of locations, but with the file name replaced "LatexMk" replaced by "latexmkrc". - If the environment variable LATEXMKRCSYS is set, its value is used as + If the environment variable LATEXMKRCSYS is set, its value is used as the name of the system RC file, instead of any of the above. 2) The user's RC file, if it exists. This can be in one of two places. - The traditional one is ".latexmkrc" in the user's home directory. The - other possibility is "latexmk/latexmkrc" in the user's XDG configura- - tion home directory. The actual file read is the first of "$XDG_CON- - FIG_HOME/latexmk/latexmkrc" or "$HOME/.latexmkrc" which exists. (See + The traditional one is ".latexmkrc" in the user's home directory. The + other possibility is "latexmk/latexmkrc" in the user's XDG configura- + tion home directory. The actual file read is the first of "$XDG_CON- + FIG_HOME/latexmk/latexmkrc" or "$HOME/.latexmkrc" which exists. (See https://specifications.freedesktop.org/basedir-spec/basedir-spec-lat- est.html for details on the XDG Base Directory Specification.) - Here $HOME is the user's home directory. [Latexmk determines the - user's home directory as follows: It is the value of the environment - variable HOME, if this variable exists, which normally is the case on - UNIX-like systems (including Linux and OS-X). Otherwise the environ- - ment variable USERPROFILE is used, if it exists, which normally is the + Here $HOME is the user's home directory. [Latexmk determines the + user's home directory as follows: It is the value of the environment + variable HOME, if this variable exists, which normally is the case on + UNIX-like systems (including Linux and OS-X). Otherwise the environ- + ment variable USERPROFILE is used, if it exists, which normally is the + case on MS-Windows systems. Otherwise a blank string is used instead of + $HOME, in which case latexmk does not look for an RC file in it.] + $XDG_CONFIG_HOME is the value of the environment variable XDG_CON- + FIG_HOME if it exists. If this environment variable does not exist, + but $HOME is non-blank, then $XDG_CONFIG_HOME is set to the default + value of $HOME/.config. Otherwise $XDG_CONFIG_HOME is blank, and la- + texmk does not look for an RC file under it. - 16 May 2021 27 + 29 May 2021 28 -LATEXMK(1) General Commands Manual LATEXMK(1) - case on MS-Windows systems. Otherwise a blank string is used instead of - $HOME, in which case latexmk does not look for an RC file in it.] - $XDG_CONFIG_HOME is the value of the environment variable XDG_CON- - FIG_HOME if it exists. If this environment variable does not exist, - but $HOME is non-blank, then $XDG_CONFIG_HOME is set to the default - value of $HOME/.config. Otherwise $XDG_CONFIG_HOME is blank, and la- - texmk does not look for an RC file under it. +LATEXMK(1) General Commands Manual LATEXMK(1) - 3) The RC file in the current working directory. This file can be - named either "latexmkrc" or ".latexmkrc", and the first of these to be + 3) The RC file in the current working directory. This file can be + named either "latexmkrc" or ".latexmkrc", and the first of these to be found is used, if any. 4) Any RC file(s) specified on the command line with the -r option. Each RC file is a sequence of Perl commands. Naturally, a user can use - this in creative ways. But for most purposes, one simply uses a se- + this in creative ways. But for most purposes, one simply uses a se- quence of assignment statements that override some of the built-in set- - tings of Latexmk. Straightforward cases can be handled without knowl- - edge of the Perl language by using the examples in this document as + tings of Latexmk. Straightforward cases can be handled without knowl- + edge of the Perl language by using the examples in this document as templates. Comment lines are introduced by the "#" character. - Note that command line options are obeyed in the order in which they + Note that command line options are obeyed in the order in which they are written; thus any RC file specified on the command line with the -r - option can override previous options but can be itself overridden by - later options on the command line. There is also the -e option, which + option can override previous options but can be itself overridden by + later options on the command line. There is also the -e option, which allows initialization code to be specified in latexmk's command line. For possible examples of code for in an RC file, see the directory ex- - ample_rcfiles in the distribution of latexmk (e.g., at http://mir- + 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 - The important variables that can be configured are described in the - section "List of configuration variables usable in initialization - files". (See the earlier section "Configuration/Initialization (rc) - Files" for the files where the configurations are done.) Syntax for + The important variables that can be configured are described in the + section "List of configuration variables usable in initialization + files". (See the earlier section "Configuration/Initialization (rc) + Files" for the files where the configurations are done.) Syntax for setting these variables is of the following forms: $bibtex = 'bibtex %O %S'; @@ -1837,60 +1893,60 @@ HOW TO SET VARIABLES IN INITIALIZATION FILES @default_files = ('paper', 'paper1'); - for the setting of an array of strings. It is possible to append an + for the setting of an array of strings. It is possible to append an item to an array variable as follows: + push @default_files, 'paper2'; + Note that simple "scalar" variables have names that begin with a $ + character and array variables have names that begin with a @ character. + Each statement ends with a semicolon. + Strings should be enclosed in single quotes. (You could use double + quotes, as in many programming languages. But then the Perl program- + ming language brings into play some special rules for interpolating + variables into strings. People not fluent in Perl will want to avoid - 16 May 2021 28 + 29 May 2021 29 -LATEXMK(1) General Commands Manual LATEXMK(1) - push @default_files, 'paper2'; +LATEXMK(1) General Commands Manual LATEXMK(1) - Note that simple "scalar" variables have names that begin with a $ - character and array variables have names that begin with a @ character. - Each statement ends with a semicolon. - Strings should be enclosed in single quotes. (You could use double - quotes, as in many programming languages. But then the Perl program- - ming language brings into play some special rules for interpolating - variables into strings. People not fluent in Perl will want to avoid these complications.) - You can do much more complicated things, but for this you will need to + You can do much more complicated things, but for this you will need to consult a manual for the Perl programming language. FORMAT OF COMMAND SPECIFICATIONS - Some of the variables set the commands that latexmk uses for carrying - out its work, for example to generate a .dvi file from a .tex file or - to view a postscript file. This section describes some important fea- + Some of the variables set the commands that latexmk uses for carrying + out its work, for example to generate a .dvi file from a .tex file or + to view a postscript file. This section describes some important fea- tures of how the commands are specified. (Note that some of the possi- - bilities listed here do not apply to the $kpsewhich variable; see its + 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 + place of the regular latex command, and suppose moreover that you + wanted to give it the option "--shell-escape". You could do this by the following setting: $latex = 'elatex --shell-escape %O %S'; - The two items starting with the % character are placeholders. These - are substituted by appropriate values before the command is run. Thus - %S will be replaced by the source file that elatex will be applied to, - and %O will be replaced by any options that latexmk has decided to use + The two items starting with the % character are placeholders. These + are substituted by appropriate values before the command is run. Thus + %S will be replaced by the source file that elatex will be applied to, + and %O will be replaced by any options that latexmk has decided to use for this command. (E.g., if you used the -silent option in the invoca- - tion of latexmk, it results in the replacement of %O by "-interac- + tion of latexmk, it results in the replacement of %O by "-interac- tion=batchmode".) The available placeholders are: @@ -1899,120 +1955,120 @@ FORMAT OF COMMAND SPECIFICATIONS the setting of a jobname by the -jobname option or the $jobname configuration value. - %B base of filename for current command. E.g., if a postscript - file document.ps is being made from the dvi file document.dvi, + %B base of filename for current command. E.g., if a postscript + file document.ps is being made from the dvi file document.dvi, then the basename is document. - %D destination file (e.g., the name of the postscript file when + %D destination file (e.g., the name of the postscript file when converting a dvi file to postscript). + %O options + %P If the variable $pre_tex_code is non-empty, then %P is substi- + tuted by the contents of $pre_tex_code followed by \in- + put{SOURCE}, where SOURCE stands for the name of the source + file. Appropriate quoting is done. This enables TeX code to be + passed to one of the *latex engines to be executed before the + source file is read. + If the variable $pre_tex_code is the empty string, then %P is - 16 May 2021 29 + 29 May 2021 30 -LATEXMK(1) General Commands Manual LATEXMK(1) - %O options +LATEXMK(1) General Commands Manual LATEXMK(1) - %P If the variable $pre_tex_code is non-empty, then %P is substi- - tuted by the contents of $pre_tex_code followed by \in- - put{SOURCE}, where SOURCE stands for the name of the source - file. Appropriate quoting is done. This enables TeX code to be - passed to one of the *latex engines to be executed before the - source file is read. - If the variable $pre_tex_code is the empty string, then %P is equivalent to %S. %R root filename. This is the base name for the main tex file. - By default this is the basename of the main tex file. However - the value can be changed by the use of the -jobname option or + By default this is the basename of the main tex file. However + the value can be changed by the use of the -jobname option or the $jobname configuration variable. - %S source file (e.g., the name of the dvi file when converting a + %S source file (e.g., the name of the dvi file when converting a .dvi file to ps). %T The name of the primary tex file. - %U If the variable $pre_tex_code is non-empty, then its value is - substituted for %U (appropriately quoted). Otherwise it is re- + %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 + to UNIX and MS-Windows, i.e., ':', '/' and '\'. Note that if + after initialization, $out_dir is set, but $aux_dir is not set + (i.e., it is blank), then latexmk sets $aux_dir to the same value $out_dir. - %Z Name of directory for output files (see the configuration vari- - able $out_dir). A directory separation character ('/') is ap- - pended if $out_dir is non-empty and does not end in a suitable - character, with suitable characters being those appropriate to + %Z Name of directory for output files (see the configuration vari- + able $out_dir). A directory separation character ('/') is ap- + pended if $out_dir is non-empty and does not end in a suitable + character, with suitable characters being those appropriate to UNIX and MS-Windows, i.e., ':', '/' and '\'. - If for some reason you need a literal % character in your string not + If for some reason you need a literal % character in your string not subject to the above rules, use "%%". - Appropriate quoting will be applied to the filename substitutions, so - you mustn't supply them yourself even if the names of your files have + Appropriate quoting will be applied to the filename substitutions, so + you mustn't supply them yourself even if the names of your files have spaces in them. (But if your TeX filenames have spaces in them, beware - that some older versions of the TeX program cannot correctly handle - filenames containing spaces.) In case latexmk's quoting does not work - correctly on your system, you can turn it off -- see the documentation + that some older versions of the TeX program cannot correctly handle + filenames containing spaces.) In case latexmk's quoting does not work + correctly on your system, you can turn it off -- see the documentation for the variable $quote_filenames. - See the default values in the section "List of configuration variables + See the default values in the section "List of configuration variables + usable in initialization files" for what is normally the most appropri- + ate usage. + If you omit to supply any placeholders whatever in the specification of + a command, latexmk will supply what its author thinks are appropriate + defaults. This gives compatibility with configuration files for previ- + ous versions of latexmk, which didn't use placeholders. + "Detaching" a command: Normally when latexmk runs a command, it waits + for the command to run to completion. This is appropriate for commands - 16 May 2021 30 + 29 May 2021 31 -LATEXMK(1) General Commands Manual LATEXMK(1) - usable in initialization files" for what is normally the most appropri- - ate usage. +LATEXMK(1) General Commands Manual LATEXMK(1) - If you omit to supply any placeholders whatever in the specification of - a command, latexmk will supply what its author thinks are appropriate - defaults. This gives compatibility with configuration files for previ- - ous versions of latexmk, which didn't use placeholders. - "Detaching" a command: Normally when latexmk runs a command, it waits - for the command to run to completion. This is appropriate for commands like latex, of course. But for previewers, the command should normally - run detached, so that latexmk gets the previewer running and then re- - turns to its next task (or exits if there is nothing else to do). To - achieve this effect of detaching a command, you need to precede the + run detached, so that latexmk gets the previewer running and then re- + turns to its next task (or exits if there is nothing else to do). To + achieve this effect of detaching a command, you need to precede the command name with "start ", as in $dvi_previewer = 'start xdvi %O %S'; - This will be translated to whatever is appropriate for your operating + This will be translated to whatever is appropriate for your operating system. Notes: (1) In some circumstances, 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 + 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 @@ -2024,47 +2080,46 @@ LATEXMK(1) General Commands Manual LATEXMK(1) %S'; $pdf_previewer = 'start "c:/Program Files/SumatraPDF/Suma- traPDF.exe" %O %S'; - $pdf_previewer = 'start "c:/Program Files/SumatraPDF (x86)/Suma- + $pdf_previewer = 'start "c:/Program Files/SumatraPDF (x86)/Suma- traPDF.exe" %O %S'; - (Note about the above example: Under MS-Windows forward slashes are + (Note about the above example: Under MS-Windows forward slashes are equivalent to backslashes in a filename under almost all circumstances, - provided that the filename is inside double quotes. It is easier to + provided that the filename is inside double quotes. It is easier to use forward slashes in examples like the one above, since then one does - not have to worry about the rules for dealing with forward slashes in + not have to worry about the rules for dealing with forward slashes in strings in the Perl language.) - Command names under Cygwin: If latexmk is executed by Cygwin's Perl, + Command names under Cygwin: If latexmk is executed by Cygwin's Perl, be particularly certain that pathnames in commands have forward slashes - not the usual backslashes for the separator of pathname components. - + not the usual backslashes for the separator of pathname components. + See the above examples. Backslashes often get misinterpreted by the + Unix shell used by Cygwin's Perl to execute external commands. Forward + slashes don't suffer from this problem, and (when quoted, as above) are + equally acceptable to MS-Windows. + Using MS-Windows file associations: A useful trick under modern ver- + sions of MS-Windows (e.g., WinXP) is to use just the command 'start' by + itself: - 16 May 2021 31 + $dvi_previewer = 'start %S'; + 29 May 2021 32 -LATEXMK(1) General Commands Manual LATEXMK(1) - See the above examples. Backslashes often get misinterpreted by the - Unix shell used by Cygwin's Perl to execute external commands. Forward - slashes don't suffer from this problem, and (when quoted, as above) are - equally acceptable to MS-Windows. - Using MS-Windows file associations: A useful trick under modern ver- - sions of MS-Windows (e.g., WinXP) is to use just the command 'start' by - itself: +LATEXMK(1) General Commands Manual LATEXMK(1) - $dvi_previewer = 'start %S'; Under MS-Windows, this will cause to be run whatever program the system - has associated with dvi files. (The same applies for a postscript + has associated with dvi files. (The same applies for a postscript viewer and a pdf viewer.) But note that this trick is not always suit- - able for the pdf previwer, if your system has acroread for the default + able for the pdf previwer, if your system has acroread for the default pdf viewer. As explained elsewhere, acroread under MS-Windows does not work well with latex and latexmk, because acroread locks the pdf file. @@ -2073,18 +2128,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $lpr = 'NONE lpr'; - This typically is used when an appropriate command does not exist on + This typically is used when an appropriate command does not exist on your system. The string after the "NONE" is effectively a comment. Options to commands: Setting the name of a command can be used not only for changing the name of the command called, but also to add options to - command. Suppose you want latexmk to use latex with source specials - enabled. Then you might use the following line in an initialization + command. Suppose you want latexmk to use latex with source specials + enabled. Then you might use the following line in an initialization file: $latex = 'latex --src-specials %O %S'; - Running a subroutine instead of an external command: Use a specifica- + Running a subroutine instead of an external command: Use a specifica- tion starting with "internal", as in $latex = 'internal mylatex %O %S'; @@ -2094,41 +2149,41 @@ LATEXMK(1) General Commands Manual LATEXMK(1) return system 'latex', @args; } - For some of the more exotic possibilities that then become available, - see the section "ADVANCED CONFIGURATION: Some extra resources and ad- - vanced tricks". Also see some of the examples in the directory exam- + For some of the more exotic possibilities that then become available, + see the section "ADVANCED CONFIGURATION: Some extra resources and ad- + vanced tricks". Also see some of the examples in the directory exam- ple_rcfiles in the latexmk distribution. - Advanced tricks: Normally one specifies a single command for the com- - mands invoked by latexmk. Naturally, if there is some complicated ad- - ditional processing you need to do in your special situation, you can + Advanced tricks: Normally one specifies a single command for the com- + mands invoked by latexmk. Naturally, if there is some complicated ad- + ditional processing you need to do in your special situation, you can write a script (or batch file) to do the processing, and then configure latexmk to use your script in place of the standard program. + You can also use a Perl subroutine instead of a script -- see above. + This is generally the most flexible and portable solution. + It is also possible to configure latexmk to run multiple commands. For + example, if when running pdflatex to generate a pdf file from a tex + file you need to run another program after pdflatex to perform some ex- + tra processing, you could do something like: - 16 May 2021 32 + $pdflatex = 'pdflatex --shell-escape %O %S; pst2pdf_for_latexmk + %B'; + 29 May 2021 33 -LATEXMK(1) General Commands Manual LATEXMK(1) - You can also use a Perl subroutine instead of a script -- see above. - This is generally the most flexible and portable solution. - It is also possible to configure latexmk to run multiple commands. For - example, if when running pdflatex to generate a pdf file from a tex - file you need to run another program after pdflatex to perform some ex- - tra processing, you could do something like: +LATEXMK(1) General Commands Manual LATEXMK(1) - $pdflatex = 'pdflatex --shell-escape %O %S; pst2pdf_for_latexmk - %B'; - This definition assumes you are using a UNIX-like system (which in- - cludes Linux and OS-X), so that the two commands to be run are sepa- + This definition assumes you are using a UNIX-like system (which in- + cludes Linux and OS-X), so that the two commands to be run are sepa- rated by the semicolon in the middle of the string. If you are using MS-Windows, you would replace the above line by @@ -2136,110 +2191,121 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $pdflatex = 'cmd /c pdflatex --shell-escape %O %S' . '&& pst2pdf_for_latexmk %B'; - Here, the UNIX command separator ; is replaced by &&. In addition, + 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 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 + 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, - i.e., the behavior occurs, while a zero value indicates a false value, + are boolean in character, concerning whether latexmk does or does not + behave in a certain way, a non-zero value, normally 1, indicates true, + i.e., the behavior occurs, while a zero value indicates a false value, i.e., the behavior does not occur. $allow_switch [1] - This controls what happens when the output extension of latex, - pdflatex, lualatex or xelatex differs from what is expected. + This controls what happens when the output extension of latex, + pdflatex, lualatex or xelatex differs from what is expected. (The possible extensions are .dvi, .pdf, .xdv.) This can happen - with the use of the \pdfoutput macro in a document compiled un- - der latex or pdflatex, or with the use of the \outputmode macro + with the use of the \pdfoutput macro in a document compiled un- + der latex or pdflatex, or with the use of the \outputmode macro under lualatex. It can also happen with certain kinds of incor- rect configuration. - In such a case, latexmk can appropriately adjust its network of + In such a case, latexmk can appropriately adjust its network of rules. The adjustment is made if $allow_switch is on, and if no request for a dvi or ps file has been made. See the section ALLOWING FOR CHANGE OF OUTPUT EXTENSION. + $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.) - 16 May 2021 33 + This use of a temporary file solves a problem that the making of + 29 May 2021 34 -LATEXMK(1) General Commands Manual LATEXMK(1) - $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.) - This use of a temporary file solves a problem that the making of +LATEXMK(1) General Commands Manual LATEXMK(1) + + 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. + applies only if preview-continuous mode (-pvc option) is used. See $tmpdir for the setting of the directory where the temporary file is created. $analyze_input_log_always [1] - After a run of latex (etc), always analyze .log for input files - in the <...> and (...) constructions. Otherwise, only do the + After a run of latex (etc), always analyze .log for input files + in the <...> and (...) constructions. Otherwise, only do the analysis when fls file doesn't exist or is out of date. - Under normal circumstances, the data in the fls file is reli- + Under normal circumstances, the data in the fls file is reli- able, and the test of the log file gets lots of false positives; - usually $analyze_input_log_always is best set to zero. But the - test of the log file is needed at least in the following situa- - tion: When a user needs to persuade latexmk that a certain file - is a source file, and latexmk doesn't otherwise find it. Then - the user can write code that causes a line with (...) to be - written to log file. One important case is for lualatex, which - doesn't always generate lines in the .fls file for input lua - files. (The situation with lualatex is HIGHLY version depen- - dent, e.g., there was a big change between TeXLive 2016 and + usually $analyze_input_log_always is best set to zero. But the + test of the log file is needed at least in the following situa- + tion: When a user needs to persuade latexmk that a certain file + is a source file, and latexmk doesn't otherwise find it. Then + the user can write code that causes a line with (...) to be + written to log file. One important case is for lualatex, which + doesn't always generate lines in the .fls file for input lua + files. (The situation with lualatex is HIGHLY version depen- + dent, e.g., there was a big change between TeXLive 2016 and TeXLive 2017.) - To keep backward compatibility with older versions of latexmk, + To keep backward compatibility with older versions of latexmk, the default is to set $analyze_input_log_always to 1. $auto_rc_use [1] - Whether to automatically read the standard initialization (rc) + Whether to automatically read the standard initialization (rc) files, which are the system RC file, the user's RC file, and the RC file in the current directory. The command line option -norc - can be used to turn this setting off. Each RC file could also - turn this setting off, i.e., it could set $auto_rc_use to zero + can be used to turn this setting off. Each RC file could also + turn this setting off, i.e., it could set $auto_rc_use to zero to prevent automatic reading of the later RC files. - This variable does not affect the reading of RC files specified + This variable does not affect the reading of RC files specified on the command line by the -r option. + $aux_dir [""] + 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 $aux_dir is set to $out_dir, which is the + directory to which general output files are to be written. + + Important note: The effect of $aux_dir, if different from + $out_dir, is achieved by giving *latex the -aux-directory. Cur- + rently (Dec. 2011 and later) this only works on the MiKTeX - 16 May 2021 34 + 29 May 2021 35 @@ -2248,24 +2314,34 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - $aux_dir [""] - 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 $aux_dir is set to $out_dir, which is the - directory to which general output files are to be written. - - Important note: The effect of $aux_dir, if different from - $out_dir, is achieved by giving *latex the -aux-directory. Cur- - rently (Dec. 2011 and later) this only works on the MiKTeX ver- - sion of *latex. + version of *latex. See also the documentation of $out_dir for some complications on what directory names are suitable. - If you also use the -cd option, and $out_dir (or $aux_dir) con- - tains a relative path, then the path is interpreted relative to + If you also use the -cd option, and $out_dir (or $aux_dir) con- + tains a relative path, then the path is interpreted relative to the document directory. + + $aux_out_dir_report [0] + For each .tex file processed, list the settings for aux and out + directories, after they have been normalized from the settings + specified during initialization. + + This report gives a reminder of where to look for output. + + The report has to be done per file, because of possible direc- + tory changes for each file. In the simplest cases, the result + is the same as originally specified. In general, e.g., with an + absolute directory specified, the normalization helps perfor- + mance and cleans up output to the screen. It also avoids situa- + tions where a file in the current directory is refered to by + different names, e.g., "file.aux" and "./file.aux", which can be + annoying. + + + $banner [0] If nonzero, the banner message is printed across each page when converting the dvi file to postscript. Without modifying the @@ -2292,20 +2368,10 @@ LATEXMK(1) General Commands Manual LATEXMK(1) scale for your message, as a rule of thumb the scale should be about equal to 1100 divided by the number of characters in the message. The Default is just right for 5 character messages. - This is equivalent to the -bs option. - - @BIBINPUTS - This is an array variable, now mostly obsolete, that specifies - directories where latexmk should look for .bib files. By de- - fault it is set from the BIBINPUTS environment variable of the - operating system. If that environment variable is not set, a - single element list consisting of the current directory is set. - The format of the directory names depends on your operating sys- - tem, of course. Examples for setting this variable are: - 16 May 2021 35 + 29 May 2021 36 @@ -2314,6 +2380,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) + This is equivalent to the -bs option. + + @BIBINPUTS + This is an array variable, now mostly obsolete, that specifies + directories where latexmk should look for .bib files. By de- + fault it is set from the BIBINPUTS environment variable of the + operating system. If that environment variable is not set, a + single element list consisting of the current directory is set. + The format of the directory names depends on your operating sys- + tem, of course. Examples for setting this variable are: + @BIBINPUTS = ( ".", "C:\\bibfiles" ); @BIBINPUTS = ( ".", "\\server\bibfiles" ); @BIBINPUTS = ( ".", "C:/bibfiles" ); @@ -2357,31 +2434,31 @@ LATEXMK(1) General Commands Manual LATEXMK(1) refuse to write its bbl and blg files, for security reasons, for certain cases of the path component of the filename given to it. - However, there are also rare cases where the change-directory - method prevents bibtex from finding certain bib or bst files. - Then $bibtex_fudge needs to be set to 0. - $bibtex_silent_switch ["-terse"] - Switch(es) for the BibTeX processing program when silent mode is - on. - $bibtex_use [1] - Under what conditions to run bibtex or biber. When latexmk + 29 May 2021 37 - 16 May 2021 36 +LATEXMK(1) General Commands Manual LATEXMK(1) + However, there are also rare cases where the change-directory + method prevents bibtex from finding certain bib or bst files. + Then $bibtex_fudge needs to be set to 0. -LATEXMK(1) General Commands Manual LATEXMK(1) + $bibtex_silent_switch ["-terse"] + Switch(es) for the BibTeX processing program when silent mode is + on. - discovers from the log file that one (or more) bibtex/biber-gen- - erated bibliographies are used, it can run bibtex or biber when- + $bibtex_use [1] + Under what conditions to run bibtex or biber. When latexmk dis- + covers from the log file that one (or more) bibtex/biber-gener- + ated bibliographies are used, it can run bibtex or biber when- ever it appears necessary to regenerate the bbl file(s) from their source bib database file(s). But sometimes, the bib file(s) are not available (e.g., for a document obtained from an @@ -2423,21 +2500,10 @@ LATEXMK(1) General Commands Manual LATEXMK(1) consequences, since the files to be deleted are determined from a file created by *latex, which can contain erroneous informa- tion. Therefore this variable is turned off by default, and then - files to be deleted are restricted to those explictly specified - by patterns configured in the variables clean_ext, - clean_full_ext, and @generated_exts, together with those very - standard cases that are hardwired into latexmk (e.g., .log - files). - - $cleanup_mode [0] - If nonzero, specifies cleanup mode: 1 for full cleanup, 2 for - cleanup except for .dvi, .ps and .pdf files, 3 for cleanup ex- - cept for dep and aux files. (There is also extra cleaning as - specified by the $clean_ext, $clean_full_ext and @generated_exts - 16 May 2021 37 + 29 May 2021 38 @@ -2446,6 +2512,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) + files to be deleted are restricted to those explictly specified + by patterns configured in the variables clean_ext, + clean_full_ext, and @generated_exts, together with those very + standard cases that are hardwired into latexmk (e.g., .log + files). + + $cleanup_mode [0] + If nonzero, specifies cleanup mode: 1 for full cleanup, 2 for + cleanup except for .dvi, .ps and .pdf files, 3 for cleanup ex- + cept for dep and aux files. (There is also extra cleaning as + specified by the $clean_ext, $clean_full_ext and @generated_exts variables.) This variable is equivalent to specifying one of the -c or -C @@ -2489,27 +2566,27 @@ LATEXMK(1) General Commands Manual LATEXMK(1) See also the variable @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. - 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. + 29 May 2021 39 - 16 May 2021 38 +LATEXMK(1) General Commands Manual LATEXMK(1) + $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. + More general patterns are allowed, as for $clean_ext. -LATEXMK(1) General Commands Manual LATEXMK(1) + 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 @@ -2554,30 +2631,30 @@ LATEXMK(1) General Commands Manual LATEXMK(1) it normally does. When the commands are executed, the place- holder string %D is replaced by the name of the destination file, which is the previewed file. The above commands result in - an appropriate string being appended to the filename in the win- - dow title: " compiling", " OK", or " FAILURE". + an appropriate string being appended to the filename in the - 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 + 29 May 2021 40 - 16 May 2021 39 +LATEXMK(1) General Commands Manual LATEXMK(1) -LATEXMK(1) General Commands Manual LATEXMK(1) + window 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 "internal" keyword in the definitions to get the subroutine to be invoked. (See the section "Format of Command Specifications" for how to do this.) @@ -2620,22 +2697,11 @@ LATEXMK(1) General Commands Manual LATEXMK(1) @default_files [("*.tex")] Default list of files to be processed. - If no filenames are specified on the command line, latexmk pro- - cesses all tex files specified in the @default_files variable, - which by default is set to all tex files ("*.tex") in the cur- - rent directory. This is a convenience: just run latexmk and it - will process an appropriate set of files. But sometimes you - 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 - 16 May 2021 40 + 29 May 2021 41 @@ -2644,6 +2710,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) + 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. + Three examples: @default_files = ("paper_current"); @@ -2677,6 +2754,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) "-", 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- @@ -2685,323 +2763,352 @@ LATEXMK(1) General Commands Manual LATEXMK(1) tions on latexmk's command line. $dvi_filter [empty] - The dvi file filter to be run on the newly produced dvi file be- - fore other processing. Equivalent to specifying the -dF option. + The dvi file filter to be run on the newly produced dvi file - $dvi_mode [See below for default] - If nonzero, generate a dvi version of the document. Equivalent - to the -dvi option. - The variable $dvi_mode defaults to 0, but if no explicit re- - quests are made for other types of file (postscript, pdf), then - $dvi_mode will be set to 1. In addition, if a request for a - file for which a .dvi file is a prerequisite, then $dvi_mode - will be set to 1. + 29 May 2021 42 - 16 May 2021 41 +LATEXMK(1) General Commands Manual LATEXMK(1) + before other processing. Equivalent to specifying the -dF op- + tion. -LATEXMK(1) General Commands Manual LATEXMK(1) + $dvi_mode [See below for default] + If nonzero, generate a dvi version of the document. Equivalent + to the -dvi option. + The variable $dvi_mode defaults to 0, but if no explicit re- + quests are made for other types of file (postscript, pdf), then + $dvi_mode will be set to 1. In addition, if a request for a + file for which a .dvi file is a prerequisite, then $dvi_mode + will be set to 1. $dvi_previewer ["start xdvi %O %S" under UNIX] - The command to invoke a dvi-previewer. [Under MS-Windows the - default is "start"; then latexmk arranges to use the MS-Windows - start program, which will cause to be run whatever command the + The command to invoke a dvi-previewer. [Under MS-Windows the + default is "start"; then latexmk arranges to use the MS-Windows + start program, which will cause to be run whatever command the system has associated with .dvi files.] - Important note: Normally you will want to have a previewer run + Important note: Normally you will want to have a previewer run detached, so that latexmk doesn't wait for the previewer to ter- - minate before continuing its work. So normally you should pre- - fix the command by "start ", which flags to latexmk that it - should do the detaching of the previewer itself (by whatever - method is appropriate to the operating system). But sometimes + minate before continuing its work. So normally you should pre- + fix the command by "start ", which flags to latexmk that it + should do the detaching of the previewer itself (by whatever + method is appropriate to the operating system). But sometimes letting latexmk do the detaching is not appropriate (for a vari- - ety of non-trivial reasons), so you should put the "start " bit + ety of non-trivial reasons), so you should put the "start " bit in yourself, whenever it is needed. $dvi_previewer_landscape ["start xdvi %O %S"] The command to invoke a dvi-previewer in landscape mode. [Under - MS-Windows the default is "start"; then latexmk arranges to use - the MS-Windows start program, which will cause to be run what- + MS-Windows the default is "start"; then latexmk arranges to use + the MS-Windows start program, which will cause to be run what- ever command the system has associated with .dvi files.] $dvipdf ["dvipdf -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 - dvipdfm and dvipdfmx. + 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 - $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- - 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 - file in landscape mode. + 29 May 2021 43 - 16 May 2021 42 +LATEXMK(1) General Commands Manual LATEXMK(1) + dvipdfm and dvipdfmx. -LATEXMK(1) General Commands Manual LATEXMK(1) + $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- + 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 + file in landscape mode. $dvips_pdf_switch ["-P pdf"] - Switch(es) for dvips program when pdf file is to be generated + Switch(es) for dvips program when pdf file is to be generated from .ps file. $dvips_silent_switch ["-q"] Switch(es) for dvips program when silent mode is on. $dvi_update_command [""] - When the dvi previewer is set to be updated by running a com- - mand, this is the command that is run. See the information for + When the dvi previewer is set to be updated by running a com- + mand, this is the command that is run. See the information for the variable $dvi_update_method for further information, and see - information on the variable $pdf_update_method for an example + information on the variable $pdf_update_method for an example for the analogous case of a pdf previewer. $dvi_update_method [2 under UNIX, 1 under MS-Windows] - How the dvi viewer updates its display when the dvi file has - changed. The values here apply equally to the $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 + $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 [0] + Whether to emulate the use of aux_dir when $aux_dir and $out_dir + are different, rather than using the -aux-directory option for + + + + 29 May 2021 44 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + + 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 + emulation on after the first run of *latex, because it will find + the .log file in the wrong place. + + Aux_directory emulation means that when *latex is invoked, the + output directory provided to *latex is set to be the aux_dir. + After that, any files that need to be in the output directory + will be moved there. (These are the files with extensions .dvi, + .ps, .pdf, .fls, .synctex, .synctex.gz.) + + $failure_cmd [undefined] See the documentation for $compiling_cmd. $fdb_ext ["fdb_latexmk"] - The extension of the file which latexmk generates to contain a - database of information on source files. You will not normally + The extension of the file which latexmk generates to contain a + database of information on source files. You will not normally need to change this. - $filetime_causality_threshold [5]; $filetime_offset_report_threshold + $filetime_causality_threshold [5]; $filetime_offset_report_threshold [30]. (Units of seconds.) These variables control how latexmk deals with the following is- - sue, which can affect the use of files that are on a remote + sue, which can affect the use of files that are on a remote filesystem (network share) instead of being on a file system lo- cal to the computer running latexmk. Almost users will not have + to worry about these settings, and can ignore the following ex- + planation. + In almost all situations, latexmk does not need to use the time + stamps of the files it works with. However, there are a couple + of situations when it needs to know whether a certain file was + created in the current run of a program (e.g., *latex) or is a + leftover file from a previous run. It does this by comparing the + modification time of the file with the system time just before + the program was started. If the modification time is earlier + than when the program was started, the file is a leftover file, + which latexmk treats as if it were not created. If the filetime + is at least the program start time, then it can be assumed that + the file was created in the current run. + Unfortunately, this test can fail if the file is on a remote + system, since its system time is not necessarily synchronized + with that of the local system; the timestamps on the remote + files are set by the remote system, not the local system. Gen- + erally, modern operating systems regularly synchronize their + time with a server, so the non-synchronization is mostly small + (a second or so, or a few seconds). But even a small difference + can mess up latexmk's test. - 16 May 2021 43 + 29 May 2021 45 -LATEXMK(1) General Commands Manual LATEXMK(1) - to worry about these settings, and can ignore the following ex- - planation. - In almost all situations, latexmk does not need to use the time - stamps of the files it works with. However, there are a couple - of situations when it needs to know whether a certain file was - created in the current run of a program (e.g., *latex) or is a - leftover file from a previous run. It does this by comparing the - modification time of the file with the system time just before - the program was started. If the modification time is earlier - than when the program was started, the file is a leftover file, - which latexmk treats as if it were not created. If the filetime - is at least the program start time, then it can be assumed that - the file was created in the current run. +LATEXMK(1) General Commands Manual LATEXMK(1) - Unfortunately, this test can fail if the file is on a remote - system, since its system time is not necessarily synchronized - with that of the local system; the timestamps on the remote - files are set by the remote system, not the local system. Gen- - erally, modern operating systems regularly synchronize their - time with a server, so the non-synchronization is mostly small - (a second or so, or a few seconds). But even a small difference - can mess up latexmk's test. Latexmk measures the time difference between the time on the two - systems and compensates for this. But the measurement (in a + systems and compensates for this. But the measurement (in a system-independent way) is only accurate to a second or two. So - latexmk allows for a threshold on the difference between file - and system time before it concludes that a file is a leftover - file from a previous run. The configuration variable $file- - time_causality_theshhold, which in units of seconds, specifies + latexmk allows for a threshold on the difference between file + and system time before it concludes that a file is a leftover + file from a previous run. The configuration variable $file- + time_causality_theshhold, which in units of seconds, specifies this threshold. Luckily high precision is not needed. The pre- - vious run is normally the previous run in a human run-edit-run - cycle, and is at least many seconds back. A few seconds is - therefore appropriate for the threshold, $filetime_causal- - ity_theshhold; it should be non-negative always, and should be + vious run is normally the previous run in a human run-edit-run + cycle, and is at least many seconds back. A few seconds is + therefore appropriate for the threshold, $filetime_causal- + ity_theshhold; it should be non-negative always, and should be bigger than 2 if a remote filesystem or network share is used. - If the difference in system times on the two systems is large, - it normally indicates that at least one of the systems is mis- - configured. The variable $filetime_offset_report_threshold - specifies the smallest size of the difference (or offset) in - seconds between the times of the local and remote system beyond - which the offset is reported. This is reported at the point in - the latexmk's progress that it measures the offset. The report + If the difference in system times on the two systems is large, + it normally indicates that at least one of the systems is mis- + configured. The variable $filetime_offset_report_threshold + specifies the smallest size of the difference (or offset) in + seconds between the times of the local and remote system beyond + which the offset is reported. This is reported at the point in + the latexmk's progress that it measures the offset. The report is made if silent mode is used and diagnostic mode is not on. $force_mode [0] - If nonzero, continue processing past minor latex errors includ- + If nonzero, continue processing past minor latex errors includ- ing unrecognized cross references. Equivalent to specifying the -f option. + @generated_exts [( aux , bbl , idx , ind , lof , lot , out , toc , + $fdb_ext )] + This contains a list of extensions for files that are generated + during a LaTeX run and that are read in by LaTeX in later runs, + either directly or indirectly. + This list specifies files known to be generated by *latex. It + is used in two ways: (a) The specified files are deleted in a + cleanup operation (with the -c, -C, -CA, -g and -gg options), + and (b) It affects the determination of whether a rerun of *la- + tex is needed after a run that gives an error. + (Concerning item (b): Normally, a change of a source file during + a run should provoke a rerun. This includes a file generated by + LaTeX, e.g., an aux file, that is read in on subsequent runs. + But after a run that results in an error, a new run should not + occur until the user has made a change in the files. But the + user may have corrected an error in a source .tex file during + the run. So latexmk needs to distinguish user-generated and au- + tomatically generated files; it determines the automatically + generated files as those with extensions in the list in @gener- + ated_exts.) - - 16 May 2021 44 + 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 + 29 May 2021 46 -LATEXMK(1) General Commands Manual LATEXMK(1) - @generated_exts [( aux , bbl , idx , ind , lof , lot , out , toc , - $fdb_ext )] - This contains a list of extensions for files that are generated - during a LaTeX run and that are read in by LaTeX in later runs, - either directly or indirectly. - This list specifies files known to be generated by *latex. It - is used in two ways: (a) The specified files are deleted in a - cleanup operation (with the -c, -C, -CA, -g and -gg options), - and (b) It affects the determination of whether a rerun of *la- - tex is needed after a run that gives an error. +LATEXMK(1) General Commands Manual LATEXMK(1) - (Concerning item (b): Normally, a change of a source file during - a run should provoke a rerun. This includes a file generated by - LaTeX, e.g., an aux file, that is read in on subsequent runs. - But after a run that results in an error, a new run should not - occur until the user has made a change in the files. But the - user may have corrected an error in a source .tex file during - the run. So latexmk needs to distinguish user-generated and au- - tomatically generated files; it determines the automatically - generated files as those with extensions in the list in @gener- - ated_exts.) - A convenient way to add an extra extension to the list, without - losing the already defined ones is to use a push command in the 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. %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 + 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. You can instruct latex to ignore the offending line as follows: + $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 + period. The value, on the right-hand side, is a string contain- + ing a regular expresssion. (See documentation on Perl for how + they are to be specified in general.) This particular regular + expression specifies that lines beginning with "%%CreationDate: + " are to be ignored in deciding whether a file of the given 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" + in the jargon of regular expressions). For example, - 16 May 2021 45 + $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate: |^%%Ti- + tle: '; + causes lines starting with either "^%%CreationDate: " or "^%%Ti- + tle: " to be ignored. -LATEXMK(1) General Commands Manual LATEXMK(1) + 29 May 2021 47 - $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 - period. The value, on the right-hand side, is a string contain- - ing a regular expresssion. (See documentation on Perl for how - they are to be specified in general.) This particular regular - expression specifies that lines beginning with "%%CreationDate: - " are to be ignored in deciding whether a file of the given 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" - in the jargon of regular expressions). For example, - $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate: |^%%Ti- - tle: '; +LATEXMK(1) General Commands Manual LATEXMK(1) - 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'}; @@ -3009,128 +3116,129 @@ 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 + 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.) - - - - 16 May 2021 46 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - 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- + + + + 29 May 2021 48 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + + is all that is guaranteed to work. Note that for other com- mands, "%S" is substituted by a single source file. In contrast, for $kpsewhich, "%S" may be substituted by a long list of space- - separated filenames, each of which is quoted. The result on + separated filenames, each of which is quoted. The result on STDOUT of running the command is then piped to latexmk.) - See also the @BIBINPUTS variable for another way that latexmk + See also the @BIBINPUTS variable for another way that latexmk also uses to try to locate files; it applies only in the case of .bib files. $kpsewhich_show [0] - Whether to show diagnostics about invocations of kpsewhich: the - command line use to invoke it and the results. These diagnos- - tics are shown if $kpsewhich_show is non-zero or if diagnostics - mode is on. (But in the second case, lots of other diagnostics - are also shown.) Without these diagnostics there is nothing - visible in latexmk's screen output about invocations of kpse- + Whether to show diagnostics about invocations of kpsewhich: the + command line use to invoke it and the results. These diagnos- + tics are shown if $kpsewhich_show is non-zero or if diagnostics + mode is on. (But in the second case, lots of other diagnostics + are also shown.) Without these diagnostics there is nothing + visible in latexmk's screen output about invocations of kpse- which. $landscape_mode [0] If nonzero, run in landscape mode, using the landscape mode pre- - viewers and dvi to postscript converters. Equivalent to the -l + viewers and dvi to postscript converters. Equivalent to the -l option. Normally not needed with current previewers. $latex ["latex %O %S"] - 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 $latex, $pdflatex, $luala- + tex, and $xelatex, see the section "Advanced Configuration". - 16 May 2021 47 + %latex_input_extensions + This variable specifies the extensions tried by latexmk when it + finds that a LaTeX run resulted in an error that a file has not + been found, and the file is given without an extension. This + typically happens when LaTeX commands of the form \input{file} + or \includegraphics{figure}, when the relevant source file does + not exist. + In this situation, latexmk searches for custom dependencies to + make the missing file(s), but restricts it to the extensions + specified by the variable %latex_input_extensions. The default + extensions are 'tex' and 'eps'. + (For Perl experts: %latex_input_extensions is a hash whose keys + are the extensions. The values are irrelevant.) Two 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 -LATEXMK(1) General Commands Manual LATEXMK(1) + 29 May 2021 49 - $latex = "latex --src-specials %O %S"; - To do a coordinated setting of all of $latex, $pdflatex, $luala- - tex, and $xelatex, see the section "Advanced 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 - not exist. - In this situation, latexmk searches for custom dependencies to - make the missing file(s), but restricts it to the extensions - specified by the variable %latex_input_extensions. The default - extensions are 'tex' and 'eps'. +LATEXMK(1) General Commands Manual LATEXMK(1) - (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: + + possible lines in an initialization file: remove_input_ext( 'latex', 'tex' ); @@ -3138,19 +3246,19 @@ LATEXMK(1) General Commands Manual LATEXMK(1) add_input_ext( 'latex', 'asdf' ); - add the extension 'asdf to latex_input_extensions. (Naturally + add the extension 'asdf to latex_input_extensions. (Naturally with such an extension, you should have made an appropriate cus- tom dependency for latexmk, and should also have done the appro- - priate programming in the LaTeX source file to enable the file - to be read. The standard extensions are handled by LaTeX and + priate programming in the LaTeX source file to enable the file + to be read. The standard extensions are handled by LaTeX and its graphics/graphicx packages.) $latex_silent_switch ["-interaction=batchmode"] - Switch(es) for the LaTeX processing program when silent mode is + Switch(es) for the LaTeX processing program when silent mode is on. - If you use MikTeX, you may prefer the results if you configure - the options to include -c-style-errors, e.g., by the following + If you use MikTeX, you may prefer the results if you configure + the options to include -c-style-errors, e.g., by the following line in an initialization file $latex_silent_switch = "-interaction=batchmode -c-style-er- @@ -3160,31 +3268,19 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $lpr ["lpr %O %S" under UNIX/Linux, "NONE lpr" under MS-Windows] The command to print postscript files. - - - - 16 May 2021 48 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - Under MS-Windows (unlike UNIX/Linux), there is no standard pro- + Under MS-Windows (unlike UNIX/Linux), there is no standard pro- gram for printing files. But there are ways you can do it. For example, if you have gsview installed, you could use it with the option "/p": $lpr = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p'; - If gsview is installed in a different directory, you will need - to make the appropriate change. Note the combination of single - and double quotes around the name. The single quotes specify - that this is a string to be assigned to the configuration vari- - able $lpr. The double quotes are part of the string passed to - the operating system to get the command obeyed; this is neces- + If gsview is installed in a different directory, you will need + to make the appropriate change. Note the combination of single + and double quotes around the name. The single quotes specify + that this is a string to be assigned to the configuration vari- + able $lpr. The double quotes are part of the string passed to + the operating system to get the command obeyed; this is neces- sary because one part of the command name ("Program Files") con- tains a space which would otherwise be misinterpreted. @@ -3194,20 +3290,31 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $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., + + + 29 May 2021 50 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + $lpr = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p'; - If gsview is installed in a different directory, you will need - to make the appropriate change. Note the double quotes around + If gsview is installed in a different directory, you will need + to make the appropriate change. Note the double quotes around the name: this is necessary because one part of the command name ("Program Files") contains a space which would otherwise be mis- interpreted. $lualatex ["lualatex %O %S"] Specifies the command line for the LaTeX processing program that - is to be used when the lualatex program is called for (e.g., by + 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 $latex, $pdflatex, $luala- @@ -3215,37 +3322,26 @@ LATEXMK(1) General Commands Manual LATEXMK(1) %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'. - - - 16 May 2021 49 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - See details of the %latex_input_extensions for other information that equally applies to %lualatex_input_extensions. $lualatex_silent_switch ["-interaction=batchmode"] - Switch(es) for the lualatex program (specified in the variable + Switch(es) for the lualatex program (specified in the variable $lualatex) when silent mode is on. - See details of the $latex_silent_switch for other information + See details of the $latex_silent_switch for other information that equally applies to $lualatex_silent_switch. $make ["make"] @@ -3255,133 +3351,134 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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. + + + + + 29 May 2021 51 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + $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- + 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.) $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 - variable, when a command is executed under MS-Windows, latexmk - substitutes "\" for the separator character between components - of a directory name. Internally, latexmk uses "/" for the di- - rectory separator character, which is the character used by + This configuration variable only has an effect when latexmk is + running under MS-Windows. With the default value of 1 for this + variable, when a command is executed under MS-Windows, latexmk + substitutes "\" for the separator character between components + of a directory name. Internally, latexmk uses "/" for the di- + rectory separator character, which is the character used by Unix-like systems. - For almost all programs and for almost all filenames under MS- - Windows, both "\" and "/" are acceptable as the directory sepa- - rator character, provided at least that filenames are properly + For almost all programs and for almost all filenames under MS- + Windows, both "\" and "/" are acceptable as the directory sepa- + rator character, provided at least that filenames are properly quoted. But it is possible that programs exist that only accept - "\" on the command line, since that is the standard directory - separator for MS-Windows. So for safety latexmk makes the sub- + "\" on the command line, since that is the standard directory + separator for MS-Windows. So for safety latexmk makes the sub- stitution from "/" to "\", by default. - However there are also programs on MS-Windows for which a back + However there are also programs on MS-Windows for which a back + slash "\" is interpreted differently than as a directory separa- + tor; for these the directory separator should be "/". Programs + with this behavior include all the *latex programs in the + TeXLive implementation (but not the MiKTeX implementation). + Hence if you use TeXLive on MS-Windows, then $MSWin_back_slash + should be set to zero. + $new_viewer_always [0] + This variable applies to latexmk only in continuous-preview + mode. If $new_viewer_always is 0, latexmk will check for a pre- + viously running previewer on the same file, and if one is run- + ning will not start a new one. If $new_viewer_always is non- + zero, this check will be skipped, and latexmk will behave as if + no viewer is running. - 16 May 2021 50 + $out_dir [""] + If non-blank, this variable specifies the directory in which + output files are to be written by a run of *latex. See also the + variable $aux_dir. + The effect of this variable (when non-blank) is achieved by us- + ing the -output-directory option of *latex. This exists in the + 29 May 2021 52 -LATEXMK(1) General Commands Manual LATEXMK(1) - slash "\" is interpreted differently than as a directory separa- - tor; for these the directory separator should be "/". Programs - with this behavior include all the *latex programs in the - TeXLive implementation (but not the MiKTeX implementation). - Hence if you use TeXLive on MS-Windows, then $MSWin_back_slash - should be set to zero. - $new_viewer_always [0] - This variable applies to latexmk only in continuous-preview - mode. If $new_viewer_always is 0, latexmk will check for a pre- - viously running previewer on the same file, and if one is run- - ning will not start a new one. If $new_viewer_always is non- - zero, this check will be skipped, and latexmk will behave as if - no viewer is running. +LATEXMK(1) General Commands Manual LATEXMK(1) - $out_dir [""] - If non-blank, this variable specifies the directory in which - output files are to be written by a run of *latex. See also the - variable $aux_dir. - The effect of this variable (when non-blank) is achieved by us- - ing the -output-directory option of *latex. This exists in the - usual current (Dec. 2011 and later) implementations of TeX, - i.e., MiKTeX and TeXLive. But it may not be present in other + usual current (Dec. 2011 and later) implementations of TeX, + i.e., MiKTeX and TeXLive. But it may not be present in other versions. - If you also use the -cd option, and $out_dir (or $aux_dir) con- - tains a relative path, then the path is interpreted relative to + If you also use the -cd option, and $out_dir (or $aux_dir) con- + tains a relative path, then the path is interpreted relative to the document directory. - Commonly, the directory specified for output files is a subdi- + Commonly, the directory specified for output files is a subdi- rectory of the current working directory. However, if you spec- - ify some other directory, e.g., "/tmp/foo" or "../output", be - aware that this could cause problems, e.g., with makeindex or - bibtex. This is because modern versions of these programs, by - default, will refuse to work when they find that they are asked - to write to a file in a directory that appears not to be the + ify some other directory, e.g., "/tmp/foo" or "../output", be + aware that this could cause problems, e.g., with makeindex or + bibtex. This is because modern versions of these programs, by + default, will refuse to work when they find that they are asked + to write to a file in a directory that appears not to be the current working directory or one of its subdirectories. This is - part of security measures by the whole TeX system that try to + part of security measures by the whole TeX system that try to prevent malicious or errant TeX documents from incorrectly mess- ing with a user's files. If for $out_dir or $aux_dir you really - do need to specify an absolute pathname (e.g., "/tmp/foo") or a + do need to specify an absolute pathname (e.g., "/tmp/foo") or a path (e.g., "../output") that includes a higher-level directory, - and you need to use makeindex or bibtex, then you need to dis- - able the security measures (and assume any risks). One way of + and you need to use makeindex or bibtex, then you need to dis- + able the security measures (and assume any risks). One way of doing this is to temporarily set an operating system environment - variable openout_any to "a" (as in "all"), to override the de- + variable openout_any to "a" (as in "all"), to override the de- fault "paranoid" setting. $pdf_mode [0] - If zero, do NOT generate a pdf version of the document. If - equal to 1, generate a pdf version of the document using pdfla- - tex, using the command specified by the $pdflatex variable. If - - - - 16 May 2021 51 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - 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- + 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. - In $pdf_mode=2, it is ensured that .dvi and .ps files are also - made. In $pdf_mode=3, it is ensured that a .dvi file is also + In $pdf_mode=2, it is ensured that .dvi and .ps files are also + made. In $pdf_mode=3, it is ensured that a .dvi file is also made. But this may be overridden by the document. $pdflatex ["pdflatex %O %S"] @@ -3393,92 +3490,105 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $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 + + + + 29 May 2021 53 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + + (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 $latex, $pdflatex, $luala- tex, and $xelatex, see the section "Advanced 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 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.] - 16 May 2021 52 + 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 -LATEXMK(1) General Commands Manual LATEXMK(1) + 29 May 2021 54 - $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 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. +LATEXMK(1) General Commands Manual LATEXMK(1) + - 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 @@ -3491,58 +3601,59 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $pdf_update_method = 4; $pdf_update_command = "xpdf -remote %R -reload"; + The first setting arranges for the xpdf program to be used in + its "remote server mode", with the server name specified as the + rootname of the TeX file. The second setting arranges for up- + dating to be done in response to a command, and the third set- + ting sets the update command. + $pdf_update_signal [Under UNIX: SIGHUP, which is a system-dependent + value] + The number of the signal that is sent to the pdf viewer when it + is updated by sending a signal -- see the information on the + variable $pdf_update_method. The default value is the one ap- + propriate for gv on a UNIX system. - 16 May 2021 53 + $pid_position[1 under UNIX, -1 under MS-Windows] + The variable $pid_position is used to specify which word in + lines of the output from $pscmd corresponds to the process ID. + The first word in the line is numbered 0. The default value of + 1 (2nd word in line) is correct for Solaris 2.6, Linux, and OS-X + with their default settings of $pscmd. + Setting the variable to -1 is used to indicate that $pscmd is + 29 May 2021 55 -LATEXMK(1) General Commands Manual LATEXMK(1) - 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. - $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 - 1 (2nd word in line) is correct for Solaris 2.6, Linux, and OS-X - with their default settings of $pscmd. +LATEXMK(1) General Commands Manual LATEXMK(1) + - 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 $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; @@ -3551,53 +3662,53 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $preview_continuous_mode [0] - If nonzero, run a previewer to view the document, and continue + If nonzero, run a previewer to view the document, and continue running latexmk to keep .dvi up-to-date. Equivalent to the -pvc - option. Which previewer is run depends on the other settings, + option. Which previewer is run depends on the other settings, see the command line options -view=, and the variable $view. - - - - 16 May 2021 54 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - $preview_mode [0] If nonzero, run a previewer to preview the document. Equivalent - to the -pv option. Which previewer is run depends on the other - settings, see the command line options -view=, and the variable + to the -pv option. Which previewer is run depends on the other + settings, see the command line options -view=, and the variable $view. $printout_mode [0] - If nonzero, print the document using the command specified in + 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 + 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 + + + + 29 May 2021 56 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + 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. @@ -3606,75 +3717,74 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $ps_filter [empty] The postscript file filter to be run on the newly produced post- - script file before other processing. Equivalent to specifying + script file before other processing. Equivalent to specifying the -pF option. $ps_previewer ["start gv %O %S", but start %O %S under MS-Windows] - The command to invoke a ps-previewer. (The default under MS- + 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. - 16 May 2021 55 + $ps_previewer_landscape ["start gv -swap %O %S", but start %O %S under + MS-Windows] + The command to invoke a ps-previewer in landscape mode. + $ps_update_command [""] + When the postscript previewer is set to be updated by running a + command, this is the command that is run. See the information + for the variable $ps_update_method. -LATEXMK(1) General Commands Manual LATEXMK(1) + 29 May 2021 57 - 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. - $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. +LATEXMK(1) General Commands Manual LATEXMK(1) - $ps_update_command [""] - When the postscript previewer is set to be updated by running a - command, this is the command that is run. See the information - for the variable $ps_update_method. $ps_update_method [0 under UNIX, 1 under MS-Windows] - How the postscript viewer updates its display when the .ps file - has changed. See the information on the variable $dvi_up- - date_method for the codes. (Note that information needs be + How the postscript viewer updates its display when the .ps file + has changed. See the information on the variable $dvi_up- + date_method for the codes. (Note that information needs be changed slightly so that for the value 4, to run a command to do - the update, the command is specified by the variable $ps_up- - date_command, and for the value 2, to specify update by signal, + the update, the command is specified by the variable $ps_up- + date_command, and for the value 2, to specify update by signal, the signal is specified by $ps_update_signal.) - $ps_update_signal [Under UNIX: SIGHUP, which is a system-dependent + $ps_update_signal [Under UNIX: SIGHUP, which is a system-dependent value] - The number of the signal that is sent to the pdf viewer when it - is updated by sending a signal -- see $ps_update_method. The + The number of the signal that is sent to the pdf viewer when it + is updated by sending a signal -- see $ps_update_method. The default value is the one appropriate for gv on a UNIX system. $pvc_timeout [0] - If this variable is nonzero, there will be a timeout in pvc - mode after a period of inactivity. Inactivity means a period - when latexmk has detected no file changes and hence has not + If this variable is nonzero, there will be a timeout in pvc + mode after a period of inactivity. Inactivity means a period + when latexmk has detected no file changes and hence has not taken any actions like compiling the document. The period of in- activity is in the variable $pvc_timeout_mins. @@ -3687,38 +3797,41 @@ LATEXMK(1) General Commands Manual LATEXMK(1) The same as $always_view_file_via_temporary, except that it only applies in preview-continuous mode (-pvc option). + $quote_filenames [1] + This specifies whether substitutions for placeholders in command + specifications (as in $pdflatex) are surrounded by double + quotes. If this variable is 1 (or any other value Perl regards + as true), then quoting is done. Otherwise quoting is omitted. + The quoting method used by latexmk is tested to work correctly + under UNIX systems (including Linux and Mac OS-X) and under MS- + Windows. It allows the use of filenames containing special + characters, notably spaces. (But note that many versions of + *latex 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. + $recorder [1] + Whether to use the -recorder option to (latex Use of this option + results in a file of extension .fls containing a list of the + files that these programs have read and written. Latexmk will - 16 May 2021 56 + 29 May 2021 58 -LATEXMK(1) General Commands Manual LATEXMK(1) - $quote_filenames [1] - This specifies whether substitutions for placeholders in command - specifications (as in $pdflatex) are surrounded by double - quotes. If this variable is 1 (or any other value Perl regards - as true), then quoting is done. Otherwise quoting is omitted. +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.) - $recorder [1] - Whether to use the -recorder option to (latex Use of this option - results in a file of extension .fls containing a list of the - files that these programs have read and written. Latexmk will then use this file to improve its detection of source files and generated files after a run of *latex. @@ -3753,20 +3866,8 @@ LATEXMK(1) General Commands Manual LATEXMK(1) operating systems (including Linux and OS-X) is ':'. Normally the defaults give correct behavior. But there can be difficul- ties if your operating system is of one kind, but some of your - software is running under an emulator for the other kind of - - - - 16 May 2021 57 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - operating system; in that case you'll need to find out what is + 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.) @@ -3786,6 +3887,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) lence_logfile_warning_list and -silence_logfile_warning_list- also set this variable. + + + 29 May 2021 59 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + Note that multiple occurrences for the same undefined object on the same page and same line will be compressed to a single warn- ing. @@ -3819,21 +3931,9 @@ LATEXMK(1) General Commands Manual LATEXMK(1) Directory to store temporary files that latexmk may generate while running. - The default under MSWindows (including cygwin), is to set - - - - 16 May 2021 58 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - $tmpdir to the value of the first of whichever of the system en- - vironment variables TMPDIR or TEMP exists, otherwise to the cur- + 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 @@ -3853,6 +3953,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) do this. The intent of calling make from latexmk is merely to detect dependencies. + + + 29 May 2021 60 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + $view ["default"] Which kind of file is to be previewed if a previewer is used. The possible values are "default", "dvi", "ps", "pdf". The @@ -3886,18 +3997,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 - - - - 16 May 2021 59 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - 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. @@ -3919,6 +4018,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) The program to make a pdf file from an xdv file (used in con- junction with xelatex when $pdf_mode=5). + + + + 29 May 2021 61 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + $xdvipdfmx_silent_switch ["-q"] Switch(es) for the xdvipdfmx program when silent mode is on. @@ -3951,20 +4062,8 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 - - - - 16 May 2021 60 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - default extensions are 'tex', 'pdf', 'jpg, and 'png'. + 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. @@ -3986,6 +4085,17 @@ CUSTOM DEPENDENCIES in the .tex file. + + + 29 May 2021 62 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + 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 @@ -4017,19 +4127,7 @@ CUSTOM DEPENDENCIES Generally, the appropriate value of must is zero. function: - The name of the subroutine that latexmk should call to perform - - - - 16 May 2021 61 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - + 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- @@ -4052,6 +4150,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 + + + + 29 May 2021 63 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + 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 @@ -4084,18 +4194,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) tom dependency can be used to make the missing file. - - - - 16 May 2021 62 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - Function to implement custom dependency, traditional method: 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 @@ -4118,6 +4216,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) initialization file), the latexmk will delete this rule before making the new one. + + + + 29 May 2021 64 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + 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 @@ -4150,18 +4260,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 - - - - 16 May 2021 63 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - 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. @@ -4183,6 +4281,19 @@ LATEXMK(1) General Commands Manual LATEXMK(1) need it. + + + + + 29 May 2021 65 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + 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 @@ -4216,18 +4327,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 - - - - 16 May 2021 64 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - heading "Variables and subroutines for processing a rule". Examples of their use is given in the following examples, concerning @@ -4250,6 +4349,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) } push @generated_exts, 'ndx', 'nnd'; + + + 29 May 2021 66 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + 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 @@ -4282,18 +4392,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) Similar techniques can be applied for glossaries. - - - - 16 May 2021 65 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - 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 the .nnd last read in. Thus the .nnd appears to be perpetually out-of- @@ -4317,6 +4415,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) item, and the name of the subroutine for the custom dependency. These were all defined above. + + + 29 May 2021 67 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + An example of the old method of defining custom dependencies is as fol- lows. It is the code in an RC file to ensure automatic conversion of .fig files to .eps files: @@ -4347,19 +4456,6 @@ ADVANCED CONFIGURATION: Some extra resources and advanced tricks Utility subroutines - - - - - 16 May 2021 66 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - ensure_path( var, values ...) The first parameter is the name of one of the system's environ- @@ -4385,6 +4481,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) invoked programs. + + + 29 May 2021 68 + + + + + +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 @@ -4413,19 +4520,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) This gives the name of the main output file if any. Note the double dollar signs. - - - - - 16 May 2021 67 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - rdb_ensure_file( $rule, file ) This a subroutine that ensures that the given file is among the source files for the specified rule. It is typically used when, @@ -4452,6 +4546,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) rdb_set_source( $rule, file, ... ) + + + + 29 May 2021 69 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + rdb_set_source( $rule, @files ) This subroutine sets the dependency list for the given rule to be the specified files. Files that are already in the list have @@ -4480,18 +4586,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) &std_tex_cmds; - - - - 16 May 2021 68 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - This results in $latex = 'latex %O %S', and similarly for $pdflatex, $lualatex, and $xelatex. Note the ampersand in the invocation; this indicates to Perl that a subroutine is being called. @@ -4518,6 +4612,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) Now the basic task of latexmk is to run the appropriate programs to make a viewable version of a LaTeX document. However, the usual make + + + + 29 May 2021 70 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + program is not suited to this purpose for at least two reasons. First is that the use of LaTeX involves circular dependencies (e.g., via .aux files), and these cannot be handled by the standard make program. Sec- @@ -4546,18 +4652,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) current versions of GNU make, which is the default on both linux and OS-X systems. They may need modifications for other versions of make. - - - - 16 May 2021 69 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - The simplest method is simply to delegate all the relevant tasks to la- texmk, as is suitable for a straightforward LaTeX document. For this a suitable Makefile is like @@ -4583,13 +4677,25 @@ LATEXMK(1) General Commands Manual LATEXMK(1) try.tex, but these aren't specified in the Makefile, so changes in them will not by themselves cause latexmk to be invoked. Instead, the pat- tern rule is equipped with a "phony" prerequisite FORCE_MAKE; this has - the effect of causing the rule to be always out-of-date, so that la- - texmk is always run. It is latexmk that decides whether any action is - needed, e.g., a rerun of pdflatex. Effectively the Makefile delegates - all decisions to latexmk, while make has no knowledge of the list of - source files except for primary LaTeX file for the document. If there - are, for example, graphics files to be made, these must be made by cus- - tom dependencies configured in latexmk. + the effect of causing the rule to be always out-of-date, so that + + + + 29 May 2021 71 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + + latexmk is always run. It is latexmk that decides whether any action + is needed, e.g., a rerun of pdflatex. Effectively the Makefile dele- + gates all decisions to latexmk, while make has no knowledge of the list + of source files except for primary LaTeX file for the document. If + there are, for example, graphics files to be made, these must be made + by custom dependencies configured in latexmk. But something better is needed in more complicated situations, for ex- ample, when the making of graphics files needs to be specified by rules @@ -4612,18 +4718,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) %.pdf : %.fig fig2dev -Lpdf $< $@ - - - - 16 May 2021 70 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - (Again, the lines containing the commands for the rules should be started with tabs.) This example was inspired by how GNU automake han- dles automatic dependency tracking of C source files. @@ -4650,6 +4744,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) and an xfig file "graph.fig" exists. On a first run, pdflatex reports a missing file, named "graph". Latexmk succeeds in making "graph.pdf" by calling "make graph.pdf", and after completion of its work, it lists + + + + 29 May 2021 72 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + "fig.pdf" among the dependents of the file latexmk is making. Then let "fig.fig" be updated, and then let make be run. Make first remakes "fig.pdf", and only then reruns latexmk. @@ -4679,17 +4785,6 @@ BUGS pdf file cannot be updated. (Remedy: configure latexmk to use suma- trapdf instead.) - - - 16 May 2021 71 - - - - - -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 @@ -4698,7 +4793,7 @@ THANKS TO dard form to avoid being harvested too easily.) AUTHOR - Current version, by John Collins (Version 4.74). Report bugs etc to + Current version, by John Collins (Version 4.74b). Report bugs etc to his e-mail (jcc8 at psu.edu). Released version can be obtained from CTAN: @@ -4718,6 +4813,43 @@ AUTHOR + 29 May 2021 73 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -4747,6 +4879,6 @@ AUTHOR - 16 May 2021 72 + 29 May 2021 74 -- cgit v1.2.3