From fe04272d88809e433f8d08435e0f4ea7b89b5fd3 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Fri, 16 Apr 2021 20:15:34 +0000 Subject: latexmk (16apr21) git-svn-id: svn://tug.org/texlive/trunk@58886 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/support/latexmk/CHANGES | 13 +- Master/texmf-dist/doc/support/latexmk/INSTALL | 2 +- Master/texmf-dist/doc/support/latexmk/README | 21 +- .../latexmk/example_rcfiles/chapterbib-latexmkrc | 21 +- .../latexmk/example_rcfiles/hyperxmp-latexmkrc | 200 ++ Master/texmf-dist/doc/support/latexmk/latexmk.pdf | Bin 192210 -> 193203 bytes Master/texmf-dist/doc/support/latexmk/latexmk.txt | 2170 ++++++++++---------- 7 files changed, 1357 insertions(+), 1070 deletions(-) create mode 100644 Master/texmf-dist/doc/support/latexmk/example_rcfiles/hyperxmp-latexmkrc (limited to 'Master/texmf-dist/doc/support') diff --git a/Master/texmf-dist/doc/support/latexmk/CHANGES b/Master/texmf-dist/doc/support/latexmk/CHANGES index 018ff33c5c4..57c7877e84f 100644 --- a/Master/texmf-dist/doc/support/latexmk/CHANGES +++ b/Master/texmf-dist/doc/support/latexmk/CHANGES @@ -743,4 +743,15 @@ From v. 4.70a to 4.70b longer causes a bibtex error. Add options -bibfudge, -bibfudge-, -nobibfudge. - +From v. 4.70b to 4.72b + For bibtex, revert to change-directory default when running bibtex. + Add similar procedure for makeindex, but leave old default. + Add options -indexfudge, -indexfudge-, -noindexfudge. + Solve bug that transition from non-existent file to existent file didn't + trigger rerun of *latex. (This concerns file that were flagged as + missing in the .log file. + Give .latexmkrc priority of latexmkrc in finding rc files. + Correct bug when chapterbib used with non-trivial out or aux dir. + Improve handling of situation when auxdir or outdir are specified as + absolute paths. + Miscellaneous bug corrections, especially about consistent normalizations diff --git a/Master/texmf-dist/doc/support/latexmk/INSTALL b/Master/texmf-dist/doc/support/latexmk/INSTALL index 1e1d6d79c2b..1d5dad273aa 100644 --- a/Master/texmf-dist/doc/support/latexmk/INSTALL +++ b/Master/texmf-dist/doc/support/latexmk/INSTALL @@ -1,6 +1,6 @@ INSTALLING latexmk ================== - (Version 4.70b, 29 September 2020) + (Version 4.72b, 15 April 2021) John Collins Physics Department diff --git a/Master/texmf-dist/doc/support/latexmk/README b/Master/texmf-dist/doc/support/latexmk/README index 89124040c5a..7044cc63a32 100644 --- a/Master/texmf-dist/doc/support/latexmk/README +++ b/Master/texmf-dist/doc/support/latexmk/README @@ -1,5 +1,5 @@ -Latexmk, version 4.70b, 29 September 2020 ------------------------------------------ +Latexmk, version 4.72b, 15 April 2021 +------------------------------------- Latexmk completely automates the process of generating a LaTeX document. Essentially, it is a highly specialized cousin of the @@ -87,7 +87,7 @@ NOTES:- John Collins ---------------------------- "latexmk -h" ---------------------------- -Latexmk 4.70b: Automatic LaTeX document generation routine +Latexmk 4.72b: Automatic LaTeX document generation routine Usage: latexmk [latexmk_options] [filename ...] @@ -100,8 +100,8 @@ Usage: latexmk [latexmk_options] [filename ...] -bibtex-cond - use bibtex when needed, but only if the bib file exists -bibtex-cond1 - use bibtex when needed, but only if the bib file exists; on cleanup delete bbl file only if bib file exists - -bibfudge - use change-directory fudge needed for old bibtexs - -bibfudge- - don't use change-directory fudge needed for old bibtexs + -bibfudge or -bibtexfudge - change directory to output directory when running bibtex + -bibfudge- or -bibtexfudge- - don't change directory when running bibtex -bm - Print message across the page when converting to postscript -bi - Set contrast or intensity of banner -bs - Set scale for banner @@ -135,6 +135,8 @@ Usage: latexmk [latexmk_options] [filename ...] -g- - Turn off -g -h - print help -help - print help + -indexfudge or -makeindexfudge - change directory to output directory when running makeindex + -indexfudge- or -makeindexfudge- - don't change directory when running makeindex -jobname=STRING - set basename of output file(s) to STRING. (Like --jobname=STRING on command line for many current implementations of latex/pdflatex.) @@ -152,6 +154,8 @@ Usage: latexmk [latexmk_options] [filename ...] -M - Show list of dependent files after processing -MF file - Specifies name of file to receives list dependent files -MP - List of dependent files includes phony target for each source file. + -makeindexfudge - change directory to output directory when running makeindex + -makeindexfudge-- don't change directory to output directory when running makeindex -MSWinBackSlash under MSWin use backslash (\) for directory separators for filenames given to called programs -MSWinBackSlash- under MSWin use forward slash (/) for directory separators @@ -159,11 +163,16 @@ Usage: latexmk [latexmk_options] [filename ...] -new-viewer - in -pvc mode, always start a new viewer -new-viewer- - in -pvc mode, start a new viewer only if needed -nobibtex - never use bibtex - -nobibfudge - don't use change-directory fudge needed for old bibtexs + -nobibfudge or -nobibtexfudge - don't change directory when running bibtex -nodependents - Do not show list of dependent files after processing + -noindexfudge or -nomakeindexfudge - don't change directory when running makeindex -norc - omit automatic reading of system, user and project rc files -output-directory=dir or -outdir=dir - set name of directory for output files + -output-format=FORMAT + - if FORMAT is dvi, turn on dvi output, turn off others + - if FORMAT is pdf, turn on pdf output, turn off others + - otherwise error -pdf - generate pdf by pdflatex -pdfdvi - generate pdf by dvipdf -pdflatex= - set program used for pdflatex. diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/chapterbib-latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/chapterbib-latexmkrc index 403cbd6ef5f..e5c2cb62501 100644 --- a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/chapterbib-latexmkrc +++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/chapterbib-latexmkrc @@ -15,32 +15,33 @@ $bibtex = 'bibtex %O %S'; $bibtex_save = $bibtex; $bibtex = 'internal bibtex_fix %R %D %S'; -# MUST NOT use bibtex_fudge (i.e., change of directory before running bibtex). -# That's not needed in post-2019 versions of bibtex, and messes up -# things with chapterbib. So turn it off: -$bibtex_fudge = 0; - $clean_ext .= " %R-mod.blg %R-mod.aux %R-mod.bbl"; sub bibtex_fix { my ($root, $dest, $source) = @_; - local ($base_tex, $path, $ext) = fileparse( $source, '\.[^\.]*' ); + local ($base_bare, $path, $ext) = fileparse( $source, '\.[^\.]*' ); + if ($path eq './') { $path = ''; } + local $base = $path.$base_bare; my $ret = 0; - if ( $base_tex eq $root ) { + if ( $base_bare eq $root ) { print "--- Will run bibtex on modified '$root.aux' file\n"; - my $aux_mod_base = $path.$base_tex."-mod"; + my $aux_mod_base = $base."-mod"; local $out_fh = new FileHandle "> $aux_mod_base$ext"; if (!$out_fh) { die "Cannot write to '$aux_mod_base$ext'\n"; } local $level = 0; fix_aux( $source ); close $out_fh; - $ret = Run_subst( $bibtex_save, 2, undef, "$aux_mod_base.aux", undef, $aux_mod_base ); + # Override source, dest, and basenames, since they are to have the path given + # in the arguments to this subroutine, instead of the path given in the + # corresponding names in the rule. Latexmk may change directory before + # calling this subroutine, and adjusts the arguments accordingly: + $ret = Run_subst( $bibtex_save, 2, undef, "$aux_mod_base$ext", "$aux_mod_base.bbl", $aux_mod_base ); foreach ( 'bbl', 'blg' ) { copy "$aux_mod_base.$_", "$path$root.$_"; } } else { - $ret = Run_subst( $bibtex_save ); + $ret = Run_subst( $bibtex_save, 2, undef, $source, $dest, $base ); } return $ret; } diff --git a/Master/texmf-dist/doc/support/latexmk/example_rcfiles/hyperxmp-latexmkrc b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/hyperxmp-latexmkrc new file mode 100644 index 00000000000..e0a80a7f408 --- /dev/null +++ b/Master/texmf-dist/doc/support/latexmk/example_rcfiles/hyperxmp-latexmkrc @@ -0,0 +1,200 @@ +# Configuration of latexmk so that it works with the hyperxmp package. +# Hyperxmp puts document xmp metadata in the pdf file, and one of the +# fields in that metadata is byteCount, which is the size of the pdf file. +# This configuration ensures that the byteCount is present and correctly +# equals the pdf file's size. +# +# Method of operation: +# For any command that might produce a pdf file, prepend "internal mycmd3 " +# to the previously configured command, so that a subroutine mycmd3 is +# called. It runs the expected command and then does post-processing if +# the output file is a pdf file. + +foreach my $cmd ( "latex", "lualatex", "pdflatex", "xelatex", + "dvipdf", "xdvipdfmx", "ps2pdf" ) { + ${$cmd} = "internal mycmd ${$cmd}"; +} + +#====================================================== + +sub mycmd { + # Run command, and do extra processing of output file, if it is a pdf + # file. + # This subroutine is run in a rule context, so that $rule is the name of + # the rule and $$Pdest is the destination file name. + + # Identification string for messages: + local $name = "$My_name.mycmd"; + + my $retval = system @_; + + if ( $$Pdest =~ /\.pdf$/ ) { + fix_pdf( $$Pdest ); + } + return $retval; +} + +#====================================================== + +sub fix_pdf { + # Change/insert byteCount field with correct file length, while preserving + # the file size and the length of the stream containing xmp metadata. + # Return 1 on success, else 0. + + local $pdf_name = shift; + local $tmp_name = "$pdf_name.new.pdf"; + local $pdf_size = (stat($pdf_name))[7]; + warn "Inserting/correcting byteCount field in '$pdf_name' ...\n"; + + # Strings surrounding (and identifying) the byteCount field, and other + # parts of the xmp packet: + local $xmp_start = ''; + local $decl_bC = 'byteCount'; + local $pre_bC = ''; + local $post_bC = ''; + local $pC = ''; + local $rd_end = ''; + local $xmp_end = ''; + + local *PDF; + local *TMP; + + if (! open PDF, "<", $pdf_name ) { + warn " Cannot read '$pdf_name'\n"; + return 0; + } + if ( ! open TMP, ">", $tmp_name ) { + warn " Cannot write temporary file '$tmp_name'\n"; + close PDF; + return 0; + } + local $status = 0; # 0 = no XMP packet, 1 = success, >= errors + while ( ) { + # Only examine first XMP packet: + if ( ($status == 0) && /^\s*\Q$xmp_start\E/ ) { + local @xmp = $_; + local $len_padding = 0; + local $xmp_after_line = ''; + &xmp_get_mod; + print TMP @xmp; + # Insert correct padding to leave file size unchanged: + while ( $len_padding > 0 ) { + my $len_line = 64; + if ( $len_line > $len_padding ) { $len_line = $len_padding; } + $len_padding -= $len_line; + print TMP (' ' x ($len_line - 1) ), "\n"; + } + print TMP $xmp_after_line; + $xmp_after_line = ''; + } + else { + print TMP "$_"; + } + } + close PDF; + close TMP; + + if ($status == 0) { + warn " Could not insert/modify byteCount, since no XMP packet was found.\n"; + warn " So '$pdf_name' is unchanged,\n", + " and I will delete temporary file '$tmp_name'.\n"; + unlink $tmp_name; + } elsif ($status == 1) { + rename $tmp_name, $pdf_name + or die " Cannot move temporary file '$tmp_name' to '$pdf_name'.\n", + " Error is '$!'\n"; + } else { + warn " Could not insert correct byteCount. See above for reason.\n"; + warn " So '$pdf_name' is unchanged,\n", + " and I will delete temporary file '$tmp_name'.\n"; + unlink $tmp_name; + } + return ($status == 1); +} + +#====================================================== + +sub xmp_get_mod { + # Get xmp packet, given that @xmp contains its first line. + # Get amount of trailing padding, and line after that. + # If possible, insert a byteCount field: + # Either replace existing specification, if it exists, + # or insert one in expected place for hyperxmp, if the XMP packet + # matches what hyperxmp would produce. + # Return xmp packet in @xmp, amount of padding needed in $len_padding, + # line after that in $xmp_after_line, and error code in $error. + # Set $status appropriately: 1 for success; >=1 for failure. + + $len_padding = 0; + $xmp_after_line = ''; + + my $bC_index = -1; + my $xmp_end_found = 0; + my $decl_bC_found = 0; + while ( ) { + push @xmp, $_; + if ( /^\s*\Q$xmp_end\E/ ) { + $xmp_end_found = 1; + # Get amount of padding; + while () { + if ( /^\s*$/ ) { + $len_padding += length($_); + } else { + $xmp_after_line = $_; + last; + } + } + last; + } + elsif ( $bC_index >= 0 ){ + next; + } + # Rest of conditions only apply if no place yet found for byteCount + # specification. + elsif ( /^(\s*)\Q$pre_bC\E.*?\Q$post_bC\E\s*$/ ) { + $bC_index = $#xmp; + } + elsif ( /^\s*\Q$decl_bC\E/ ) { + $decl_bC_found = 1; + } + elsif ( /^(\s*)\Q$rd_end\E/ ){ + # End of rdf:Description block. + # So having previous declaration of byteCount is irrelevant. + $decl_bC_found = 0; + } + elsif ( $decl_bC_found && /^(\s*)\Q$pC\E/ ){ + $bC_index = $#xmp; + pop @xmp; + push @xmp, '', $_; + } + + } # End reading of XMP + + if ($bC_index < 0) { + if ( ! $xmp_end_found ) { + warn " End of XMP packet not found.\n"; + $status = 2; + } + elsif ( ! $decl_bC_found ) { + warn " XMP packet not in appropriate hyperxmp-compatible format.\n"; + $status = 3; + } + return; + } + my $new_line = ' ' . $pre_bC . $pdf_size . $post_bC . "\n"; + my $old_line = $xmp[$bC_index]; + my $delta_len = length($new_line) - length($old_line); + if ($delta_len > $len_padding) { + warn " Cannot get padding correct for '$pdf_name'.\n", + " Length change of bC line = $delta_len; ", + " Padding bytes available = $len_padding.\n"; + $status = 4; + return; + } else { + $len_padding -= $delta_len; + $xmp[$bC_index] = $new_line; + $status = 1; + } +} + +#====================================================== diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf index c7bfe298673..f3a8e152c0c 100644 Binary files a/Master/texmf-dist/doc/support/latexmk/latexmk.pdf and b/Master/texmf-dist/doc/support/latexmk/latexmk.pdf differ diff --git a/Master/texmf-dist/doc/support/latexmk/latexmk.txt b/Master/texmf-dist/doc/support/latexmk/latexmk.txt index ee48cdb3d1c..50f7017ecd9 100644 --- a/Master/texmf-dist/doc/support/latexmk/latexmk.txt +++ b/Master/texmf-dist/doc/support/latexmk/latexmk.txt @@ -61,7 +61,7 @@ DESCRIPTION - 29 September 2020 1 + 15 April 2021 1 @@ -127,7 +127,7 @@ LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE - 29 September 2020 2 + 15 April 2021 2 @@ -137,29 +137,21 @@ LATEXMK(1) General Commands Manual LATEXMK(1) a specific one of these normally refers that specific engines. Earlier - versions of this documentation weren't so consistent. + versions of this documentation weren't so consistent. Which of these + is used to compile a document, depends on the configuration and the + command line arguments. Note 2: In addition to the options in the list below, latexmk recog- - nizes almost all the options recognized by the *latex in their current - TeXLive and MiKTeX implementations. Some of the options for these pro- - grams also trigger special action or behavior by latexmk, in which case - they have specific explanations in this document. Otherwise, they are - just passed through to a called *latex program. Run latexmk with the - -showextraoptions to get a list of the options that latexmk accepts and - that are simply passed through to *latex. See also the explanation of - the -showextraoptions option for more information. - - Note 3: In this documentation, the term *latex is often referred to, - which refers to all the supported latex-like programs, whether the - original latex, or the later pdflatex, xelatex, and lualatex. Users - should know that from latexmk's point of view, all of these programs - behave very much alike, with the sole exception that by default latex - produces a dvi file and all the others produce a pdf file. Latexmk can - be easily configured to use whichever of these programs is needed. See - the documentation for the following options: -pdflua, -pdfxe, -luala- - tex, and -xelatex, and also see the documentation for the $latex, - $pdflatex, $lualatex, and $xelatex configuration variables. At present - latexmk does not do automatic detection of which program is to be used. + nizes almost all the options recognized by the *latex programs in their + current TeXLive and MiKTeX implementations. Some of the options for + these programs trigger special action or behavior by latexmk, in which + case they have specific explanations in this document; in this case + they may or may not be passed to *latex as well. + + Run latexmk with the -showextraoptions to get a list of the options + that latexmk accepts and that are simply passed through to *latex. See + also the explanation of the -showextraoptions option for more informa- + tion. Definitions of options and arguments @@ -190,10 +182,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) Latexmk gives a fatal error when it detects any of the above characters in the TeX filename(s) specified on the command line. + However before testing for illegal characters, latexmk removes + matching pairs of double quotes from a filename. This matches + the behavior of latex etc, and deals with problems that occa- + sionally result from filenames that have been incorrectly quoted + on the command line. In addition, under Microsoft Windows, the + forward slash character "\" is a directory separator, so latexmk + replaces it by a backward slash "/", which is also a legal di- + rectory separator in Windows, and is accepted by latex etc. - 29 September 2020 3 + 15 April 2021 3 @@ -202,16 +202,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - However before testing for illegal characters, latexmk removes - matching pairs of double quotes from a filename. This matches - the behavior of latex etc, and deals with problems that occa- - sionally result from filenames that have been incorrectly quoted - on the command line. In addition, under Microsoft Windows, the - forward slash character "\" is a directory separator, so latexmk - replaces it by a backward slash "/", which is also a legal di- - rectory separator in Windows, and is accepted by latex etc. - - -auxdir=FOO or -aux-directory=FOO Sets the directory for auxiliary output files of *latex (.aux, .log etc). This achieves its effect by the -aux-directory op- @@ -256,33 +246,33 @@ LATEXMK(1) General Commands Manual LATEXMK(1) When the source file uses bbl file(s) for the bibliography, run bibtex or biber as needed to regenerate the bbl files, but only if the relevant bib file(s) exist. Thus when the bib files are + not available, bibtex or biber is not run, thereby avoiding + overwriting of the bbl file(s). Also, always treat .bbl files + as precious, i.e., do not delete them in a cleanup operation. + This is the default setting. It can also be configured by set- + ting the $bibtex_use variable to 1 in a configuration file. + The reason for using this setting is that sometimes a .bbl file + is available containing the bibliography for a document, but the + .bib file is not available. An example would be for a - 29 September 2020 4 + 15 April 2021 4 -LATEXMK(1) General Commands Manual LATEXMK(1) - not available, bibtex or biber is not run, thereby avoiding - overwriting of the bbl file(s). Also, always treat .bbl files - as precious, i.e., do not delete them in a cleanup operation. +LATEXMK(1) General Commands Manual LATEXMK(1) - This is the default setting. It can also be configured by set- - ting the $bibtex_use variable to 1 in a configuration file. - The reason for using this setting is that sometimes a .bbl file - is available containing the bibliography for a document, but the - .bib file is not available. An example would be for a scien- - tific journal where authors submit .tex and .bbl files, but not - the original .bib file. In that case, running bibtex or biber - would not work, and the .bbl file should be treated as a user - source file, and not as a file that can be regenerated on de- - mand. + scientific journal where authors submit .tex and .bbl files, but + not the original .bib file. In that case, running bibtex or + biber would not work, and the .bbl file should be treated as a + user source file, and not as a file that can be regenerated on + demand. (Note that it is possible for latexmk to decide that the bib file does not exist, even though the bib file does exist and @@ -312,32 +302,36 @@ LATEXMK(1) General Commands Manual LATEXMK(1) variable to 1.5 in a configuration file. - -bibtexfudge, -bibtexfudge- - Turn on/off the change-directory fudge needed for old versions - (pre-2019) of bibtex. See documentation of $bibtex_fudge for - details. + -bibtexfudge or -bibfudge + Turn on the change-directory fudge for bibtex. See documenta- + tion of $bibtex_fudge for details. + + + -bibtexfudge- or -bibfudge- + Turn off the change-directory fudge for bibtex. See documenta- + tion of $bibtex_fudge for details. -bm A banner message to print diagonally across each page when con- verting the dvi file to postscript. The message must be a sin- - gle argument on the command line so be careful with quoting + gle argument on the command line so be careful with quoting spa- + ces and such. + Note that if the -bm option is specified, the -ps option is as- + sumed. - 29 September 2020 5 + 15 April 2021 5 -LATEXMK(1) General Commands Manual LATEXMK(1) - spaces and such. - Note that if the -bm option is specified, the -ps option is as- - sumed. +LATEXMK(1) General Commands Manual LATEXMK(1) -bi @@ -369,7 +363,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) tion variables are removed. This cleanup is instead of a regular make. See the -gg option - if you want to do a cleanup then a make. + if you want to do a cleanup followed by a make. Treatment of .bbl files: If $bibtex_use is set to 0 or 1, bbl files are always treated as non-regeneratable. If $bibtex_use @@ -389,24 +383,25 @@ LATEXMK(1) General Commands Manual LATEXMK(1) deleted. + -C Clean up (remove) all regeneratable files generated by latex and + bibtex or biber. This is the same as the -c option with the ad- + dition of dvi, postscript and pdf files, and those specified in + the $clean_full_ext configuration variable. - 29 September 2020 6 + 15 April 2021 6 -LATEXMK(1) General Commands Manual LATEXMK(1) - -C Clean up (remove) all regeneratable files generated by latex and - bibtex or biber. This is the same as the -c option with the ad- - dition of dvi, postscript and pdf files, and those specified in - the $clean_full_ext configuration variable. +LATEXMK(1) General Commands Manual LATEXMK(1) + This cleanup is instead of a regular make. See the -gg option - if you want to do a cleanup than a make. + if you want to do a cleanup followed by a make. See the -c option for the specification of whether or not .bbl files are treated as non-regeneratable or regeneratable. @@ -454,10 +449,15 @@ LATEXMK(1) General Commands Manual LATEXMK(1) tion, before doing the other actions requested. + -d Set draft mode. This prints the banner message "DRAFT" across + your page when converting the dvi file to postscript. Size and + intensity can be modified with the -bs and -bi options. The -bm + option will override this option as this is really just a short + way of specifying: - 29 September 2020 7 + 15 April 2021 7 @@ -466,12 +466,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - -d Set draft mode. This prints the banner message "DRAFT" across - your page when converting the dvi file to postscript. Size and - intensity can be modified with the -bs and -bi options. The -bm - option will override this option as this is really just a short - way of specifying: - latexmk -bm DRAFT Note that if the -d option is specified, the -ps option is as- @@ -519,11 +513,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) pendent files after processing. - -dF + -dF Dvi file filtering. The argument to this option is a filter + which will generate a filtered dvi file with the extension + ".dviF". All extra processing (e.g. conversion to postscript, + preview, printing) will then be performed on this filtered dvi + file. + + Example usage: To use dviselect to select only the even pages of - 29 September 2020 8 + 15 April 2021 8 @@ -532,13 +532,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - Dvi file filtering. The argument to this option is a filter - which will generate a filtered dvi file with the extension - ".dviF". All extra processing (e.g. conversion to postscript, - preview, printing) will then be performed on this filtered dvi - file. - - Example usage: To use dviselect to select only the even pages of the dvi file: latexmk -dF "dviselect even" foo.tex @@ -586,24 +579,24 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 September 2020 9 + 15 April 2021 9 -LATEXMK(1) General Commands Manual LATEXMK(1) - string in a way that is independent of both the shell and the - operating-system.) +LATEXMK(1) General Commands Manual LATEXMK(1) - 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 @@ -630,18 +623,19 @@ LATEXMK(1) General Commands Manual LATEXMK(1) had occurred. If instead, or additionally, you want the latex (etc) program not to pause for user input after an error, you should arrange this by an option that is passed to the program, - e.g., by latexmk's option -interaction=nonstopmode. + e.g., by latexmk's option -interaction=nonstopmode (which la- + texmk passes to *latex). -f- Turn off the forced processing-past-errors such as is set by the - -f option. This could be used to override a setting in a con- + -f option. This could be used to override a setting in a con- figuration file. - -g Force latexmk to process document fully, even under situations - where latexmk would normally decide that no changes in the - source files have occurred since the previous run. This option - is useful, for example, if you change some options and wish to + -g Force latexmk to process document fully, even under situations + where latexmk would normally decide that no changes in the + source files have occurred since the previous run. This option + is useful, for example, if you change some options and wish to reprocess the files. @@ -652,36 +646,36 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -C had been given, and then do a regular make. + -h or-non-help + Print help information. + -jobname=STRING + Set the basename of output files(s) to STRING, instead of the - 29 September 2020 10 + 15 April 2021 10 -LATEXMK(1) General Commands Manual LATEXMK(1) - -h, -help - Print help information. +LATEXMK(1) General Commands Manual LATEXMK(1) - -jobname=STRING - Set the basename of output files(s) to STRING, instead of the - default, which is the basename of the specified TeX file. (At + default, which is the basename of the specified TeX file. (At present, STRING should not contain spaces.) - This is like the same option for current implementations of the + This is like the same option for current implementations of the *latex, and the passing of this option to these programs is part of latexmk's implementation of -jobname. There is one enhancement, that the STRING may contain the place- holder '%A'. This will be substituted by the basename of the TeX - file. The primary purpose is when multiple files are specified - on the command line to latexmk, and you wish to use a jobname - with a different file-dependent value for each file. For exam- + file. The primary purpose is when multiple files are specified + on the command line to latexmk, and you wish to use a jobname + with a different file-dependent value for each file. For exam- ple, suppose you had .tex files test1.tex and test2.tex, and you wished to compare the results of compilation by *latex and those with xelatex. Then under a unix-type operating system you could @@ -690,13 +684,13 @@ LATEXMK(1) General Commands Manual LATEXMK(1) latexmk -pdf -jobname=%A-pdflatex *.tex latexmk -pdfxe -jobname=%A-xelatex *.tex - Then the .aux, .log, and .pdf files from the use of pdflatex - would have basenames test1-pdflatex and test2-pdflatex, while + Then the .aux, .log, and .pdf files from the use of pdflatex + would have basenames test1-pdflatex and test2-pdflatex, while from xelatex, the basenames would be test1-xelatex and test2-xe- latex. Under MS-Windows with cmd.exe, you would need to double the per- - cent sign, so that the percent character is passed to latexmk + cent sign, so that the percent character is passed to latexmk rather than being used to substitute an environment variable: latexmk -pdf -jobname=%%A-pdflatex *.tex @@ -704,48 +698,49 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -l Run in landscape mode, using the landscape mode for the preview- - ers and the dvi to postscript converters. This option is not - normally needed nowadays, since current previewers normally de- + ers and the dvi to postscript converters. This option is not + normally needed nowadays, since current previewers normally de- termine this information automatically. -l- Turn off -l. - -latex This sets the generation of dvi files by latex, and turns off + -latex This sets the generation of dvi files by latex, and turns off the generation of pdf and ps files. - Note: to set the command used when latex is specified, see the + Note: to set the command used when latex is specified, see the -latex="COMMAND" option. + -latex="COMMAND" + This sets the string specifying the command to run latex, and is + typically used to add desired options. Since the string nor- + mally contains spaces, it should be quoted, e.g., + - 29 September 2020 11 + 15 April 2021 11 -LATEXMK(1) General Commands Manual LATEXMK(1) +LATEXMK(1) General Commands Manual LATEXMK(1) - -latex="COMMAND" - This sets the string specifying the command to run latex, and is - typically used to add desired options. Since the string nor- - mally contains spaces, it should be quoted, e.g., latexmk -latex="latex --shell-escape %O %S" foo.tex - The specification of the contents of the string are the same as - for the $latex configuration variable. Depending on your oper- - ating system and the command-line shell you are using, you may - need to change the single quotes to double quotes (or something + The specification of the contents of the string are the same as + for the $latex configuration variable. Depending on your oper- + ating system and the command-line shell you are using, you may + need to change the single quotes to double quotes (or something else). - Note: This option when provided with the COMMAND argument only + Note: This option when provided with the COMMAND argument only sets the command for invoking latex; it does not turn on the use - of latex. That is done by other options or in an initialization + of latex. That is done by other options or in an initialization file. To set the command for running pdflatex (rather than the command @@ -753,90 +748,100 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -logfilewarninglist - -logfilewarnings After a run of *latex, give a list of warnings - about undefined citations and references (unless silent mode is + -logfilewarnings After a run of *latex, give a list of warnings + about undefined citations and references (unless silent mode is on). See also the $silence_logfile_warnings configuration variable. -logfilewarninglist- - -logfilewarnings- After a run of *latex, do not give a list of + -logfilewarnings- After a run of *latex, do not give a list of warnings about undefined citations and references. (Default) See also the $silence_logfile_warnings configuration variable. -lualatex - Use lualatex. That is, use lualatex to process the source - file(s) to pdf. The generation of dvi and postscript files is + Use lualatex. That is, use lualatex to process the source + file(s) to pdf. The generation of dvi and postscript files is turned off. This option is equivalent to using the following set of options -pdflua -dvi- -ps- - (Note: Note that the method of implementation of this option, - but not its intended effect, differ from some earlier versions + (Note: Note that the method of implementation of this option, + but not its intended effect, differ from some earlier versions of latexmk.) -lualatex="COMMAND" This sets the string specifying the command to run lualatex. It - behaves like the -pdflatex option, but sets the variable + behaves like the -pdflatex option, but sets the variable $luala- + tex. + Note: This option when provided with the COMMAND argument only + sets the command for invoking lualatex; it does not turn on the + use of lualatex. That is done by other options or in an - 29 September 2020 12 + 15 April 2021 12 -LATEXMK(1) General Commands Manual LATEXMK(1) +LATEXMK(1) General Commands Manual LATEXMK(1) - $lualatex. - 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. + initialization file. - -M Show list of dependent files after processing. This is equiva- + -M Show list of dependent files after processing. This is equiva- lent to the -deps option. -MF file - If a list of dependents is made, the -MF specifies the file to + If a list of dependents is made, the -MF specifies the file to write it to. -MP If a list of dependents is made, include a phony target for each - source file. If you use the dependents list in a Makefile, the + source file. If you use the dependents list in a Makefile, the dummy rules work around errors the program make gives if you re- move header files without updating the Makefile to match. + -makeindexfudge + Turn on the change-directory fudge for makeindex. See documen- + tation of $makeindex_fudge for details. + + + -makeindexfudge- + Turn off the change-directory fudge for makeindex. See documen- + tation of $makeindex_fudge for details. + + -MSWinBackSlash This option only has an effect when latexmk is running under MS- Windows. This is that when latexmk runs a command under MS-Win- - dows, the Windows standard directory separator "\" is used to - separate directory components in a file name. Internally, la- - texmk uses "/" for the directory separator character, which is + dows, the Windows standard directory separator "\" is used to + separate directory components in a file name. Internally, la- + texmk uses "/" for the directory separator character, which is the character used by Unix-like systems. This is the default behavior. However the default may have been - overridden by a configuration file (latexmkrc file) which sets + overridden by a configuration file (latexmkrc file) which sets $MSWin_back_slash=0. -MSWinBackSlash- This option only has an effect when latexmk is running under MS- Windows. This is that when latexmk runs a command under MS-Win- - dows, the substitution of "\" for the separator character be- - tween directory components of a file name is not done. Instead + dows, the substitution of "\" for the separator character be- + tween directory components of a file name is not done. Instead the forward slash "/" is used, the same as on Unix-like systems. This is acceptable in most situations under MS-Windows, provided that filenames are properly quoted, as latexmk does by default. @@ -845,15 +850,10 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $MSWin_back_slash for more details. - -new-viewer - When in continuous-preview mode, always start a new viewer to - view the generated file. By default, latexmk will, in continu- - ous-preview mode, test for a previously running previewer for - the same file and not start a new one if a previous previewer is - 29 September 2020 13 + 15 April 2021 13 @@ -862,14 +862,19 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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- + ous-preview mode, test for a previously running previewer for + the same file and not start a new one if a previous previewer is running. However, its test sometimes fails (notably if there is - an already-running previewer that is viewing a file of the same - name as the current file, but in a different directory). This + an already-running previewer that is viewing a file of the same + name as the current file, but in a different directory). This option turns off the default behavior. -new-viewer- - The inverse of the -new-viewer option. It puts latexmk in its + The inverse of the -new-viewer option. It puts latexmk in its normal behavior that in preview-continuous mode it checks for an already-running previewer. @@ -878,10 +883,9 @@ LATEXMK(1) General Commands Manual LATEXMK(1) Never run bibtex or biber. Equivalent to the -bibtex- option. - -nobibtexfudge - Turn off the change-directory fudge needed for old versions - (pre-2019) of bibtex. See documentation of $bibtex_fudge for - details. + -nobibtexfudge or -nobibfudge + Turn off the change-directory fudge for bibtex. See documenta- + tion of $bibtex_fudge for details. -norc Turn off the automatic reading of initialization (rc) files. @@ -892,41 +896,63 @@ LATEXMK(1) General Commands Manual LATEXMK(1) on first, no matter where it occurs on the command line. + -nomakeindexfudge + Turn off the change-directory fudge for makeindex. See documen- + tation of $makeindex_fudge for details. + + -outdir=FOO or -output-directory=FOO - Sets the directory for the output files of *latex. This - achieves its effect by the -output-directory option of *latex, + Sets the directory for the output files of *latex. This + achieves its effect by the -output-directory option of *latex, which currently (Dec. 2011 and later) is implemented on the com- mon versions of *latex, i.e., MiKTeX and TeXLive. It may not be present in other versions. - See also the -auxdir/-aux-directory options, and the $aux_dir, - $out_dir, and $search_path_separator configuration variables of - latexmk. In particular, see the documentation of $out_dir for + See also the -auxdir/-aux-directory options, and the $aux_dir, + $out_dir, and $search_path_separator configuration variables of + latexmk. In particular, see the documentation of $out_dir for some complications on what directory names are suitable. - If you also use the -cd option, and the specified output direc- - tory is a relative path, then the path is interpreted relative - to the document directory. + If you also use the -cd option, and the specified output direc- + tory is a relative path, then the path is interpreted relative - -p Print out the document. By default the file to be printed is - the first in the list postscript, pdf, dvi that is being made. - But you can use the -print=... option to change the type of file - to be printed, and you can configure this in a start up file (by - setting the $print_type variable). + 15 April 2021 14 - 29 September 2020 14 +LATEXMK(1) General Commands Manual LATEXMK(1) + + to the document directory. -LATEXMK(1) General Commands Manual LATEXMK(1) + -output-format=FORMAT + This option is one that is allowed for latex, lualatex, and + pdflatex. But it is not passed to these programs. Instead la- + texmk emulates it in a way suitable for the context of latexmk + and its workflows. + If FORMAT is dvi, then dvi output is turned on, and postscript + and pdf output are turned off. This is equivalent to using the + options -dvi -ps- -pdf-. + + If FORMAT is pdf, then pdf output is turned on, and dvi and + postscript output are turned off. This is equivalent to using + the options -pdf -ps- -dvi-. + + If FORMAT is anything else, latexmk gives an error. + + + -p Print out the document. By default the file to be printed is + the first in the list postscript, pdf, dvi that is being made. + But you can use the -print=... option to change the type of file + to be printed, and you can configure this in a start up file (by + setting the $print_type variable). However, printing is enabled by default only under UNIX/Linux systems, where the default is to use the lpr command and only on @@ -958,6 +984,16 @@ LATEXMK(1) General Commands Manual LATEXMK(1) Generate pdf version of document using lualatex. + + 15 April 2021 15 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + -pdfps Generate pdf version of document from the .ps file, by default using ps2pdf. @@ -983,17 +1019,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) overridden if some other option requires the generation of a pdf file.) - - - 29 September 2020 15 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - If after all options have been processed, pdf generation is still turned off, then generation of a dvi file will be turned on, and then the program used to compiled a document will be la- @@ -1024,6 +1049,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) need to change the single quotes to double quotes (or something else). + + + 15 April 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- @@ -1047,20 +1083,8 @@ LATEXMK(1) General Commands Manual LATEXMK(1) be executed before inputting source file. This only works if the command for invoking the relevant *latex is suitably config- ured. See the documentation of the variable $pre_tex_code, and - the substitution strings %P and %U for more details. This - - - - 29 September 2020 16 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - option works by setting the variable $pre_tex_code. + the substitution strings %P and %U for more details. This op- + tion works by setting the variable $pre_tex_code. See also the -usepretex option. @@ -1091,6 +1115,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) -ps Generate postscript version of document. + + + 15 April 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 @@ -1115,17 +1150,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) version of perl and the operating system on your computer. - - - 29 September 2020 17 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - -pv Run file previewer. If the -view option is used, this will se- lect the kind of file to be previewed (.dvi, .ps or .pdf). Oth- erwise the viewer views the "highest" kind of file selected, by @@ -1155,47 +1179,49 @@ 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 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. + variable. This would also work for pdf files except for an - 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. - 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.) + 15 April 2021 18 + - -pvc- Turn off -pvc. +LATEXMK(1) General Commands Manual LATEXMK(1) - 29 September 2020 18 + 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. + 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.) -LATEXMK(1) General Commands Manual LATEXMK(1) + -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. @@ -1211,34 +1237,46 @@ 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 + + + + 15 April 2021 19 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + 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 + 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 + 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. -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. @@ -1247,17 +1285,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) configuration variable. - - - 29 September 2020 19 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - -recorder- Do not supply the -recorder option with *latex. @@ -1266,78 +1293,78 @@ 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 an error message.) These options are - very numerous, but are not listed in this documentation because - they have no effect on latexmk's actions. - - There are a few options (-includedirectory=dir, -initialize, - -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 also options that are accepted by latex etc, but in- - stead trigger actions by latexmk: -help, -version. - - Finally, there are certain options for *latex (e.g., -recorder) - that trigger special actions or behavior by latexmk itself as - well as being passed in some form to the called *latex program, - or that affect other programs as well. These options do have - entries in this documentation. These options are: -job- - name=STRING, -aux-directory=dir, -output-directory=DIR, -quiet, - and -recorder. + 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, - -silent - Run commands silently, i.e., with options that reduce the amount - of diagnostics generated. For example, with the default set- - tings, the command "latex -interaction=batchmode" is used for - latex, and similarly for its friends. - See also the -logfilewarninglist and -logfilewarninglist- op- - tions. - Also reduce the number of informational messages that latexmk - itself generates. + 15 April 2021 20 - To change the options used to make the commands run silently, - 29 September 2020 20 +LATEXMK(1) General Commands Manual LATEXMK(1) + 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. -LATEXMK(1) General Commands Manual LATEXMK(1) + 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 + latex, and similarly for its friends. + + See also the -logfilewarninglist and -logfilewarninglist- op- + tions. + + Also reduce the number of informational messages that latexmk + itself generates. + + 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.) @@ -1346,55 +1373,56 @@ 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 - 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 - configuration variable. - -use-make- - Do not use the make program to try to make missing files. (De- - fault.) + 15 April 2021 21 + - -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 - the option -pretex=CODE to execute the specified TeX code before +LATEXMK(1) General Commands Manual LATEXMK(1) - 29 September 2020 21 + -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 + appropriate pdflatex, lualatex, xelatex). + See also the documentation for the $use_make_for_missing_files + configuration variable. -LATEXMK(1) General Commands Manual LATEXMK(1) + -use-make- + Do not use the make program to try to make missing files. (De- + fault.) - the source file is read. This option overrides any previous + -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 + the option -pretex=CODE to execute the specified TeX code before + 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.) @@ -1405,7 +1433,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) latexmk -usepretex='\AtBeginDocument{Message\par}' foo.tex - -v, -version + -v or -version Print version number of latexmk. @@ -1416,86 +1444,99 @@ 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, + + + + 15 April 2021 22 + + + + + +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 + Note the possibility -view=none where no viewer is opened at + all. One example of is use is in conjunction with the -pvc op- + tion, when you want latexmk to do a compilation automatically + whenever source file(s) change, but do not want a previewer to be opened. -Werror - This causes latexmk to return a non-zero status code if any of - the files processed gives a warning about problems with cita- - tions or references (i.e., undefined citations or references or - about multiply defined references). This is after latexmk has - completed all the runs it needs to try and resolve references - and citations. Thus -Werror causes latexmk to treat such warn- + This causes latexmk to return a non-zero status code if any of + the files processed gives a warning about problems with cita- + tions or references (i.e., undefined citations or references or + about multiply defined references). This is after latexmk has + completed all the runs it needs to try and resolve references + and citations. Thus -Werror causes latexmk to treat such warn- ings as errors, but only when they occur on the last run of *la- - tex and only after processing is complete. Also can be set by + tex and only after processing is complete. Also can be set by the configuration variable $warnings_as_errors. -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 + -pdfxe for why this is done.] - 29 September 2020 22 + -xelatex="COMMAND" + This sets the string specifying the command to run xelatex. It + sets the variable $xelatex. + Warning: It is important to ensure that the -no-pdf is used when + xelatex is invoked, since latexmk expects xelatex to produce an + .xdv file, not a .pdf file. If you provide %O in the command + specification, this will be done automatically. See the docu- + mentation for the -pdfxe option for why latexmk makes a .xdv + file rather than a .pdf file when xelatex is used. + An example of the use of the -pdfxelatex option: + latexmk -pdfxe -pdfxelatex="xelatex --shell-escape %O %S" -LATEXMK(1) General Commands Manual LATEXMK(1) - -pdfxe -dvi- -ps- + 15 April 2021 23 - [Note: Note that the method of implementation of this option, - but not its intended primary effect, differ from some earlier - versions of latexmk. Latexmk first uses xelatex to make an .xdv - file, and does all the extra runs needed (including those of - bibtex, etc). Only after that does it make the pdf file from - the .xdv file, using xdvipdfmx. See the documentation for the - -pdfxe for why this is done.] - -xelatex="COMMAND" - This sets the string specifying the command to run xelatex. It - sets the variable $xelatex. - Warning: It is important to ensure that the -no-pdf is used when - xelatex is invoked, since latexmk expects xelatex to produce an - .xdv file, not a .pdf file. If you provide %O in the command - specification, this will be done automatically. See the docu- - mentation for the -pdfxe option for why latexmk makes a .xdv - file rather than a .pdf file when xelatex is used. - An example of the use of the -pdfxelatex option: +LATEXMK(1) General Commands Manual LATEXMK(1) + - 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 + 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. 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. @@ -1510,18 +1551,6 @@ EXAMPLES file thesis.tex and any files it uses. After any changes rerun latex the appropriate number of times and - - - - 29 September 2020 23 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - remake the postscript file. If latex encounters an error, latexmk will keep running, watching for @@ -1535,167 +1564,178 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 - from errors in the source document, but they could also be about miss- - ing LaTeX packages, etc.) + the causes of errors in the runs of these programs. (Often these come - 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- - texmk runs by other commands or scripts. + 15 April 2021 24 - 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 - the LaTeX part of the document: - 29 September 2020 24 +LATEXMK(1) General Commands Manual LATEXMK(1) + 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 + difficult situations. -LATEXMK(1) General Commands Manual LATEXMK(1) + 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 + 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 + 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 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 + 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 + + + + 15 April 2021 25 + + + + + +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. 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, + 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. (E.g., the -output-for- - mat=... option could be used with lualatex, or xelatex gets invoked - without the -no-pdf option.) + 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, + Another example is where the document uses graphics file of the .pdf, + .jpg, and png types. With the default setting for the graphicx pack- + age, these can be processed in compilation to .pdf but not with compi- + lation to .dvi. In this case, it is useful to insert \pdfoutput=1 in + the preamble of the document to force compilation to .pdf output for- + mat. + In all of these cases, it is needed that latexmk has to adjust its pro- + cessing to deal with a mismatch between the actual output format (out + of .pdf, .dvi, .xdv) and the initially expected output, if possible. + Latexmk does this provided the following conditions are met. + 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 + mismatch of filetypes in the compilation results in an erro. - 29 September 2020 25 + 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 + 15 April 2021 26 -LATEXMK(1) General Commands Manual LATEXMK(1) - .jpg, and png types. With the default setting for the graphicx pack- - age, these can be processed in compilation to .pdf but not with compi- - lation to .dvi. In this case, it is useful to insert \pdfoutput=1 in - the preamble of the document to force compilation to .pdf output for- - mat. - In all of these cases, it is needed that latexmk has to adjust its pro- - cessing to deal with a mismatch between the actual output format (out - of .pdf, .dvi, .xdv) and the initially expected output, if possible. - Latexmk does this provided the following conditions are met. +LATEXMK(1) General Commands Manual LATEXMK(1) - 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 - 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 - 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 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 + 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. 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 @@ -1708,19 +1748,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". - - - - 29 September 2020 26 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - 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", @@ -1730,72 +1758,73 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 + + + + 15 April 2021 27 + + + + + +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- + $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. - 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. - - - 29 September 2020 27 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - For possible examples of code for in an RC file, see the directory ex- - ample_rcfiles in the distribution of latexmk (e.g., at http://mir- + 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'; @@ -1808,60 +1837,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 - these complications.) - You can do much more complicated things, but for this you will need to - consult a manual for the Perl programming language. + 15 April 2021 28 -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- - 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 - 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 +LATEXMK(1) General Commands Manual LATEXMK(1) + push @default_files, 'paper2'; - 29 September 2020 28 + Note that simple "scalar" variables have names that begin with a $ + character and array variables have names that begin with a @ character. + Each statement ends with a semicolon. + Strings should be enclosed in single quotes. (You could use double + quotes, as in many programming languages. But then the Perl program- + ming language brings into play some special rules for interpolating + variables into strings. People not fluent in Perl will want to avoid + these complications.) + You can do much more complicated things, but for this you will need to + consult a manual for the Perl programming language. -LATEXMK(1) General Commands Manual LATEXMK(1) +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- + 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 + documentation.) + Placeholders: Supposed you wanted latexmk to use the command elatex in + place of the regular latex command, and suppose moreover that you + wanted to give it the option "--shell-escape". You could do this by the following setting: $latex = 'elatex --shell-escape %O %S'; - The two items starting with the % character are placeholders. These - 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: @@ -1870,120 +1899,120 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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). + + + + 15 April 2021 29 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + %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 + %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 + 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 + 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 + 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 + UNIX and MS-Windows, i.e., ':', '/' and '\'. + If for some reason you need a literal % character in your string not + subject to the above rules, use "%%". - 29 September 2020 29 + 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 + for the variable $quote_filenames. + See the default values in the section "List of configuration variables + 15 April 2021 30 -LATEXMK(1) General Commands Manual LATEXMK(1) - is appended if $aux_dir is non-empty and does not end in a suit- - able character, with suitable characters being those appropriate - to UNIX and MS-Windows, i.e., ':', '/' and '\'. Note that if - after initialization, $out_dir is set, but $aux_dir is not set - (i.e., it is blank), then latexmk sets $aux_dir to the same - value $out_dir. - %Z Name of directory for output files (see the configuration vari- - able $out_dir). A directory separation character ('/') is 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 - subject to the above rules, use "%%". +LATEXMK(1) General Commands Manual LATEXMK(1) - 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 - for the variable $quote_filenames. - See the default values in the section "List of configuration variables usable in initialization files" for what is normally the most appropri- ate usage. If you omit to supply any placeholders whatever in the specification of - a command, latexmk will supply what its author thinks are appropriate + a command, latexmk will supply what its author thinks are appropriate defaults. This gives compatibility with configuration files for previ- ous versions of latexmk, which didn't use placeholders. - "Detaching" a command: Normally when latexmk runs a command, it waits + "Detaching" a command: Normally when latexmk runs a command, it waits for the command to run to completion. This is appropriate for commands like latex, of course. But for previewers, the command should normally - run detached, so that latexmk gets the previewer running and then 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 - - - - 29 September 2020 30 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - + 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 @@ -1995,35 +2024,47 @@ 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. - See the above examples. Backslashes often get misinterpreted by the + not the usual backslashes for the separator of pathname components. + + + + 15 April 2021 31 + + + + + +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- + Using MS-Windows file associations: A useful trick under modern ver- sions of MS-Windows (e.g., WinXP) is to use just the command 'start' by itself: $dvi_previewer = 'start %S'; Under MS-Windows, this will cause to be run whatever program the system - has associated with dvi files. (The same applies for a postscript + 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. @@ -2032,30 +2073,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 - - - - 29 September 2020 31 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - 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'; @@ -2065,30 +2094,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. + + + 15 April 2021 32 + + + + + +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 + 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: - $pdflatex = 'pdflatex --shell-escape %O %S; pst2pdf_for_latexmk + $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 @@ -2096,60 +2136,58 @@ 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 - - - - 29 September 2020 32 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - - adjusted 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. + + 15 April 2021 33 + + + + + +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- + 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 + 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 @@ -2159,100 +2197,88 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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- + 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 + TeXLive 2017.) + To keep backward compatibility with older versions of latexmk, + the default is to set $analyze_input_log_always to 1. - 29 September 2020 33 + $auto_rc_use [1] + 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 + to prevent automatic reading of the later RC files. + This variable does not affect the reading of RC files specified + on the command line by the -r option. -LATEXMK(1) General Commands Manual LATEXMK(1) + 15 April 2021 34 - 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 - TeXLive 2017.) - 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) - 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 - to prevent automatic reading of the later RC files. +LATEXMK(1) General Commands Manual LATEXMK(1) - 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 + 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 + 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- + rently (Dec. 2011 and later) this only works on the MiKTeX ver- sion 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. $banner [0] - If nonzero, the banner message is printed across each page when - converting the dvi file to postscript. Without modifying the - variable $banner_message, this is equivalent to specifying the + If nonzero, the banner message is printed across each page when + converting the dvi file to postscript. Without modifying the + variable $banner_message, this is equivalent to specifying the -d option. Note that if $banner is nonzero, the $postscript_mode is assumed and the postscript file is always generated, even if it is newer - - - - 29 September 2020 34 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - than the dvi file. $banner_intensity [0.95] Equivalent to the -bi option, this is a decimal number between 0 - and 1 that specifies how dark to print the banner message. 0 is + and 1 that specifies how dark to print the banner message. 0 is black, 1 is white. The default is just right if your toner car- tridge isn't running too low. @@ -2261,76 +2287,101 @@ LATEXMK(1) General Commands Manual LATEXMK(1) dvi file to postscript. This is equivalent to the -bm option. $banner_scale [220.0] - A decimal number that specifies how large the banner message - will be printed. Experimentation is necessary to get the right - 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. + A decimal number that specifies how large the banner message + will be printed. Experimentation is necessary to get the right + 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. + 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: + + + 15 April 2021 35 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + @BIBINPUTS = ( ".", "C:\\bibfiles" ); @BIBINPUTS = ( ".", "\\server\bibfiles" ); @BIBINPUTS = ( ".", "C:/bibfiles" ); @BIBINPUTS = ( ".", "//server/bibfiles" ); @BIBINPUTS = ( ".", "/usr/local/texmf/bibtex/bib" ); - Note that under MS Windows, either a forward slash "/" or a - backward slash "\" can be used to separate pathname components, - so the first two and the second two examples are equivalent. - Each backward slash should be doubled to avoid running afoul of + Note that under MS Windows, either a forward slash "/" or a + backward slash "\" can be used to separate pathname components, + so the first two and the second two examples are equivalent. + Each backward slash should be doubled to avoid running afoul of Perl's rules for writing strings. Important note: This variable is now mostly obsolete in the cur- rent version of latexmk, since it has a better method of search- - ing for files using the kpsewhich command. However, if your - system is an unusual one without the kpsewhich command, you may + ing for files using the kpsewhich command. However, if your + system is an unusual one without the kpsewhich command, you may need to set the variable @BIBINPUTS. $biber ["biber %O %S"] The biber processing program. $biber_silent_switch ["--onlylog"] - Switch(es) for the biber processing program when silent mode is + Switch(es) for the biber processing program when silent mode is on. + $bibtex ["bibtex %O %S"] + The BibTeX processing program. + $bibtex_fudge [1] + When using bibtex, whether to change directory to $aux_dir be- + fore running bibtex. + The need arises as follows: - 29 September 2020 35 + a. With bibtex before about 2019, if the filename given to it + contains a path component, there was a bug that bibtex would not + find extra aux files, as produced by the \include command in + TeX. + b. With all moderately recent versions of bibtex, bibtex may + 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. -LATEXMK(1) General Commands Manual LATEXMK(1) + $bibtex_use [1] + Under what conditions to run bibtex or biber. When latexmk - $bibtex ["bibtex %O %S"] - The BibTeX processing program. - $bibtex_fudge [0] - When using bibtex, whether to take special action to allow older - versions of bibtex to work when $out_dir or $aux_dir is speci- - fied. With bibtex from about 2019, this special action is - longer be required; hence the default is not to do it. + 15 April 2021 36 - $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 dis- - covers from the log file that one (or more) bibtex/biber-gener- - ated bibliographies are used, it can run bibtex or biber when- + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + + discovers from the log file that one (or more) bibtex/biber-gen- + erated 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 @@ -2368,18 +2419,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) generated. It will also include files made from these first generation generated files. - - - - 29 September 2020 36 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - This operation is somewhat dangerous, and can have unintended consequences, since the files to be deleted are determined from a file created by *latex, which can contain erroneous informa- @@ -2395,6 +2434,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 + + + + 15 April 2021 37 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + variables.) This variable is equivalent to specifying one of the -c or -C @@ -2416,7 +2467,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) in an initialization file will imply that when a clean-up opera- tion is specified, not only is the standard set of files - deleted, but also files of the form FOO.out, FOO-blx.bib, %R- + deleted, but also files of the form FOO.out, FOO-blx.bib, FOO- figures*.log, and pythontex-files-FOO/*, where FOO stands for the basename of the file being processed (as in FOO.tex). @@ -2434,31 +2485,31 @@ LATEXMK(1) General Commands Manual LATEXMK(1) You can arrange to remove both the files and the directory by setting + $clean_ext = "pythontex-files-%R pythontex-files-%R"; + 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. - 29 September 2020 37 + 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. -LATEXMK(1) General Commands Manual LATEXMK(1) + 15 April 2021 38 - $clean_ext = "pythontex-files-%R pythontex-files-%R"; - 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. +LATEXMK(1) General Commands Manual LATEXMK(1) $compiling_cmd [""], $failure_cmd [""], $warning_cmd [""], $success_cmd @@ -2500,18 +2551,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) These assume that the program xdotool is installed, that the previewer is using an X-Window system for display, and that the title of the window contains the name of the displayed file, as - - - - 29 September 2020 38 - - - - - -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 @@ -2527,6 +2566,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) More complicated situations can best be handled by defining a Perl subroutine to invoke the necessary commands, and using the + + + + 15 April 2021 39 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + "internal" keyword in the definitions to get the subroutine to be invoked. (See the section "Format of Command Specifications" for how to do this.) @@ -2566,18 +2617,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) specified on the latexmk command line. 2. Wildcards are allowed in @default_excluded_files. - - - - 29 September 2020 39 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - @default_files [("*.tex")] Default list of files to be processed. @@ -2593,6 +2632,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) line then the files you specify by setting @default_files are processed. + + + + 15 April 2021 40 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + Three examples: @default_files = ("paper_current"); @@ -2633,17 +2684,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) *latex programs. This variable is set by the -cd and -cd- op- tions on latexmk's command line. - - - 29 September 2020 40 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - $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. @@ -2658,6 +2698,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) file for which a .dvi file is a prerequisite, then $dvi_mode will be set to 1. + + + + 15 April 2021 41 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + $dvi_previewer ["start xdvi %O %S" under UNIX] The command to invoke a dvi-previewer. [Under MS-Windows the default is "start"; then latexmk arranges to use the MS-Windows @@ -2698,18 +2750,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) N.B. The standard dvipdf program runs silently, so adding the silent switch has no effect, but is actually innocuous. But if an alternative program is used, e.g., dvipdfmx, then the silent - - - - 29 September 2020 41 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - switch has an effect. The default setting is correct for dvipdfm and dvipdfmx. @@ -2723,6 +2763,19 @@ LATEXMK(1) General Commands Manual LATEXMK(1) The program to used as a filter to convert a .dvi file to a .ps file in landscape mode. + + + + + 15 April 2021 42 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + $dvips_pdf_switch ["-P pdf"] Switch(es) for dvips program when pdf file is to be generated from .ps file. @@ -2765,17 +2818,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $failure_cmd [undefined] See the documentation for $compiling_cmd. - - - 29 September 2020 42 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - $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 @@ -2788,6 +2830,18 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 + + + + 15 April 2021 43 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + to worry about these settings, and can ignore the following ex- planation. @@ -2830,28 +2884,29 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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- + ing unrecognized cross references. Equivalent to specifying the + -f option. - 29 September 2020 43 + 15 April 2021 44 -LATEXMK(1) General Commands Manual LATEXMK(1) - 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. +LATEXMK(1) General Commands Manual LATEXMK(1) - $force_mode [0] - 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 )] @@ -2896,28 +2951,28 @@ LATEXMK(1) General Commands Manual LATEXMK(1) The general rule latexmk uses for determining when an extra run of some program is needed is that one of the source files has changed. But consider for example a latex package that causes + an encapsulated postscript file (an "eps" file) to be made that + is to be read in on the next run. The file contains a comment + line giving its creation date and time. On the next run the + time changes, latex sees that the eps file has changed, and + therefore reruns latex. This causes an infinite loop, that is + only terminated because latexmk has a limit on the number of + 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: - 29 September 2020 44 + 15 April 2021 45 -LATEXMK(1) General Commands Manual LATEXMK(1) - 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. +LATEXMK(1) General Commands Manual LATEXMK(1) - 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: '; @@ -2961,29 +3016,29 @@ LATEXMK(1) General Commands Manual LATEXMK(1) not contain spaces.) The placeholder '%A' is permitted. This will be substituted by - the basename of the TeX file. The primary purpose is when a + 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 + 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 + perl that contains perl's name for the operating system.) - 29 September 2020 45 + 15 April 2021 46 -LATEXMK(1) General Commands Manual LATEXMK(1) - variety 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"; +LATEXMK(1) General Commands Manual LATEXMK(1) - in an initialization file. (Here $^O is a variable provided by - perl that contains perl's name for the operating system.) Suppose you had .tex files test1.tex and test2.tex. Then when you run @@ -3029,17 +3084,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) visible in latexmk's screen output about invocations of kpse- which. - - - 29 September 2020 46 - - - - - -LATEXMK(1) General Commands Manual LATEXMK(1) - - $landscape_mode [0] If nonzero, run in landscape mode, using the landscape mode pre- viewers and dvi to postscript converters. Equivalent to the -l @@ -3051,6 +3095,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) just to change the name of the program used, but also specify options to the program. E.g., + + + 15 April 2021 47 + + + + + +LATEXMK(1) General Commands Manual LATEXMK(1) + + $latex = "latex --src-specials %O %S"; To do a coordinated setting of all of $latex, $pdflatex, $luala- @@ -3094,28 +3149,28 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 + line in an initialization file + $latex_silent_switch = "-interaction=batchmode -c-style-er- + rors"; - 29 September 2020 47 + $lpr ["lpr %O %S" under UNIX/Linux, "NONE lpr" under MS-Windows] + The command to print postscript files. + 15 April 2021 48 -LATEXMK(1) General Commands Manual LATEXMK(1) - 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- - rors"; +LATEXMK(1) General Commands Manual LATEXMK(1) - $lpr ["lpr %O %S" under UNIX/Linux, "NONE lpr" under MS-Windows] - The command to print postscript files. Under MS-Windows (unlike UNIX/Linux), there is no standard pro- gram for printing files. But there are ways you can do it. For @@ -3159,19 +3214,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) tex, and $xelatex, see the section "Advanced Configuration". - - - - - 29 September 2020 48 - - - - - -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 @@ -3185,6 +3227,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) specified by the variable %pdflatex_input_extensions. The de- fault extensions are 'tex', 'pdf', 'jpg, and 'png'. + + + 15 April 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. @@ -3201,6 +3254,13 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $makeindex ["makeindex %O -o %D %S"] 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 + will refuse to write its output and log files, for security rea- + sons. + $makeindex_silent_switch ["-q"] Switch(es) for the index processing program when silent mode is on. @@ -3226,10 +3286,16 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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- + stitution from "/" to "\", by default. + + However there are also programs on MS-Windows for which a back - 29 September 2020 49 + 15 April 2021 50 @@ -3238,12 +3304,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - 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- - stitution from "/" to "\", by default. - - 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 @@ -3291,11 +3351,17 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 + 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 - 29 September 2020 50 + 15 April 2021 51 @@ -3304,12 +3370,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - default "paranoid" setting. - - $pdf_mode [0] - If zero, do NOT generate a pdf version of the document. If - equal to 1, generate a pdf version of the document using pdfla- - tex, using the command specified by the $pdflatex variable. If equal to 2, generate a pdf version of the document from the ps file, by using the command specified by the $ps2pdf variable. If equal to 3, generate a pdf version of the document from the @@ -3358,24 +3418,23 @@ LATEXMK(1) General Commands Manual LATEXMK(1) See details of the %latex_input_extensions for other information that equally applies to %pdflatex_input_extensions. + $pdflatex_silent_switch ["-interaction=batchmode"] + Switch(es) for the pdflatex program (specified in the variable + $pdflatex) when silent mode is on. + See details of the $latex_silent_switch for other information + that equally applies to $pdflatex_silent_switch. - 29 September 2020 51 - + 15 April 2021 52 -LATEXMK(1) General Commands Manual LATEXMK(1) - $pdflatex_silent_switch ["-interaction=batchmode"] - Switch(es) for the pdflatex program (specified in the variable - $pdflatex) when silent mode is on. +LATEXMK(1) General Commands Manual LATEXMK(1) - 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. @@ -3425,23 +3484,23 @@ LATEXMK(1) General Commands Manual LATEXMK(1) Note that acroread under MS-Windows (but not UNIX) locks the pdf file, so the default value is then 3. + Arranging to use a command to get a previewer explicitly updated + requires three variables to be set. For example: + $pdf_previewer = "start xpdf -remote %R %O %S"; + $pdf_update_method = 4; + $pdf_update_command = "xpdf -remote %R -reload"; - 29 September 2020 52 + 15 April 2021 53 -LATEXMK(1) General Commands Manual LATEXMK(1) - Arranging to use a command to get a previewer explicitly updated - requires three variables to be set. For example: +LATEXMK(1) General Commands Manual LATEXMK(1) - $pdf_previewer = "start xpdf -remote %R %O %S"; - $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 @@ -3491,9 +3550,16 @@ LATEXMK(1) General Commands Manual LATEXMK(1) + $preview_continuous_mode [0] + If nonzero, run a previewer to view the document, and continue + running latexmk to keep .dvi up-to-date. Equivalent to the -pvc + option. Which previewer is run depends on the other settings, + see the command line options -view=, and the variable $view. + + - 29 September 2020 53 + 15 April 2021 54 @@ -3502,12 +3568,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - $preview_continuous_mode [0] - If nonzero, run a previewer to view the document, and continue - running latexmk to keep .dvi up-to-date. Equivalent to the -pvc - option. Which previewer is run depends on the other settings, - see the command line options -view=, and the variable $view. - $preview_mode [0] If nonzero, run a previewer to preview the document. Equivalent to the -pv option. Which previewer is run depends on the other @@ -3556,24 +3616,24 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 - 29 September 2020 54 + 15 April 2021 55 -LATEXMK(1) General Commands Manual LATEXMK(1) +LATEXMK(1) General Commands Manual LATEXMK(1) - 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 perhaps not one actually called gv. Important note: Normally you will want to have a previewer run @@ -3623,20 +3683,22 @@ LATEXMK(1) General Commands Manual LATEXMK(1) The period of inactivity, in minutes, after which pvc mode times out. This is used if $pvc_timeout is nonzero. + $pvc_view_file_via_temporary [1] + The same as $always_view_file_via_temporary, except that it only + applies in preview-continuous mode (-pvc option). + - 29 September 2020 55 + 15 April 2021 56 -LATEXMK(1) General Commands Manual LATEXMK(1) - $pvc_view_file_via_temporary [1] - The same as $always_view_file_via_temporary, except that it only - applies in preview-continuous mode (-pvc option). +LATEXMK(1) General Commands Manual LATEXMK(1) + $quote_filenames [1] This specifies whether substitutions for placeholders in command @@ -3688,10 +3750,14 @@ LATEXMK(1) General Commands Manual LATEXMK(1) output or aux directories.] The default under MSWin and Cygwin is ';' and under UNIX-like + operating systems (including Linux and OS-X) is ':'. Normally + the defaults give correct behavior. But there can be difficul- + ties if your operating system is of one kind, but some of your + software is running under an emulator for the other kind of - 29 September 2020 56 + 15 April 2021 57 @@ -3700,11 +3766,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) 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 op- - erating system; in that case you'll need to find out what is + operating system; in that case you'll need to find out what is needed, and set $search_path_separator explicitly. (The same goes, of course, for unusual operating systems that are not in the MSWin, Linux, OS-X, Unix collection.) @@ -3753,11 +3815,15 @@ LATEXMK(1) General Commands Manual LATEXMK(1) $success_cmd [undefined] See the documentation for $compiling_cmd. + $tmpdir [See below for default] + Directory to store temporary files that latexmk may generate + while running. + The default under MSWindows (including cygwin), is to set - 29 September 2020 57 + 15 April 2021 58 @@ -3766,13 +3832,8 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - $tmpdir [See below for default] - Directory to store temporary files that latexmk may generate - while running. - - The default under MSWindows (including cygwin), is to set $tm- - pdir to the value of the first of whichever of the system envi- - ronment variables TMPDIR or TEMP exists, otherwise to the cur- + $tmpdir to the value of the first of whichever of the system en- + vironment 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 @@ -3820,10 +3881,15 @@ LATEXMK(1) General Commands Manual LATEXMK(1) The default behavior is normally satisfactory in the usual edit- compile-edit cycle. But, for example, latexmk can also be used + as part of a build process for some bigger project, e.g., for + creating documentation in the build of a software application. + Then it is often sensible to treat citation and reference warn- + ings as errors that require the overall build process to be + aborted. Of course, since multiple runs of *latex are generally - 29 September 2020 58 + 15 April 2021 59 @@ -3832,11 +3898,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - as part of a build process for some bigger project, e.g., for - creating documentation in the build of a software application. - Then it is often sensible to treat citation and reference warn- - ings as errors that require the overall build process to be - aborted. Of course, since multiple runs of *latex are generally needed to resolve references and citations, what matters is not the warnings on the first run, but the warnings on the last run; latexmk takes this into account appropriately. @@ -3886,10 +3947,15 @@ LATEXMK(1) General Commands Manual LATEXMK(1) not been found, and the file is given without an extension. This typically happens when LaTeX commands of the form \in- put{file} or \includegraphics{figure}, when the relevant source + file does not exist. + + In this situation, latexmk searches for custom dependencies to + make the missing file(s), but restricts it to the extensions + specified by the variable %xelatex_input_extensions. The - 29 September 2020 59 + 15 April 2021 60 @@ -3898,12 +3964,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - file does not exist. - - In this situation, latexmk searches for custom dependencies to - make the missing file(s), but restricts it to the extensions - specified by the variable %xelatex_input_extensions. The de- - fault extensions are 'tex', 'pdf', 'jpg, and 'png'. + default extensions are 'tex', 'pdf', 'jpg, and 'png'. See details of the %latex_input_extensions for other information that equally applies to %xelatex_input_extensions. @@ -3952,23 +4013,23 @@ CUSTOM DEPENDENCIES must: If non-zero, the file from which we are converting must exist, if it doesn't exist latexmk will give an error message and exit unless the -f option is specified. If must is zero and the file + we are converting from doesn't exist, then no action is taken. + Generally, the appropriate value of must is zero. + function: + The name of the subroutine that latexmk should call to perform - 29 September 2020 60 + 15 April 2021 61 -LATEXMK(1) General Commands Manual LATEXMK(1) +LATEXMK(1) General Commands Manual LATEXMK(1) - we are converting from doesn't exist, then no action is taken. - Generally, the appropriate value of must is zero. - function: - The name of the subroutine that latexmk should call to perform the file conversion. The first argument to the subroutine is the base name of the file to be converted without any extension. The subroutines are declared in the syntax of Perl. The func- @@ -4018,21 +4079,21 @@ LATEXMK(1) General Commands Manual LATEXMK(1) Note for advanced usage: The operating system's environment variable TEXINPUTS can be used to specify a search path for finding files by la- tex etc. Correspondingly, when a missing file is reported, latexmk + looks in the directories specified in TEXINPUTS as well as in the cur- + rent directory, to find a source file from which an instance of a cus- + tom dependency can be used to make the missing file. - 29 September 2020 61 + 15 April 2021 62 -LATEXMK(1) General Commands Manual LATEXMK(1) - looks in the directories specified in TEXINPUTS as well as in the cur- - rent directory, to find a source file from which an instance of a cus- - tom dependency can be used to make the missing file. +LATEXMK(1) General Commands Manual LATEXMK(1) Function to implement custom dependency, traditional method: @@ -4084,10 +4145,15 @@ LATEXMK(1) General Commands Manual LATEXMK(1) } Note 1: In the command lines given in the system commands in the above + examples, double quotes have been inserted around the file names (im- + plemented by '\"' in the Perl language). They immunize the running of + the program against special characters in filenames. Very often these + quotes are not necessary, i.e., they can be omitted. But it is nor- + mally safer to keep them in. Even though the rules for quoting vary - 29 September 2020 62 + 15 April 2021 63 @@ -4096,11 +4162,6 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - examples, double quotes have been inserted around the file names (im- - plemented by '\"' in the Perl language). They immunize the running of - the program against special characters in filenames. Very often these - quotes are not necessary, i.e., they can be omitted. But it is nor- - mally safer to keep them in. Even though the rules for quoting vary between operating systems, command shells and individual pieces of software, the quotes in the above examples do not cause problems in the cases I have tested. @@ -4149,11 +4210,16 @@ LATEXMK(1) General Commands Manual LATEXMK(1) file. This method has been available since very old versions of la- texmk, and many examples can be found, e.g., on the web. - However in later versions of latexmk the internal structure of the + However in later versions of latexmk the internal structure of the im- + plementation of its "rules" for the steps of processing, including cus- + tom dependencies, became much more powerful. The function implementing + a custom dependency is executed within a special context where a number + of extra variables and subroutines are defined. Publicly documented + ones, intended to be long-term stable, are listed below, under the - 29 September 2020 63 + 15 April 2021 64 @@ -4162,12 +4228,7 @@ LATEXMK(1) General Commands Manual LATEXMK(1) LATEXMK(1) General Commands Manual LATEXMK(1) - implementation of its "rules" for the steps of processing, including - custom dependencies, became much more powerful. The function imple- - menting a custom dependency is executed within a special context where - a number of extra variables and subroutines are defined. Publicly doc- - umented ones, intended to be long-term stable, are listed below, under - the heading "Variables and subroutines for processing a rule". + heading "Variables and subroutines for processing a rule". Examples of their use is given in the following examples, concerning multiple index files and glossaries. @@ -4216,22 +4277,22 @@ LATEXMK(1) General Commands Manual LATEXMK(1) push @generated_exts, 'ndx', 'nnd', 'adx', 'and'; This last example uses the command specification in $makeindex, and so + any customization you have made for the standard index also applies to + your extra indexes. + Similar techniques can be applied for glossaries. - 29 September 2020 64 + 15 April 2021 65 -LATEXMK(1) General Commands Manual LATEXMK(1) - any customization you have made for the standard index also applies to - your extra indexes. +LATEXMK(1) General Commands Manual LATEXMK(1) - Similar techniques can be applied for glossaries. Those of you with experience with Makefiles, may get concerned that the .ndx file is written during a run of *latex and is always later than @@ -4281,23 +4342,24 @@ ADVANCED CONFIGURATION: Some extra resources and advanced tricks See also the section DEALING WITH ERRORS, PROBLEMS, ETC. See also the examples in the directory example_rcfiles in the latexmk distributions. - Even if none of the examples apply to your case, they may give you + Even if none of the examples apply to your case, they may give you use- + ful ideas + + Utility subroutines - 29 September 2020 65 + 15 April 2021 66 -LATEXMK(1) General Commands Manual LATEXMK(1) - useful ideas +LATEXMK(1) General Commands Manual LATEXMK(1) - Utility subroutines ensure_path( var, values ...) The first parameter is the name of one of the system's environ- @@ -4347,22 +4409,22 @@ LATEXMK(1) General Commands Manual LATEXMK(1) This gives the name of the primary source file. Note the double dollar signs. + $$Pdest + This gives the name of the main output file if any. Note the + double dollar signs. - 29 September 2020 66 + 15 April 2021 67 -LATEXMK(1) General Commands Manual LATEXMK(1) +LATEXMK(1) General Commands Manual LATEXMK(1) - $$Pdest - This gives the name of the main output file if any. Note the - double dollar signs. rdb_ensure_file( $rule, file ) This a subroutine that ensures that the given file is among the @@ -4414,21 +4476,21 @@ LATEXMK(1) General Commands Manual LATEXMK(1) pattern, you can use one of the following subroutines, std_tex_cmds, alt_tex_cmds, and set_tex_cmds. + They work as follows + &std_tex_cmds; - 29 September 2020 67 + 15 April 2021 68 -LATEXMK(1) General Commands Manual LATEXMK(1) - They work as follows +LATEXMK(1) General Commands Manual LATEXMK(1) - &std_tex_cmds; This results in $latex = 'latex %O %S', and similarly for $pdflatex, $lualatex, and $xelatex. Note the ampersand in the invocation; this @@ -4479,22 +4541,22 @@ LATEXMK(1) General Commands Manual LATEXMK(1) could be quite complicated, for example if some of the source files for a LaTeX document are generated by the project's software. - In this section, I give a couple of examples of how latexmk can be + In this section, I give a couple of examples of how latexmk can be use- + fully invoked from a Makefile. The examples use specific features of + current versions of GNU make, which is the default on both linux and + OS-X systems. They may need modifications for other versions of make. - 29 September 2020 68 + 15 April 2021 69 -LATEXMK(1) General Commands Manual LATEXMK(1) +LATEXMK(1) General Commands Manual LATEXMK(1) - usefully invoked from a Makefile. The examples use specific features - of current versions of GNU make, which is the default on both linux and - OS-X systems. They may need modifications for other versions of make. The simplest method is simply to delegate all the relevant tasks to la- texmk, as is suitable for a straightforward LaTeX document. For this a @@ -4546,21 +4608,21 @@ LATEXMK(1) General Commands Manual LATEXMK(1) mkdir $@ %.pdf : %.tex if [ ! -e $(DEPS_DIR) ]; then mkdir $(DEPS_DIR); fi + $(LATEXMK) -pdf -dvi- -ps- -deps-out=$(DEPS_DIR)/$@P $< + %.pdf : %.fig + fig2dev -Lpdf $< $@ - 29 September 2020 69 + 15 April 2021 70 -LATEXMK(1) General Commands Manual LATEXMK(1) +LATEXMK(1) General Commands Manual LATEXMK(1) - $(LATEXMK) -pdf -dvi- -ps- -deps-out=$(DEPS_DIR)/$@P $< - %.pdf : %.fig - fig2dev -Lpdf $< $@ (Again, the lines containing the commands for the rules should be started with tabs.) This example was inspired by how GNU automake han- @@ -4612,10 +4674,14 @@ BUGS manual update (reopen); it views postscript and pdf. Gsview under MS- Windows works for both postscript and pdf, but only reads the updated file when its screen is refreshed. Acroread under UNIX/Linux views + pdf, but the file needs to be closed and reopened to view an updated + version. Under MS-Windows, acroread locks its input file and so the + pdf file cannot be updated. (Remedy: configure latexmk to use suma- + trapdf instead.) - 29 September 2020 70 + 15 April 2021 71 @@ -4624,11 +4690,6 @@ BUGS LATEXMK(1) General Commands Manual LATEXMK(1) - pdf, but the file needs to be closed and reopened to view an updated - version. Under MS-Windows, acroread locks its input file and so the - pdf file cannot be updated. (Remedy: configure latexmk to use suma- - trapdf instead.) - THANKS TO Authors of previous versions. Many users with their feedback, and es- pecially David Coppit (username david at node coppit.org) who made many @@ -4637,7 +4698,7 @@ THANKS TO dard form to avoid being harvested too easily.) AUTHOR - Current version, by John Collins (Version 4.70b). Report bugs etc to + Current version, by John Collins (Version 4.72b). Report bugs etc to his e-mail (jcc8 at psu.edu). Released version can be obtained from CTAN: @@ -4681,6 +4742,11 @@ AUTHOR - 29 September 2020 71 + + + + + + 15 April 2021 72 -- cgit v1.2.3