1LATEXMK(1)                  General Commands Manual                 LATEXMK(1)
2
3
4

NAME

6       latexmk - generate LaTeX document
7

SYNOPSIS

9       latexmk [options] [file ...]
10

DESCRIPTION

12       Latexmk completely automates the process of compiling a LaTeX document.
13       Essentially, it is like a specialized  relative  of  the  general  make
14       utility,  but  one  which determines dependencies automatically and has
15       some other very useful features.  In its basic mode  of  operation  la‐
16       texmk  is given the name of the primary source file for a document, and
17       it issues the appropriate sequence of commands to generate a .dvi, .ps,
18       .pdf and/or hardcopy version of the document.
19
20       By  default  latexmk will run the commands necessary to generate a .dvi
21       file, which copies the behavior of earlier versions when only latex was
22       available.
23
24       Latexmk  can also be set to run continuously with a suitable previewer.
25       In that case the latex program (or one of its relatives), etc, are  re‐
26       run whenever one of the source files is modified, and the previewer au‐
27       tomatically updates the on-screen view of the compiled document.
28
29       Latexmk determines which are the source  files  by  examining  the  log
30       file.  (Optionally, it also examines the list of input and output files
31       generated by the -recorder option of  modern  versions  of  latex  (and
32       pdflatex,  xelatex, lualatex).  See the documentation for the -recorder
33       option of latexmk below.)  When latexmk is run, it examines  properties
34       of  the source files, and if any have been changed since the last docu‐
35       ment generation, latexmk will run the various LaTeX processing programs
36       as necessary.  In particular, it will repeat the run of latex (or a re‐
37       lated program)) often enough to resolve all cross references; depending
38       on  the  macro  packages  used.   With some macro packages and document
39       classes, four, or even more, runs may be needed. If necessary,  latexmk
40       will  also  run  bibtex, biber, and/or makeindex.  In addition, latexmk
41       can be configured to generate other necessary files.  For example, from
42       an updated figure file it can automatically generate a file in encapsu‐
43       lated postscript or another suitable format for reading by LaTeX.
44
45       Latexmk has two different previewing options.  With the simple -pv  op‐
46       tion,  a  dvi,  postscript  or pdf previewer is automatically run after
47       generating the dvi, postscript or pdf version  of  the  document.   The
48       type  of  file  to view is selected according to configuration settings
49       and command line options.
50
51       The second previewing option is the  powerful  -pvc  option  (mnemonic:
52       "preview continuously").  In this case, latexmk runs continuously, reg‐
53       ularly monitoring all the source files to see if any have changed.  Ev‐
54       ery  time a change is detected, latexmk runs all the programs necessary
55       to generate a new version of the document.  A good previewer will  then
56       automatically update its display.  Thus the user can simply edit a file
57       and, when the changes are written to disk, latexmk completely automates
58       the  cycle of updating the .dvi (and/or the .ps and .pdf) file, and re‐
59       freshing the previewer's display.  It's not quite WYSIWYG, but usefully
60       close.
61
62       For  other previewers, the user may have to manually make the previewer
63       update its display, which can be (e.g., with some versions of xdvi  and
64       gsview) as simple as forcing a redraw of its display.
65
66       Latexmk  has  the  ability  to print a banner in gray diagonally across
67       each page when making the postscript file.  It  can  also,  if  needed,
68       call  an  external  program to do other postprocessing on generated dvi
69       and postscript files.  (See the options -dF and -pF, and the documenta‐
70       tion  for  the  $dvi_filter  and  $ps_filter  configuration variables.)
71       These capabilities are leftover from older versions of latexmk, but are
72       currently  non-functional.  More flexibility can be obtained in current
73       versions, since the command strings for running *latex can now be  con‐
74       figured to run multiple commands.  This also extends the possibility of
75       postprocessing generated files.
76
77       Latexmk is highly configurable, both from the command line and in  con‐
78       figuration  files,  so  that  it can accommodate a wide variety of user
79       needs and system configurations.  Default values are set  according  to
80       the operating system, so latexmk often works without special configura‐
81       tion on MS-Windows, cygwin, Linux, OS-X, and other UNIX  systems.   See
82       the  section  "Configuration/Initialization  (rc)  Files", and then the
83       later sections "How to Set Variables in Initialization Files",  "Format
84       of  Command Specifications", "List of Configuration Variables Usable in
85       Initialization Files", "Custom Dependencies", and "Advanced  Configura‐
86       tion"
87
88       A  very annoying complication handled very reliably by latexmk, is that
89       LaTeX is a multiple pass system.  On each run, LaTeX reads in  informa‐
90       tion generated on a previous run, for things like cross referencing and
91       indexing.  In the simplest cases, a second run of LaTeX  suffices,  and
92       often  the log file contains a message about the need for another pass.
93       However, there is a wide variety of add-on  macro  packages  to  LaTeX,
94       with  a variety of behaviors.  The result is to break simple-minded de‐
95       terminations of how many runs are needed and of  which  programs.   La‐
96       texmk has a highly general and efficient solution to these issues.  The
97       solution involves retaining between  runs  information  on  the  source
98       files,  and a symptom is that latexmk generates an extra file (with ex‐
99       tension .fdb_latexmk, by default) that contains the source file  infor‐
100       mation.
101
102

LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE

104       In general the command line to invoke latexmk has the form
105
106            latexmk [options] [file]
107
108       All options can be introduced by single or double "-" characters, e.g.,
109       "latexmk -help" or "latexmk --help".
110
111       Note 1: In the documentation, '*latex' means any of the  supported  en‐
112       gines,  i.e., currently latex, lualatex, pdflatex, xelatex.  Mention of
113       a specific one of these normally refers that specific engines.  Earlier
114       versions  of  this documentation weren't so consistent.  Which of these
115       is used to compile a document, depends on  the  configuration  and  the
116       command line arguments.
117
118       Note  2:  In  addition to the options in the list below, latexmk recog‐
119       nizes almost all the options recognized by the *latex programs in their
120       current  TeXLive  and  MiKTeX implementations.  Some of the options for
121       these programs trigger special action or behavior by latexmk, in  which
122       case  they  have  specific  explanations in this document; in this case
123       they may or may not be passed to *latex as well.
124
125       Run latexmk with the -showextraoptions to get a  list  of  the  options
126       that latexmk accepts and that are simply passed through to *latex.  See
127       also the explanation of the -showextraoptions option for more  informa‐
128       tion.
129
130
131       Definitions of options and arguments
132
133
134       file   One  or more files can be specified.  If no files are specified,
135              latexmk will, by default, run on all files in the current  work‐
136              ing  directory  with  a  ".tex" extension.  This behavior can be
137              changed: see the description concerning the @default_files vari‐
138              able  in  the section "List of configuration variables usable in
139              initialization files".
140
141              If a file is specified without an extension, then the ".tex" ex‐
142              tension  is  automatically  added, just as LaTeX does.  Thus, if
143              you specify:
144
145                   latexmk foo
146
147              then latexmk will operate on the file "foo.tex".
148
149              There are certain restrictions on what characters can  be  in  a
150              filename;  certain  characters are either prohibited or problem‐
151              atic for the latex etc programs.   These  characters  are:  "$",
152              "%", "\", "~", the double quote character, and the control char‐
153              acters null, tab, form feed, carriage  return,  line  feed,  and
154              delete.   In  addition  "&"  is  prohibited when it is the first
155              character of a filename.
156
157              Latexmk gives a fatal error when it detects  any  of  the  above
158              characters in the TeX filename(s) specified on the command line.
159              However before testing for illegal characters,  latexmk  removes
160              matching  pairs  of double quotes from a filename.  This matches
161              the behavior of latex etc, and deals with  problems  that  occa‐
162              sionally result from filenames that have been incorrectly quoted
163              on the command line.  In addition, under Microsoft Windows,  the
164              forward slash character "\" is a directory separator, so latexmk
165              replaces it by a backward slash "/", which is also a  legal  di‐
166              rectory separator in Windows, and is accepted by latex etc.
167
168
169       -auxdir=FOO or -aux-directory=FOO
170              Sets  the  directory for auxiliary output files of *latex (.aux,
171              .log etc).  These are all the generated files, with  the  excep‐
172              tion of final output files (.dvi, .ps, .pdf, .synctex.gz, .sync‐
173              tex).  See the -outdir/-output-directory option for  directories
174              for the final output files.
175
176              If the directory specified for the -aux/-aux-directory option is
177              blank, then the default is used, which is to be the same as  the
178              output directory.
179
180              If you also use the -cd option, and the specified auxiliary out‐
181              put directory is a relative path, then the path  is  interpreted
182              relative to the document directory.
183
184              See  the  section  AUXILIARY AND OUTPUT DIRECTORIES for more de‐
185              tails.
186
187
188       -bibtex
189              When the source file uses bbl files for bibliography, run bibtex
190              or biber as needed to regenerate the bbl files.
191
192              This  property can also be configured by setting the $bibtex_use
193              variable to 2 in a configuration file.
194
195
196       -bibtex-
197              Never run bibtex or biber.  Also, always  treat  .bbl  files  as
198              precious, i.e., do not delete them in a cleanup operation.
199
200              A  common  use  for this option is when a document comes from an
201              external source, complete with its bbl  file(s),  and  the  user
202              does  not  have  the corresponding bib files available.  In this
203              situation use of the -bibtex- option will prevent  latexmk  from
204              trying to run bibtex or biber, which would result in overwriting
205              of the bbl files.
206
207              This property can also be configured by setting the  $bibtex_use
208              variable to 0 in a configuration file.
209
210
211       -bibtex-cond
212              When  the  source  file uses a bbl file for the bibliography and
213              bibtex is used to  generate  the  bibliography,  run  bibtex  as
214              needed  to  regenerate  the  bbl  files only if the relevant bib
215              file(s) exist.  Thus when the bib  file(s)  are  not  available,
216              bibtex is not run, thereby avoiding overwriting of the bbl file.
217              Also, always treat .bbl files as precious, i.e., do  not  delete
218              them in a cleanup operation.
219
220              This  is the default setting.  It can also be configured by set‐
221              ting the $bibtex_use variable to 1 in a configuration file.
222
223              The reason for using this setting is first  to  allow  automatic
224              switching between the use and non-use of bibtex depending on the
225              existence or not of a bib file.  In  addition,  when  submitting
226              articles  to  a  scientific journal, it is common to submit only
227              .tex and .bbl files (plus graphics files), but not a .bib  file.
228              Hence  it  is  often  useful  to treat .bbl files as true source
229              files, that should be preserved under a clean up operation.
230
231              This property can also be configured by setting the  $bibtex_use
232              variable to 1 in a configuration file.
233
234              Note that when biber is used, and a bib file doesn't exist, this
235              option does not currently prevent biber from being run.  See the
236              documentation  on  $bibtex_use for more details.  However, a bbl
237              file is treated as precious.
238
239
240       -bibtex-cond1
241              The same as -bibtex-cond except that .bbl files are only treated
242              as precious if one or more bibfiles fails to exist.
243
244              Thus  if all the bib files exist, bibtex is run to generate .bbl
245              files as needed, and then it is appropriate to  delete  the  bbl
246              files in a cleanup operation since they can be re-generated.
247
248              This  property can also be configured by setting the $bibtex_use
249              variable to 1.5 in a configuration file.
250
251              Note that when biber is used, and a bib file doesn't exist, this
252              option does not currently prevent biber from being run.  See the
253              documentation on $bibtex_use for more details.
254
255
256       -bibtexfudge or -bibfudge
257              Turn on the change-directory fudge for bibtex.   See  documenta‐
258              tion of $bibtex_fudge for details.
259
260
261       -bibtexfudge- or -bibfudge-
262              Turn  off the change-directory fudge for bibtex.  See documenta‐
263              tion of $bibtex_fudge for details.
264
265
266       -bm <message>
267              A banner message to print diagonally across each page when  con‐
268              verting  the dvi file to postscript.  The message must be a sin‐
269              gle argument on the command line so be careful with quoting spa‐
270              ces and such.
271
272              Note  that if the -bm option is specified, the -ps option is as‐
273              sumed.
274
275
276       -bi <intensity>
277              How dark to print the banner message.  A decimal number  between
278              0 and 1.  0 is black and 1 is white.  The default is 0.95, which
279              is OK unless your toner cartridge is getting low.
280
281
282       -bs <scale>
283              A decimal number that specifies how  large  the  banner  message
284              will  be printed.  Experimentation is necessary to get the right
285              scale for your message, as a rule of thumb the scale  should  be
286              about  equal  to 1100 divided by the number of characters in the
287              message.  The default is 220.0 which is just right for 5 charac‐
288              ter messages.
289
290
291       -commands
292              List the commands used by latexmk for processing files, and then
293              exit.
294
295
296       -c     Clean up (remove) all regeneratable files generated by latex and
297              bibtex or biber except dvi, postscript and pdf.  These files are
298              a combination of log files, aux files, latexmk's  database  file
299              of  source file information, and those with extensions specified
300              in the @generated_exts  configuration  variable.   In  addition,
301              files specified by the $clean_ext and @generated_exts configura‐
302              tion variables are removed.
303
304              This cleanup is instead of a regular make.  See the  -gg  option
305              if you want to do a cleanup followed by a make.
306
307              Treatment  of  .bbl files:  If $bibtex_use is set to 0 or 1, bbl
308              files are always treated as non-regeneratable.   If  $bibtex_use
309              is set to 1.5, bbl files are counted as non-regeneratable condi‐
310              tionally: If the bib file exists, then bbl files are  regenerat‐
311              able,  and are deleted in a clean up.  But if $bibtex_use is 1.5
312              and a bib file doesn't exist, then the bbl files are treated  as
313              non-regeneratable and hence are not deleted.
314
315              In  contrast,  if  $bibtex_use is set to 2, bbl files are always
316              treated as regeneratable, and are deleted in a cleanup.
317
318              Treatment  of  files  generated  by  custom   dependencies:   If
319              $cleanup_includes_cusdep_generated   is  nonzero,  regeneratable
320              files are considered as including those generated by custom  de‐
321              pendencies  and are also deleted.  Otherwise these files are not
322              deleted.
323
324
325       -C     Clean up (remove) all regeneratable files generated by latex and
326              bibtex or biber.  This is the same as the -c option with the ad‐
327              dition of dvi, postscript and pdf files, and those specified  in
328              the $clean_full_ext configuration variable.
329
330              This  cleanup  is instead of a regular make.  See the -gg option
331              if you want to do a cleanup followed by a make.
332
333              See the -c option for the specification of whether or  not  .bbl
334              files are treated as non-regeneratable or regeneratable.
335
336              If  $cleanup_includes_cusdep_generated is nonzero, regeneratable
337              files are considered as including those generated by custom  de‐
338              pendencies  and are also deleted.  Otherwise these files are not
339              deleted.
340
341
342       -CA    (Obsolete).  Now equivalent to the -C option.  See  that  option
343              for details.
344
345
346       -cd    Change  to  the directory containing the main source file before
347              processing it.  Then all the generated files (.aux, .log,  .dvi,
348              .pdf, etc) will be relative to the source file.
349
350              This  option is particularly useful when latexmk is invoked from
351              a GUI configured to invoke latexmk with a full pathname for  the
352              source file.
353
354              This  option  works by setting the $do_cd configuration variable
355              to one; you can set that variable if you want to  configure  la‐
356              texmk to have the effect of the -cd option without specifying it
357              on the command line.  See the documentation for that variable.
358
359
360       -cd-   Do NOT change to the directory containing the main  source  file
361              before processing it.  Then all the generated files (.aux, .log,
362              .dvi, .pdf, etc) will  be  relative  to  the  current  directory
363              rather than the source file.
364
365              This  is the default behavior and corresponds to the behavior of
366              the *latex programs.  However, it is not desirable behavior when
367              latexmk  is invoked by a GUI configured to invoke latexmk with a
368              full pathname for the source file.  See the -cd option.
369
370              This option works by setting the $do_cd  configuration  variable
371              to  zero.   See the documentation for that variable for more in‐
372              formation.
373
374
375       -CF    Remove the file containing the database of source file  informa‐
376              tion, before doing the other actions requested.
377
378
379       -d     Set  draft  mode.  This prints the banner message "DRAFT" across
380              your page when converting the dvi file to postscript.  Size  and
381              intensity can be modified with the -bs and -bi options.  The -bm
382              option will override this option as this is really just a  short
383              way of specifying:
384
385                   latexmk -bm DRAFT
386
387              Note  that  if the -d option is specified, the -ps option is as‐
388              sumed.
389
390
391       -deps  Show a list of dependent files after processing.  This is in the
392              form  of a dependency list of the form used by the make program,
393              and it is therefore suitable for use in a Makefile.  It gives an
394              overall view of the files without listing intermediate files, as
395              well as latexmk can determine them.
396
397              By default the list of dependent files is sent to stdout  (i.e.,
398              normally  to  the screen unless you've redirected latexmk's out‐
399              put). But you can set the filename where the list is sent by the
400              -deps-out= option.
401
402              See  the section "USING latexmk WITH make" for an example of how
403              to use a dependency list with make.
404
405              Users familiar with GNU automake and  gcc  will  find  that  the
406              -deps  option  is very similar in its purpose and results to the
407              -M option to gcc.  (In fact, latexmk also has options  -M,  -MF,
408              and -MP options that behave like those of gcc.)
409
410
411       -dependents
412              Equivalent to -deps.
413
414
415       -deps- Do  not  show a list of dependent files after processing.  (This
416              is the default.)
417
418
419       -dependents-
420              Equivalent to -deps-.
421
422
423       -deps-out=FILENAME
424              Set the filename to which the list of dependent files  is  writ‐
425              ten.   If  the  FILENAME argument is omitted or set to "-", then
426              the output is sent to stdout.
427
428              Use of this option also turns on the output of the list  of  de‐
429              pendent files after processing.
430
431
432       -dF    Dvi  file  filtering.   The  argument to this option is a filter
433              which will generate a  filtered  dvi  file  with  the  extension
434              ".dviF".   All  extra processing (e.g. conversion to postscript,
435              preview, printing) will then be performed on this  filtered  dvi
436              file.
437
438              Example usage: To use dviselect to select only the even pages of
439              the dvi file:
440
441                   latexmk -dF "dviselect even" foo.tex
442
443
444       -diagnostics
445              Print detailed diagnostics during a run.  This may help for  de‐
446              bugging  problems  or to understand latexmk's behavior in diffi‐
447              cult situations.
448
449
450       -dir-report
451              For each .tex file processed, list the settings for aux and  out
452              directories,  after  they have been normalized from the settings
453              specified during initialization.  See  the  description  of  the
454              variable $aux_out_dir_report for more details.
455
456
457       -dir-report-
458              Do  not  report  the settings for aux and out directories.  (De‐
459              fault)
460
461
462       -dvi   Generate dvi version of document using latex.
463
464
465       -dvilua
466              Generate dvi version of document using lualatex instead  of  la‐
467              tex.
468
469
470       -dvi-  Turn  off  generation of dvi version of document.  (This may get
471              overridden, if some other file is made (e.g., a .ps  file)  that
472              is  generated  from the dvi file, or if no generated file at all
473              is requested.)
474
475
476       -dvilualatex="COMMAND"
477              This sets the string specifying the command to run dvi lualatex.
478              It  behaves  like  the  -pdflatex  option, but sets the variable
479              $dvilualatex.
480
481              Note: This option when provided with the COMMAND  argument  only
482              sets  the  command for invoking dvilualatex; it does not turn on
483              the use of dvilualatex. That is done by other options or  in  an
484              initialization file.
485
486
487       -e <code>
488              Execute  the  specified  initialization  code before processing.
489              The code is Perl code of the same form as is used  in  latexmk's
490              initialization  files.  For more details, see the information on
491              the -r option, and the section about  "Configuration/initializa‐
492              tion  (RC)  files".  The code is typically a sequence of assign‐
493              ment statements separated by semicolons.
494
495              The code is executed when the -e option  is  encountered  during
496              latexmk's  parsing of its command line.  See the -r option for a
497              way of executing initialization code from a file.  An error  re‐
498              sults  in latexmk stopping.  Multiple instances of the -r and -e
499              options can be used, and they are executed in the order they ap‐
500              pear on the command line.
501
502              Some care is needed to deal with proper quoting of special char‐
503              acters in the code on the command line.   For  example,  suppose
504              you  want  to set the latex command to use its -shell-escape op‐
505              tion, then under UNIX/Linux you could use the line
506
507                   latexmk -e '$latex=q/latex %O -shell-escape %S/' file.tex
508
509              Note that the single  quotes  block  normal  UNIX/Linux  command
510              shells  from  treating  the characters inside the quotes as spe‐
511              cial.  (In this example, the q/.../ construct is  a  Perl  idiom
512              equivalent  to  using  single quotes.  This avoids the complica‐
513              tions of getting a quote  character  inside  an  already  quoted
514              string  in  a  way that is independent of both the shell and the
515              operating-system.)
516
517              The above command line  will  NOT  work  under  MS-Windows  with
518              cmd.exe  or  command.com  or 4nt.exe.  For MS-Windows with these
519              command shells you could use
520
521                   latexmk -e "$latex=q/latex %O -shell-escape %S/" file.tex
522
523              or
524
525                   latexmk -e "$latex='latex %O -shell-escape %S'" file.tex
526
527              The last two examples will  NOT  work  with  UNIX/Linux  command
528              shells.
529
530              (Note:  the above examples show are to show how to use the -e to
531              specify initialization code to be executed.  But the  particular
532              effect can be achieved also by the use of the -latex option with
533              less problems in dealing with quoting.)
534
535
536       -emulate-aux-dir
537              Emulate the use of an aux directory instead of leaving it to the
538              *latex  programs to do it.  (MiKTeX supports -aux-directory, but
539              TeXLive doesn't.)
540
541              See the section AUXILIARY AND OUTPUT DIRECTORIES  for  more  de‐
542              tails.
543
544
545       -emulate-aux-dir-
546              Turn off emulation to implement an aux directory and leave it to
547              the *latex program to handle the case that the aux directory  is
548              different  from  the  output  directory.   Note  that if you use
549              TeXLive, which doesn't support -aux-directory, latexmk will  au‐
550              tomatically  switch  aux_dir emulation on after the first run of
551              *latex, because it will find the .log file in the wrong place.
552
553
554       -f     Force latexmk to continue document  processing  despite  errors.
555              Normally, when latexmk detects that LaTeX or another program has
556              found an error which will not be resolved by further processing,
557              no further processing is carried out.
558
559              Note:  "Further  processing" means the running of other programs
560              or the rerunning of latex (etc) that would be done if no  errors
561              had  occurred.   If instead, or additionally, you want the latex
562              (etc) program not to pause for user input after  an  error,  you
563              should  arrange this by an option that is passed to the program,
564              e.g., by latexmk's option  -interaction=nonstopmode  (which  la‐
565              texmk passes to *latex).
566
567
568       -f-    Turn off the forced processing-past-errors such as is set by the
569              -f option.  This could be used to override a setting in  a  con‐
570              figuration file.
571
572
573       -g     Force  latexmk  to process document fully, even under situations
574              where latexmk would normally  decide  that  no  changes  in  the
575              source  files have occurred since the previous run.  This option
576              is useful, for example, if you change some options and  wish  to
577              reprocess the files.
578
579
580       -g-    Turn off -g.
581
582
583       -gg    "Super go mode" or "clean make": clean out generated files as if
584              -C had been given, and then do a regular make.
585
586
587       -h or-non-help
588              Print help information.
589
590
591       -jobname=STRING
592              Set the basename of output files(s) to STRING,  instead  of  the
593              default,  which  is the basename of the specified TeX file.  (At
594              present, STRING should not contain spaces.)
595
596              This is like the same option for current implementations of  the
597              *latex, and the passing of this option to these programs is part
598              of latexmk's implementation of -jobname.
599
600              There is one enhancement, that the STRING may contain the place‐
601              holder '%A'. This will be substituted by the basename of the TeX
602              file.  The primary purpose is when multiple files are  specified
603              on  the  command  line to latexmk, and you wish to use a jobname
604              with a different file-dependent value for each file.  For  exam‐
605              ple, suppose you had .tex files test1.tex and test2.tex, and you
606              wished to compare the results of compilation by *latex and those
607              with xelatex.  Then under a unix-type operating system you could
608              use the command line
609
610                  latexmk -pdf -jobname=%A-pdflatex *.tex
611                  latexmk -pdfxe -jobname=%A-xelatex *.tex
612
613              Then the .aux, .log, and .pdf files from  the  use  of  pdflatex
614              would  have  basenames  test1-pdflatex and test2-pdflatex, while
615              from xelatex, the basenames would be test1-xelatex and test2-xe‐
616              latex.
617
618              Under MS-Windows with cmd.exe, you would need to double the per‐
619              cent sign, so that the percent character is  passed  to  latexmk
620              rather than being used to substitute an environment variable:
621
622                  latexmk -pdf -jobname=%%A-pdflatex *.tex
623                  latexmk -pdfxe -jobname=%%A-xelatex *.tex
624
625
626       -l     Run in landscape mode, using the landscape mode for the preview‐
627              ers and the dvi to postscript converters.  This  option  is  not
628              normally  needed nowadays, since current previewers normally de‐
629              termine this information automatically.
630
631
632       -l-    Turn off -l.
633
634
635       -latex This sets the generation of dvi files by latex,  and  turns  off
636              the generation of pdf and ps files.
637
638              Note:  to  set the command used when latex is specified, see the
639              -latex="COMMAND" option.
640
641
642       -latex="COMMAND"
643              This sets the string specifying the command to run latex, and is
644              typically  used  to  add desired options.  Since the string nor‐
645              mally contains spaces, it should be quoted, e.g.,
646
647                   latexmk -latex="latex --shell-escape %O %S"  foo.tex
648
649              The specification of the contents of the string are the same  as
650              for  the $latex configuration variable.  Depending on your oper‐
651              ating system and the command-line shell you are using,  you  may
652              need  to change the single quotes to double quotes (or something
653              else).
654
655              Note: This option when provided with the COMMAND  argument  only
656              sets the command for invoking latex; it does not turn on the use
657              of latex. That is done by other options or in an  initialization
658              file.
659
660              To set the command for running pdflatex (rather than the command
661              for latex) see the -pdflatex option.
662
663
664       -logfilewarninglist
665              -logfilewarnings After a run of *latex, give a list of  warnings
666              about  undefined citations and references (unless silent mode is
667              on).
668
669              See also the $silence_logfile_warnings configuration variable.
670
671
672       -logfilewarninglist-
673              -logfilewarnings- After a run of *latex, do not give a  list  of
674              warnings about undefined citations and references.  (Default)
675
676              See also the $silence_logfile_warnings configuration variable.
677
678
679       -lualatex
680              Use  lualatex.   That  is,  use  lualatex  to process the source
681              file(s) to pdf.  The generation of dvi and postscript  files  is
682              turned off.
683
684              This option is equivalent to using the following set of options
685
686                   -pdflua -dvi- -ps-
687
688              (Note:  Note  that  the method of implementation of this option,
689              but not its intended effect, differ from some  earlier  versions
690              of latexmk.)
691
692
693       -lualatex="COMMAND"
694              This sets the string specifying the command to run lualatex.  It
695              behaves like the -pdflatex option, but sets the variable $luala‐
696              tex.
697
698              Note:  This  option when provided with the COMMAND argument only
699              sets the command for invoking lualatex; it does not turn on  the
700              use of lualatex. That is done by other options or in an initial‐
701              ization file.
702
703
704       -M     Show list of dependent files after processing.  This is  equiva‐
705              lent to the -deps option.
706
707
708       -MF file
709              If  a  list of dependents is made, the -MF specifies the file to
710              write it to.
711
712
713       -MP    If a list of dependents is made, include a phony target for each
714              source  file.  If you use the dependents list in a Makefile, the
715              dummy rules work around errors the program make gives if you re‐
716              move header files without updating the Makefile to match.
717
718
719       -makeindexfudge
720              Turn  on the change-directory fudge for makeindex.  See documen‐
721              tation of $makeindex_fudge for details.
722
723
724       -makeindexfudge-
725              Turn off the change-directory fudge for makeindex.  See documen‐
726              tation of $makeindex_fudge for details.
727
728
729       -MSWinBackSlash
730              This option only has an effect when latexmk is running under MS-
731              Windows.  This is that when latexmk runs a command under MS-Win‐
732              dows,  the  Windows  standard directory separator "\" is used to
733              separate directory components in a file name.   Internally,  la‐
734              texmk  uses  "/" for the directory separator character, which is
735              the character used by Unix-like systems.
736
737              This is the default behavior.  However the default may have been
738              overridden  by  a configuration file (latexmkrc file) which sets
739              $MSWin_back_slash=0.
740
741
742       -MSWinBackSlash-
743              This option only has an effect when latexmk is running under MS-
744              Windows.  This is that when latexmk runs a command under MS-Win‐
745              dows, the substitution of "\" for the  separator  character  be‐
746              tween  directory  components of a file name is not done. Instead
747              the forward slash "/" is used, the same as on Unix-like systems.
748              This is acceptable in most situations under MS-Windows, provided
749              that filenames are properly quoted, as latexmk does by default.
750
751              See   the   documentation   for   the   configuration   variable
752              $MSWin_back_slash for more details.
753
754
755       -new-viewer
756              When  in  continuous-preview  mode, always start a new viewer to
757              view the generated file.  By default, latexmk will, in  continu‐
758              ous-preview  mode,  test  for a previously running previewer for
759              the same file and not start a new one if a previous previewer is
760              running.  However, its test sometimes fails (notably if there is
761              an already-running previewer that is viewing a file of the  same
762              name  as  the current file, but in a different directory).  This
763              option turns off the default behavior.
764
765
766       -new-viewer-
767              The inverse of the -new-viewer option.  It puts latexmk  in  its
768              normal behavior that in preview-continuous mode it checks for an
769              already-running previewer.
770
771
772       -nobibtex
773              Never run bibtex or biber.  Equivalent to the -bibtex- option.
774
775
776       -nobibtexfudge or -nobibfudge
777              Turn off the change-directory fudge for bibtex.  See  documenta‐
778              tion of $bibtex_fudge for details.
779
780
781       -noemulate-aux-dir
782              Turn aux_dir emulation off.  Same as -emulate-aux-dir-.
783
784
785       -nomakeindexfudge
786              Turn off the change-directory fudge for makeindex.  See documen‐
787              tation of $makeindex_fudge for details.
788
789
790       -norc  Turn off the automatic reading of initialization (rc) files.
791
792              N.B. Normally the initialization files are read and obeyed,  and
793              then  command  line options are obeyed in the order they are en‐
794              countered.  But -norc is an exception to this rule: it is  acted
795              on first, no matter where it occurs on the command line.
796
797
798       -outdir=FOO or -output-directory=FOO
799
800              Sets the directory for the output files of *latex.
801
802              If the aux directory is not set or is the same as the output di‐
803              rectory, then all output files of *latex are sent to the  output
804              directory.
805
806              If the aux directory is set, e.g., by the option -auxdir, and is
807              not equal to the output directory, then only final output  files
808              (.dvi,  .ps, .pdf, .synctex, .synctex.gz) are sent to the output
809              directory. Other generated files are sent to the aux directory.
810
811              See the section AUXILIARY AND OUTPUT DIRECTORIES  for  more  de‐
812              tails.
813
814
815       -output-format=FORMAT
816              This  option  is  one  that  is allowed for latex, lualatex, and
817              pdflatex. But it is not passed to these programs.   Instead  la‐
818              texmk  emulates  it in a way suitable for the context of latexmk
819              and its workflows.
820
821              If FORMAT is dvi, then dvi output is turned on,  and  postscript
822              and  pdf  output are turned off. This is equivalent to using the
823              options -dvi -ps- -pdf-.
824
825              If FORMAT is pdf, then pdf output is  turned  on,  and  dvi  and
826              postscript  output  are  turned off. This is equivalent to using
827              the options -pdf -ps- -dvi-.
828
829              If FORMAT is anything else, latexmk gives an error.
830
831
832       -p     Print out the document.  By default the file to  be  printed  is
833              the  first  in the list postscript, pdf, dvi that is being made.
834              But you can use the -print=... option to change the type of file
835              to be printed, and you can configure this in a start up file (by
836              setting the $print_type variable).
837
838              However, printing is enabled by default  only  under  UNIX/Linux
839              systems, where the default is to use the lpr command and only on
840              postscript files.  In general, the correct behavior for printing
841              very much depends on your system's software.  In particular, un‐
842              der MS-Windows you must have suitable program(s) available,  and
843              you  must  have  configured  the print commands used by latexmk.
844              This can be non-trivial.  See the  documentation  on  the  $lpr,
845              $lpr_dvi, and $lpr_pdf configuration variables to see how to set
846              the commands for printing.
847
848              This option is incompatible with the -pv and -pvc options, so it
849              turns them off.
850
851
852       -pdf   Generate  pdf  version of document using pdflatex.  (If you wish
853              to use lualatex or xelatex, you can use whichever of the options
854              -pdflua,  -pdfxe,  -lualatex or -xelatex applies.)  To configure
855              latexmk to have such behavior by default,  see  the  section  on
856              "Configuration/initialization (rc) files".
857
858
859       -pdfdvi
860              Generate  dvi file and then pdf version of document from the dvi
861              file, by default using dvipdf.
862
863              The program used to compile the document to dvi is latex by  de‐
864              fault,  but  this can be changed to dvilulatex by the use of the
865              -dvilua option or by setting $dvi_mode to 2.
866
867
868       -pdflua
869              Generate pdf version of document using lualatex.
870
871
872       -pdfps Generate dvi file, ps file from the dvi file,  and then pdf file
873              from the ps file.
874
875              The  program used to compile the document to dvi is latex by de‐
876              fault, but this can be changed to dvilulatex by the use  of  the
877              -dvilua option or by setting $dvi_mode to 2.
878
879
880       -pdfxe Generate  pdf  version  of document using xelatex.  Note that to
881              optimize processing time, latexmk uses xelatex  to  generate  an
882              .xdv  file rather than a pdf file directly.  Only after possibly
883              multiple runs to generate a fully up-to-date .xdv file does  la‐
884              texmk then call xdvipdfmx to generate the final .pdf file.
885
886              (Note:  The  reason  why latexmk arranges for xelatex to make an
887              .xdv file instead of the xelatex's default of a .pdf file is  as
888              follows:  When the document includes large graphics files, espe‐
889              cially .png files, the production of a .pdf file  can  be  quite
890              time consuming, even when the creation of the .xdv file by xela‐
891              tex is fast.  So the use of the intermediate .xdv file  can  re‐
892              sult in substantial gains in procesing time, since the .pdf file
893              is produced once rather than on every run of xelatex.)
894
895
896       -pdf-  Turn off generation of pdf version of document.   (This  can  be
897              used  to override a setting in a configuration file.  It may get
898              overridden if some other option requires the generation of a pdf
899              file.)
900
901              If  after  all  options  have  been processed, pdf generation is
902              still turned off, then generation of a dvi file will  be  turned
903              on, and then the program used to compiled a document will be la‐
904              tex (or, more precisely, whatever program is  configured  to  be
905              used in the $latex configuration variable).
906
907
908       -pdflatex
909              This sets the generation of pdf files by pdflatex, and turns off
910              the generation of dvi and ps files.
911
912              Note: to set the command used when pdflatex  is  specified,  see
913              the -pdflatex="COMMAND" option.
914
915
916       -pdflatex="COMMAND"
917              This sets the string specifying the command to run pdflatex, and
918              is typically used to add desired options.  Since the string nor‐
919              mally contains spaces, it should be quoted, e.g.,
920
921                   latexmk  -pdf  -pdflatex="pdflatex  --shell-escape  %O  %S"
922              foo.tex
923
924              The specification of the contents of the string are the same  as
925              for the $pdflatex configuration variable.  (The option -pdflatex
926              in fact sets the variable $pdflatex.)  Depending on your operat‐
927              ing  system  and  the  command-line shell you are using, you may
928              need to change the single quotes to double quotes (or  something
929              else).
930
931              Note:  This  option when provided with the COMMAND argument only
932              sets the command for invoking pdflatex; it does not turn on  the
933              use of pdflatex. That is done by other options or in an initial‐
934              ization file.
935
936              To set the command for running latex (rather  than  the  command
937              for pdflatex) see the -latex option.
938
939
940       -pdflualatex="COMMAND"
941              Equivalent to -lualatex="COMMAND".
942
943
944       -pdfxelatex="COMMAND"
945              Equivalent to -xelatex="COMMAND".
946
947
948       -pretex=CODE
949
950              Given that CODE is some TeX code, this options sets that code to
951              be executed before inputting source file.  This  only  works  if
952              the command for invoking the relevant *latex is suitably config‐
953              ured.  See the documentation of the variable $pre_tex_code,  and
954              the  substitution  strings %P and %U for more details.  This op‐
955              tion works by setting the variable $pre_tex_code.
956
957              See also the -usepretex option.
958
959              An example:
960
961                  latexmk  -pretex='\AtBeginDocument{Message\par}'  -usepretex
962              foo.tex
963
964              But this is better written
965
966                  latexmk -usepretex='\AtBeginDocument{Message\par}' foo.tex
967
968              If you already have a suitable command configured, you only need
969
970                  latexmk -pretex='\AtBeginDocument{Message\par}' foo.tex
971
972
973       -print=dvi, -print=ps, -print=pdf, -print=auto,
974              Define  which kind of file is printed.  This option also ensures
975              that the requisite file is made, and turns on printing.
976
977              The (default) case -print=auto determines the kind of print file
978              automatically  from  the  set  of files that is being made.  The
979              first in the list postscript, pdf, dvi that is among  the  files
980              to be made is the one used for print out.
981
982
983       -ps    Generate postscript version of document.
984
985
986       -ps-   Turn off generation of postscript version of document.  This can
987              be used to override a setting in a configuration file.  (It  may
988              get  overridden  by some other option that requires a postscript
989              file, for example a request for printing.)
990
991
992       -pF    Postscript file filtering.  The argument to  this  option  is  a
993              filter  which  will generate a filtered postscript file with the
994              extension ".psF".  All extra processing (e.g. preview, printing)
995              will then be performed on this filtered postscript file.
996
997              Example of usage: Use psnup to print two pages on the one page:
998
999                   latexmk -ps -pF 'psnup -2' foo.tex
1000
1001              or
1002
1003                   latexmk -ps -pF "psnup -2" foo.tex
1004
1005              Whether to use single or double quotes round the "psnup -2" will
1006              depend on your command interpreter, as used  by  the  particular
1007              version of perl and the operating system on your computer.
1008
1009
1010       -pv    Run  file previewer.  If the -view option is used, that will se‐
1011              lect the kind of file to be previewed (.pdf, .ps or .dvi).  Oth‐
1012              erwise  the  viewer views the "highest" kind of output file that
1013              is made, with the ordering being .pdf, .ps, .dvi (high to  low).
1014              This  option is incompatible with the -p and -pvc options, so it
1015              turns them off.
1016
1017
1018       -pv-   Turn off -pv.
1019
1020
1021       -pvc   Run a file previewer  and  continually  update  the  .dvi,  .ps,
1022              and/or .pdf files whenever changes are made to source files (see
1023              the Description above).  Which of these files is  generated  and
1024              which  is  viewed  is  governed by the other options, and is the
1025              same as for the -pv option.  The preview-continuous option  -pvc
1026              can  only work with one file.  So in this case you will normally
1027              only specify one filename on the command line.  It is  also  in‐
1028              compatible  with  the  -p and -pv options, so it turns these op‐
1029              tions off.
1030
1031              The -pvc option also turns off force mode (-f), as  is  normally
1032              best  for  continuous  preview  mode.   If you really want force
1033              mode, use the options in the order -pvc -f.
1034
1035              With a good previewer the display will be automatically updated.
1036              (Under  some but not all versions of UNIX/Linux "gv -watch" does
1037              this for postscript files; this can be set  by  a  configuration
1038              variable.   This would also work for pdf files except for an ap‐
1039              parent bug in gv that causes an error when the newly updated pdf
1040              file is read.)  Many other previewers will need a manual update.
1041
1042              Important note: the acroread program on MS-Windows locks the pdf
1043              file, and prevents new versions being written, so it  is  a  bad
1044              idea  to  use  acroread  to view pdf files in preview-continuous
1045              mode.  It is better to use a different  viewer:  SumatraPDF  and
1046              gsview are good possibilities.
1047
1048              There  are  some  other methods for arranging an update, notably
1049              useful for many versions of xdvi and xpdf.  These are  best  set
1050              in latexmk's configuration; see below.
1051
1052              Note  that  if  latexmk  dies  or  is  stopped  by the user, the
1053              "forked" previewer will continue to run.  Successive invocations
1054              with  the  -pvc option will not fork new previewers, but latexmk
1055              will normally use the existing previewer.  (At least  this  will
1056              happen  when  latexmk is running under an operating system where
1057              it knows how to determine whether an existing previewer is  run‐
1058              ning.)
1059
1060
1061       -pvc-  Turn off -pvc.
1062
1063
1064       -pvctimeout
1065              Do  timeout  in pvc mode after period of inactivity, which is 30
1066              min. by default.  Inactivity means a period when latexmk has de‐
1067              tected  no file changes and hence has not taken any actions like
1068              compiling the document.
1069
1070
1071       -pvctimeout-
1072              Don't do timeout in pvc mode after inactivity.
1073
1074
1075       -pvctimeoutmins=<time>
1076              Set period of inactivity in minutes for pvc timeout.
1077
1078
1079       -quiet Same as -silent
1080
1081
1082       -r <rcfile>
1083              Read the specified initialization file ("RC file")  before  pro‐
1084              cessing.
1085
1086              Be careful about the ordering: (1) Standard initialization files
1087              -- see the section below on  "Configuration/initialization  (RC)
1088              files"  --  are read first.  (2) Then the options on the command
1089              line are acted on in the order they are given.  Therefore if  an
1090              initialization  file  is  specified by the -r option, it is read
1091              during this second step.  Thus an initialization file  specified
1092              with the -r option can override both the standard initialization
1093              files and previously specified options.  But all of these can be
1094              overridden by later options.
1095
1096              The contents of the RC file just comprise a piece of code in the
1097              Perl programming language (typically a  sequence  of  assignment
1098              statements); they are executed when the -r option is encountered
1099              during latexmk's parsing of its command line.  See the -e option
1100              for  a  way  of giving initialization code directly on latexmk's
1101              command line.  An error results in latexmk  stopping.   Multiple
1102              instances of the -r and -e options can be used, and they are ex‐
1103              ecuted in the order they appear on the command line.
1104
1105
1106       -rc-report
1107              After initialization, give a list of the  RC  files  read.  (De‐
1108              fault)
1109
1110
1111       -rc-report-
1112              After initialization, do not give a list of the RC files read.
1113
1114
1115       -recorder
1116              Give  the  -recorder  option with *latex.  In (most) modern ver‐
1117              sions of these programs, this results in  a  file  of  extension
1118              .fls  containing  a  list  of the files that these programs have
1119              read and written.  Latexmk will then use this  file  to  improve
1120              its detection of source files and generated files after a run of
1121              *latex.  This is the default setting of latexmk, unless overrid‐
1122              den in an initialization file.
1123
1124              For further information, see the documentation for the $recorder
1125              configuration variable.
1126
1127
1128       -recorder-
1129              Do not supply the -recorder option with *latex.
1130
1131
1132       -rules Show a list of latemk's rules and dependencies after processing.
1133
1134
1135       -rules-
1136              Do not show a list of latexmk's  rules  and  dependencies  after
1137              processing.  (This is the default.)
1138
1139
1140       -showextraoptions
1141              Show  the  list of extra *latex options that latexmk recognizes,
1142              but that it simply passes through to the programs  *latex   when
1143              they  are  run.   These options are (currently) a combination of
1144              those allowed by the TeXLive and MiKTeX implementations.  (If  a
1145              particular  option is given to latexmk but is not handled by the
1146              particular implementation of *latex that  is  being  used,  that
1147              program  will  probably  give a warning or an error.)  These op‐
1148              tions are very numerous, but are not listed in  this  documenta‐
1149              tion because they have no effect on latexmk's actions.
1150
1151              There  are a few options (e.g., -includedirectory=dir, -initial‐
1152              ize, -ini) that are not recognized, either  because  they  don't
1153              fit  with  latexmk's  intended  operations, or because they need
1154              special processing by latexmk that isn't implemented (at  least,
1155              not yet).
1156
1157              There  are  certain  options  for  *latex (e.g., -recorder) that
1158              trigger special actions or behavior by latexmk itself. Depending
1159              on  the  action,  they  may  also  be passed in some form to the
1160              called *latex program, and/or may affect other programs as well.
1161              These  options  do  have  entries  in this documentation.  Among
1162              these options are: -jobname=STRING, -aux-directory=dir, -output-
1163              directory=DIR, -quiet, and -recorder.
1164
1165              There  are also options that are accepted by *latex, but instead
1166              trigger actions purely by latexmk: -help, -version.
1167
1168
1169       -silent
1170              Run commands silently, i.e., with options that reduce the amount
1171              of  diagnostics  generated.   For example, with the default set‐
1172              tings, the command "latex -interaction=batchmode"  is  used  for
1173              latex, and similarly for its friends.
1174
1175              See  also  the  -logfilewarninglist and -logfilewarninglist- op‐
1176              tions.
1177
1178              Also reduce the number of informational  messages  that  latexmk
1179              itself generates.
1180
1181              To  change  the  options used to make the commands run silently,
1182              you need to configure latexmk with changed values of its config‐
1183              uration    variables,    the    relevant    ones   being   $bib‐
1184              tex_silent_switch, $biber_silent_switch,  $dvipdf_silent_switch,
1185              $dvips_silent_switch,      $dvilualatex_silent_switch,      $la‐
1186              tex_silent_switch,       $lualatex_silent_switch        $makein‐
1187              dex_silent_switch,     $pdflatex_silent_switch,    and    $xela‐
1188              tex_silent_switch
1189
1190
1191       -stdtexcmds
1192              Sets the commands for latex, etc, so that they are the  standard
1193              ones. This is useful to override special configurations.
1194
1195              The  result  is  that  $latex = 'latex %O %S', and similarly for
1196              $pdflatex, $lualatex, and $xelatex.  (The option -no-pdf  needed
1197              for $xelatex is provided automatically, given that %O appears in
1198              the definition.)
1199
1200
1201       -time  Show time used.  (On MS Windows, what is shown is clock time; on
1202              other  systems  CPU  time.)  See also the configuration variable
1203              $show_time.
1204
1205
1206       -time- Do not show time used.   See  also  the  configuration  variable
1207              $show_time.
1208
1209
1210       -use-make
1211              When  after  a  run  of *latex, there are warnings about missing
1212              files (e.g., as requested by the  LaTeX  \input,  \include,  and
1213              \includgraphics  commands), latexmk tries to make them by a cus‐
1214              tom dependency. If no relevant custom dependency with an  appro‐
1215              priate source file is found, and if the -use-make option is set,
1216              then as a last resort latexmk will try to use the  make  program
1217              to try to make the missing files.
1218
1219              Note  that  the  filename may be specified without an extension,
1220              e.g., by \includegraphics{drawing} in a  LaTeX  file.   In  that
1221              case,  latexmk  will try making drawing.ext with ext set in turn
1222              to the possible extensions that are relevant for  latex  (or  as
1223              appropriate pdflatex, lualatex, xelatex).
1224
1225              See  also  the documentation for the $use_make_for_missing_files
1226              configuration variable.
1227
1228
1229       -use-make-
1230              Do not use the make program to try to make missing files.   (De‐
1231              fault.)
1232
1233
1234       -usepretex
1235              Sets the command lines for latex, etc, so that they use the code
1236              that is defined by the variable $pre_tex_code or that is set  by
1237              the option -pretex=CODE to execute the specified TeX code before
1238              the source file is read.  This  option  overrides  any  previous
1239              definition of the command lines.
1240
1241              The  result  is  that  $latex = 'latex %O %P', and similarly for
1242              $pdflatex, $lualatex, and $xelatex.  (The option -no-pdf  needed
1243              for $xelatex is provided automatically, given that %O appears in
1244              the definition.)
1245
1246
1247       -usepretex=CODE
1248              Equivalent to -pretex=CODE -usepretex.  Example
1249
1250                latexmk -usepretex='\AtBeginDocument{Message\par}' foo.tex
1251
1252
1253       -v or -version
1254              Print version number of latexmk.
1255
1256
1257       -verbose
1258              Opposite of -silent.  This is the default setting.
1259
1260
1261       -view=default, -view=dvi, -view=ps, -view=pdf, -view=none
1262              Set the kind of file used when previewing is requested (e.g., by
1263              the -pv or -pvc switches).  The default is to view the "highest"
1264              kind of requested file (in  the  low-to-high  order  .dvi,  .ps,
1265              .pdf).
1266
1267              Note  the  possibility  -view=none  where no viewer is opened at
1268              all.  One example of is use is in conjunction with the -pvc  op‐
1269              tion,  when  you  want latexmk to do a compilation automatically
1270              whenever source file(s) change, but do not want a  previewer  to
1271              be opened.
1272
1273
1274       -Werror
1275              This  causes  latexmk to return a non-zero status code if any of
1276              the files processed gives a warning about  problems  with  cita‐
1277              tions  or references (i.e., undefined citations or references or
1278              about multiply defined references).  This is after  latexmk  has
1279              completed  all  the  runs it needs to try and resolve references
1280              and citations.  Thus -Werror causes latexmk to treat such  warn‐
1281              ings as errors, but only when they occur on the last run of *la‐
1282              tex and only after processing is complete.  Also can be  set  by
1283              the configuration variable $warnings_as_errors.
1284
1285
1286       -xdv   Generate xdv version of document using xelatex.
1287
1288
1289       -xelatex
1290              Use xelatex.  That is, use xelatex to process the source file(s)
1291              to pdf.  The generation of dvi and postscript  files  is  turned
1292              off.
1293
1294              This option is equivalent to using the following set of options
1295
1296                   -pdfxe -dvi- -ps-
1297
1298              [Note:  Note  that  the method of implementation of this option,
1299              but not its intended primary effect, differ  from  some  earlier
1300              versions  of latexmk. Latexmk first uses xelatex to make an .xdv
1301              file, and does all the extra runs  needed  (including  those  of
1302              bibtex,  etc).   Only  after that does it make the pdf file from
1303              the .xdv file, using xdvipdfmx.  See the documentation  for  the
1304              -pdfxe for why this is done.]
1305
1306
1307       -xelatex="COMMAND"
1308              This  sets the string specifying the command to run xelatex.  It
1309              sets the variable $xelatex.
1310
1311              Warning: It is important to ensure that the -no-pdf is used when
1312              xelatex  is invoked, since latexmk expects xelatex to produce an
1313              .xdv file, not a .pdf file. If you provide  %O  in  the  command
1314              specification,  this  will be done automatically.  See the docu‐
1315              mentation for the -pdfxe option for why  latexmk  makes  a  .xdv
1316              file rather than a .pdf file when xelatex is used.
1317
1318              An example of the use of the -pdfxelatex option:
1319
1320                   latexmk  -pdfxe  -pdfxelatex="xelatex --shell-escape %O %S"
1321              foo.tex
1322
1323              Note: This option when provided with the COMMAND  argument  only
1324              sets  the command for invoking lualatex; it does not turn on the
1325              use of lualatex. That is done by other options or in an initial‐
1326              ization file.
1327
1328
1329       Compatibility between options
1330
1331       The  preview-continuous option -pvc can only work with one file.  So in
1332       this case you will normally only specify one filename  on  the  command
1333       line.
1334
1335       Options  -p, -pv and -pvc are mutually exclusive.  So each of these op‐
1336       tions turns the others off.
1337
1338

EXAMPLES

1340       % latexmk thesis    # run latex enough times to resolve
1341                           cross-references
1342
1343       % latexmk -pvc -ps thesis# run latex enough times to resolve
1344                           cross-references, make a postscript
1345                           file, start a previewer.  Then
1346                           watch for changes in the source
1347                           file thesis.tex and any files it
1348                           uses.  After any changes rerun latex
1349                           the appropriate number of times and
1350                           remake the postscript file.  If latex
1351                           encounters an error, latexmk will
1352                           keep running, watching for
1353                           source file changes.
1354
1355       % latexmk -c        # remove .aux, .log, .bbl, .blg, .dvi,
1356                           .pdf, .ps & .bbl files
1357
1358
1359

DEALING WITH ERRORS, PROBLEMS, ETC

1361       Some possibilities:
1362
1363       a. If you get a strange error, do look carefully at the output that  is
1364       on  the  screen  and in log files.  While there is much that is notori‐
1365       ously verbose in the output of latex (and that is added to by latexmk),
1366       the  verbosity  is  there  for a reason: to enable the user to diagnose
1367       problems.  Latexmk does repeat some messages at the end of a  run  that
1368       it  thinks  would otherwise be easy to miss in the middle of other out‐
1369       put.
1370
1371       b. Generally, remember that latexmk does its work by running other pro‐
1372       grams.  Your first priority in dealing with errors should be to examine
1373       what went wrong with the individual programs.  Then you need to correct
1374       the  causes of errors in the runs of these programs.  (Often these come
1375       from errors in the source document, but they could also be about  miss‐
1376       ing LaTeX packages, etc.)
1377
1378       c. If latexmk doesn't run the programs the way you would like, then you
1379       need to look in this documentation at the list of command line  options
1380       and  then at the sections on configuration/initialization files.  A lot
1381       of latexmk's behavior is configurable to deal  with  particular  situa‐
1382       tions.  (But there is a lot of reading!)
1383
1384       The  remainder  of  these notes consists of ideas for dealing with more
1385       difficult situations.
1386
1387       d. Further tricks can involve replacing the standard commands that  la‐
1388       texmk runs by other commands or scripts.
1389
1390       e.  For possible examples of code for use in an RC file, see the direc‐
1391       tory  example_rcfiles  in  the  distribution  of  latexmk   (e.g.,   at
1392       http://mirror.ctan.org/support/latexmk/example_rcfiles).  Even if these
1393       examples don't do what you want, they may provide suitable inspiration.
1394
1395       f. There's a useful trick that can be used when you  use  lualatex  in‐
1396       stead  of  pdflatex  (and  in some related situations).  The problem is
1397       that latexmk won't notice a dependency on a file, bar.baz say, that  is
1398       input  by  the  lua code in your document instead of by the LaTeX part.
1399       (Thus if you change bar.baz and rerun latexmk, then latexmk will  think
1400       no  files have changed and not rerun lualatex, whereas if you had '\in‐
1401       put{bar.baz}' in the LaTeX part of the document, latexmk  would  notice
1402       the  change.)   One  solution is just to put the following somewhere in
1403       the LaTeX part of the document:
1404
1405                     \typeout{(bar.baz)}
1406
1407       This puts a line in the log file that latexmk will  treat  as  implying
1408       that  the file bar.baz was read.  (At present I don't know a way of do‐
1409       ing this automatically.)  Of course, if the file has a different  name,
1410       change bar.baz to the name of your file.
1411
1412       g. See also the section "Advanced Configuration: Some extra resources".
1413
1414       h.    Look   on   tex.stackexchange,   i.e.,   at   http://tex.stackex
1415       change.com/questions/tagged/latexmk  Someone may  have  already  solved
1416       your problem.
1417
1418       i. Ask a question at tex.stackexchange.com.
1419
1420       j.  Or ask me (the author of latexmk).  My e-mail is at the end of this
1421       documentation.
1422
1423
1424

AUXILIARY AND OUTPUT DIRECTORIES

1426       Running *latex and the associated programs generate a number of  files,
1427       it  is  often  convenient to arrange for the generated files to be in a
1428       different directory than the source file(s) of  a  document.   For  our
1429       purposes here, we identify two classes of generated file.
1430
1431       One class is what one may term the final output files, for example, the
1432       .pdf file generated by running pdflatex, or the .dvi file  from  latex.
1433       Also in this class is the ps file generated by applying dvips to a .dvi
1434       file. There are also .synctec or .synctex.gz files that can be used  by
1435       programs  that  display  .pdf files and the like to relate positions in
1436       them to positions in source files.
1437
1438       The second class of file is composed  of  all  other  generated  files:
1439       These  include  notably .aux files that are used for implementing cross
1440       referencing, and are both generated on one run and read on a later run.
1441       Many  packages  generate  yet  more such intermediate files, as well as
1442       programs like bibtex, makeindex, etc.  There are also .log  files  from
1443       *latex and corresponding files from other programs.
1444
1445       Let  us use the term "output directory" for the directory that receives
1446       the final output files, and "aux directory" for the directory  for  the
1447       other  generated files.  If no special options are provided to the *la‐
1448       tex programs, these directories default to the current  directory,  and
1449       then the generated files aren't segregated.  If the two directories are
1450       the same, as is the simplest situation, then all  generated  files  are
1451       written  to the same directory, and one often simply refers to the out‐
1452       put directory, without mentioning a separate aux directory.
1453
1454       Support for them is provided for them in the *latex  programs:  by  the
1455       single option -output-directory for the TeXLive implementations, and by
1456       the options -aux-directory and -output-directory for the MiKTeX  imple‐
1457       mentations.  Special support like this is needed for two reasons: First
1458       is that there are many packages that write files and it needs to be ar‐
1459       ranged  that  these are automatically written to the appropriate direc‐
1460       tory without any rewriting of the packages' code.  Second is  that  the
1461       files  are  often read in again on subsequent runs of *latex, and it is
1462       necessary that the program knows where to find the files.
1463
1464       A complication is that the TeXLive implementation does  not  allow  for
1465       separate  aux and output directories.  Latexmk deals with this by being
1466       able to emulating a separate aux directory: In this method  it  invokes
1467       *latex  with  just  an -output-directory option, with the directory set
1468       not to the desired output directory, but to the aux  directory.   After
1469       running  *latex,  it moves the relevant final output file(s) to the in‐
1470       tended output directory.  Emulation can be turned  on  by  setting  the
1471       configuration  variable  $emulate_aux to one in a configuration file or
1472       by using latexmk's -emulate-aux-dir option.  The emulation method works
1473       equally well if MiKTeX is used.
1474
1475       Latexmk  also  turns  emulation on if it is found to be needed, as fol‐
1476       lows.  Suppose emulation is initially off, but the aux and  output  di‐
1477       rectories  are different.  Then latexmk invokes *latex with an -aux-di‐
1478       rectory option and after the run finds that it hasn't been obeyed,  no‐
1479       tably  because the .log file is in the output directory rather than the
1480       aux directory.  Latexmk then sets emulation on, and retries.   Conceiv‐
1481       ably, it could move all the appropriate generated files from the output
1482       directory to the aux directory; but there is such a  large  variety  of
1483       possibilities for these files that this is hard to identify all of them
1484       reliably except for simple cases.
1485
1486       Note that the emulation issue only arises when the  user  has  arranged
1487       for  the  the aux and output directories to be different.  When instead
1488       they are equal, e.g., because the user only set the $out_dir  variable,
1489       then  latexmk  invokes  *latex  with  only an -output-directory option,
1490       which works as intended with both TeXLive and MiKTeX.
1491
1492       In addition, latexmk arranges the invocations of any auxiliary programs
1493       like bibtex and makeindex so that they will read and write the relevant
1494       files from and to the aux  directory.   Programs  like  dvips,  dvipdf,
1495       ps2pdf,  and xdvipdfmx are invoked so that they read from the appropri‐
1496       ate places and write their output to the output directory.
1497
1498       Files considered as final output files, i.e., those that belong in  the
1499       output  directory  rather than the aux directory: These have the exten‐
1500       sions .dvi, .ps., .pdf, .synctex, and .synctex.gz.  A special case, be‐
1501       cause of compatibility issues, is of .fls files: See below.
1502
1503       Note  that  xelatex  when  invoked  with its -no-pdf option, as latexmk
1504       does, generates an .xdv file, which would appear to have the same  sta‐
1505       tus  as  a  .dvi file generated by latex.  Nevertheless, latexmk treats
1506       .xdv as an intermediate file that is found in the aux directory.   This
1507       is  to  match MiKTeX's treatment of the -aux-directory option.  As fur‐
1508       ther justification, one can say that under modern  conditions  an  .xdv
1509       file is (almost) always an intermediate file.  Historically, the situa‐
1510       tion with .dvi files from latex was different, and currently  dvi  pre‐
1511       viewers do exist.
1512
1513
1514       Variables  and  options  for directories: The variables for setting the
1515       aux and output directories are $aux_dir and $out_dir, with  correspond‐
1516       ing  command  line  options -auxdir (or -aux-directory) and -outdir (or
1517       -output-directory).  When a value for these is blank (which is the  de‐
1518       fault  value),  it implies the use of a default: For the aux directory,
1519       the default is to set it equal to the output directory.  For the output
1520       directory, the default is to be the current directory.
1521
1522       For the turning on and off of the emulation mode, there is the configu‐
1523       ration variable $emulate_aux and the  options  -emulate-aux-dir,  -emu‐
1524       late-aux-dir-, -noemulate-aux-dir.
1525
1526
1527       Interaction with -cd option: When the -cd option is used (or the equiv‐
1528       alent setting of $do_cd variable), then latexmk changes the working di‐
1529       rectory  to  the document directory before invoking *latex.  If the aux
1530       and/or output directories are given by relative paths, e.g.,  by  -out‐
1531       dir=output  for  a  directory  named "output", then the directories are
1532       relative to the document directory, rather than relative to the working
1533       directory that was in effect when latexmk was invoked. This matches the
1534       behavior of *latex as invoked with the provided command line  directory
1535       argument(s)  after  the change of working directory to the document di‐
1536       rectory.
1537
1538       Automatic creation of aux and output directories: Unlike *latex, if la‐
1539       texmk  finds  the  requested  directory/ies  don't  exist,  it  creates
1540       it/them, thereby avoiding errors when *latex is invoked.
1541
1542       If the document uses the \include macro to read a .tex file from a sub‐
1543       directory, *latex will attempt to write an extra aux file to the corre‐
1544       sponding subdirectory  of  the  aux  directory.   If  the  subdirectory
1545       doesn't  exist,  then  *latex will complain that it can't write the aux
1546       file.  After the run of *latex, latexmk detects this situation, creates
1547       the  necessary  directory,  and  reruns *latex with the error situation
1548       corrected.
1549
1550       Choice of aux and output directories: Often the aux and output directo‐
1551       ries  are  given  as subdirectories of the document directory, e.g., by
1552       -outdir=output. But it is possible to provide, for example, an absolute
1553       path  or  a  path  relative  to a parent directory, e.g., "/tmp/foo" or
1554       "../output".  Be aware that in general this can cause problems, notably
1555       with  makeindex  or  bibtex.   This is because modern versions of these
1556       programs, by default, will refuse to work when they find that they  are
1557       asked to write to a file in a directory that appears not to be the cur‐
1558       rent working directory or one of its subdirectories.  This is  part  of
1559       security measures by the whole TeX system that try to prevent malicious
1560       or errant TeX documents from incorrectly messing with a user's files.
1561
1562       By default, latexmk evades this issue: Before running bibtex and  make‐
1563       index, latexmk changes working directory to the aux directory, with ap‐
1564       propriate settings of search paths.  The use or non-use of  this  trick
1565       is  governed  by the variables $bibtex_fudge and $makeindex_fudge.  Un‐
1566       fortunately, the trick sometimes makes bibtex and makeindex  unable  to
1567       find files.
1568
1569       If necessary the trick can be turned off. But this is incompatible with
1570       an aux directory like, "/tmp/foo" of "../output").  If you really  have
1571       to deal with this situation, and only if you have to deal with it, then
1572       you need to disable the security measures (and assume any risks).   One
1573       way of doing this is to temporarily set an operating system environment
1574       variable openout_any to "a" (as in  "all"),  to  override  the  default
1575       "paranoid" setting.
1576
1577       Certain  names  of  aux and output directories not allowed on Microsoft
1578       Windows: It is natural to want to use the name "aux" for the aux direc‐
1579       tory,  e.g., by using the option -auxdir=aux.  But on Microsoft operat‐
1580       ing systems "aux" is one of the names that is not allowed for a file or
1581       directory.   I  find  it  useful to standardize on a name like "auxdir"
1582       (e.g., by -auxdir=auxdir); this works independently of  operating  sys‐
1583       tem.
1584
1585       Location  of .fls file: Much of the dependency information that latexmk
1586       uses comes from the .fls file generated when *latex is invoked with the
1587       -recorder  option, which latexmk does by default.  It may seem rational
1588       that this is written to the aux directory.  But  in  fact  versions  of
1589       MiKTeX prior to Oct. 2020 wrote it to the output directory.  Later ver‐
1590       sions do write it to the aux directory.  To  deal  with  this,  latexmk
1591       does  two  things:  First, if latexmk finds that the .fls file has only
1592       been generated in the "wrong" directory, then latexmk copies it to  the
1593       expected directory, after which latexmk's operation continues correctly
1594       independently of the behavior of *latex. Second it allows its  idea  of
1595       the  "correct" (or expected) directory to be configured by the variable
1596       $fls_uses_aux_dir.  This defaults to zero, to  correspond  to  MiKTeX's
1597       current behavior.
1598
1599
1600

ALLOWING FOR CHANGE OF OUTPUT FILE TYPE

1602       When one of the latex engines is run, the usual situation is that latex
1603       produces a .dvi file, while pdflatex and lualatex produce a .pdf  file.
1604       For xelatex the default is to produce a .pdf file, but to optimize pro‐
1605       cessing time latexmk runs xelatex its -no-pdf option so  that  it  pro‐
1606       duces  an  .xdv  file.   Further  processing by latexmk takes this as a
1607       starting point.
1608
1609       However, the actual output file may differ from the normal expectation;
1610       and  then  latexmk can adjust its processing to accommodate this situa‐
1611       tion.  The difference in output file type can happen for  two  reasons:
1612       One  is  that  for latex, pdflatex and lualatex the document itself can
1613       override the defaults. The other is that there may be a  configuration,
1614       or misconfiguration, such that the program that latexmk invokes to com‐
1615       pile the document is not the expected one, or is given  options  incom‐
1616       patible with what latexmk initially expects.
1617
1618       Under  latex and pdflatex, control of the output format by the document
1619       is done by setting the \pdfoutput macro.  Under lualatex, the  \output‐
1620       mode macro is used instead.
1621
1622       One example of an important use-case for document control of the output
1623       format is a document that uses the psfrag package to  insert  graphical
1624       elements in the output file. The psfrag package achieves its effects by
1625       inserting postscript code in the output of the compilation of the docu‐
1626       ment.   This entails the use of compilation to a .dvi file, followed by
1627       the use of conversion to a postscript  file  (either  directly,  as  by
1628       dvips  or  implicitly,  as an intermediate step by dvipdf).  Then it is
1629       useful to force output to be of the .dvi format by  inserting  \pdfout‐
1630       put=0 in the preamble of the document.
1631
1632       Another  example  is where the document uses graphics file of the .pdf,
1633       .jpg, and png types.  With the default setting for the  graphicx  pack‐
1634       age,  these can be processed in compilation to .pdf but not with compi‐
1635       lation to .dvi.  In this case, it is useful to insert  \pdfoutput=1  in
1636       the  preamble  of the document to force compilation to .pdf output for‐
1637       mat.
1638
1639       In all of these cases, it is needed that latexmk has to adjust its pro‐
1640       cessing  to  deal with a mismatch between the actual output format (out
1641       of .pdf, .dvi, .xdv) and the initially expected  output,  if  possible.
1642       Latexmk does this provided the following conditions are met.
1643
1644       The first is that latexmk's $allow_switch configuration variable is set
1645       to a non-zero value as it is by default.  If this variable is  zero,  a
1646       mismatch of filetypes in the compilation results in an error.
1647
1648       The  second condition for latexmk to be able to handle a change of out‐
1649       put type is that no explicit requests for .dvi or .ps output files  are
1650       made.    Explicit  requests  are  by  the  -dvi  and  -ps,  -print=dvi,
1651       -print=ps, -view=dvi, and -view=ps options, and by  corresponding  set‐
1652       tings  of  the $dvi_mode, $postscript_mode, $print_type, and $view con‐
1653       figuration variables.  The print-type and view-type  restrictions  only
1654       apply when printing and viewing are explicitly requested, respectively.
1655       For this purpose, the use of the -pdfdvi and -pdfps  options  (and  the
1656       corresponding  setting  of the $pdf_mode variable) does not count as an
1657       explicit request for the .dvi and .ps files; they are  merely  regarded
1658       as  a  request for making a .pdf file together with an initial proposal
1659       for the processing route to make it.
1660
1661       Note that when accommodating a change in output file type, there is in‐
1662       volved  a  substantial change in the network of rules that latexmk uses
1663       in its actions.  The second condition applied to accommodate  a  change
1664       is to avoid situations where the change in the rule network is too rad‐
1665       ical to be readily handled automatically.
1666
1667
1668

CONFIGURATION/INITIALIZATION (RC) FILES

1670       In this section is explained which configuration files are read by  la‐
1671       texmk.  Subsequent  sections  "How  to  Set Variables in Initialization
1672       Files", "Format of  Command  Specifications",  "List  of  Configuration
1673       Variables  Usable  in Initialization Files", "Custom Dependencies", and
1674       "Advanced Configuration" give details on what  can  be  configured  and
1675       how.
1676
1677       Latexmk can be customized using initialization files, which are read at
1678       startup in the following order:
1679
1680       1) The system RC file, if it exists.
1681          On a UNIX system, latexmk searches the following directories for a
1682          system RC file, which may be named either "LatexMk" or  "latexmkrc".
1683       The
1684          directories are searched in the following order, and latexmk uses
1685          the first such file it finds (if any):
1686          "/etc",
1687          "/opt/local/share/latexmk",
1688          "/usr/local/share/latexmk",
1689          "/usr/local/lib/latexmk".
1690          On a MS-Windows system it looks just in "C:\latexmk".
1691          On  a cygwin system (i.e., a MS-Windows system in which Perl is that
1692       of cygwin), latexmk looks in the directories
1693          "/cygdrive/c/latexmk",
1694          "/etc",
1695          "/opt/local/share/latexmk",
1696          "/usr/local/share/latexmk",
1697          "/usr/local/lib/latexmk".
1698
1699       If the environment variable LATEXMKRCSYS is set, its value is  used  as
1700       the name of the system RC file, instead of any of the above.
1701
1702       2) The user's RC file, if it exists.  This can be in one of two places.
1703       The traditional one is ".latexmkrc" in the user's home directory.   The
1704       other  possibility  is "latexmk/latexmkrc" in the user's XDG configura‐
1705       tion home directory.  The actual file read is the first  of  "$XDG_CON‐
1706       FIG_HOME/latexmk/latexmkrc"  or  "$HOME/.latexmkrc" which exists.  (See
1707       https://specifications.freedesktop.org/basedir-spec/basedir-spec-lat
1708       est.html for details on the XDG Base Directory Specification.)
1709
1710       Here  $HOME  is  the  user's  home  directory.  [Latexmk determines the
1711       user's home directory as follows:  It is the value of  the  environment
1712       variable  HOME,  if this variable exists, which normally is the case on
1713       UNIX-like systems (including Linux and OS-X).  Otherwise  the  environ‐
1714       ment  variable USERPROFILE is used, if it exists, which normally is the
1715       case on MS-Windows systems. Otherwise a blank string is used instead of
1716       $HOME, in which case latexmk does not look for an RC file in it.]
1717
1718       $XDG_CONFIG_HOME  is  the  value  of  the environment variable XDG_CON‐
1719       FIG_HOME if it exists.  If this environment variable  does  not  exist,
1720       but  $HOME  is  non-blank,  then $XDG_CONFIG_HOME is set to the default
1721       value of $HOME/.config.  Otherwise $XDG_CONFIG_HOME is blank,  and  la‐
1722       texmk does not look for an RC file under it.
1723
1724
1725       3)  The  RC  file  in  the current working directory.  This file can be
1726       named either "latexmkrc" or ".latexmkrc", and the first of these to  be
1727       found is used, if any.
1728
1729       4) Any RC file(s) specified on the command line with the -r option.
1730
1731       Each RC file is a sequence of Perl commands.  Naturally, a user can use
1732       this in creative ways.  But for most purposes, one simply  uses  a  se‐
1733       quence of assignment statements that override some of the built-in set‐
1734       tings of Latexmk.  Straightforward cases can be handled without  knowl‐
1735       edge  of  the  Perl  language by using the examples in this document as
1736       templates.  Comment lines are introduced by the "#" character.
1737
1738       Note that command line options are obeyed in the order  in  which  they
1739       are written; thus any RC file specified on the command line with the -r
1740       option can override previous options but can be  itself  overridden  by
1741       later  options on the command line.  There is also the -e option, which
1742       allows initialization code to be specified in latexmk's command line.
1743
1744        For possible examples of code for in an RC file, see the directory ex‐
1745       ample_rcfiles  in  the  distribution  of  latexmk (e.g., at http://mir
1746       ror.ctan.org/support/latexmk/example_rcfiles).
1747
1748

HOW TO SET VARIABLES IN INITIALIZATION FILES

1750       The important variables that can be configured  are  described  in  the
1751       section  "List  of  configuration  variables  usable  in initialization
1752       files".  (See the earlier  section  "Configuration/Initialization  (rc)
1753       Files"  for  the  files where the configurations are done.)  Syntax for
1754       setting these variables is of the following forms:
1755
1756                           $bibtex = 'bibtex %O %S';
1757
1758       for the setting of a string variable,
1759
1760                           $preview_mode = 1;
1761
1762       for the setting of a numeric variable, and
1763
1764                           @default_files = ('paper', 'paper1');
1765
1766       for the setting of an array of strings.  It is possible  to  append  an
1767       item to an array variable as follows:
1768
1769                           push @default_files, 'paper2';
1770
1771       Note  that  simple  "scalar"  variables  have names that begin with a $
1772       character and array variables have names that begin with a @ character.
1773       Each statement ends with a semicolon.
1774
1775       Strings  should  be  enclosed  in single quotes.  (You could use double
1776       quotes, as in many programming languages.  But then the  Perl  program‐
1777       ming  language  brings  into  play some special rules for interpolating
1778       variables into strings.  People not fluent in Perl will want  to  avoid
1779       these complications.)
1780
1781       You  can do much more complicated things, but for this you will need to
1782       consult a manual for the Perl programming language.
1783
1784
1785
1786

FORMAT OF COMMAND SPECIFICATIONS

1788       Some of the variables set the commands that latexmk uses  for  carrying
1789       out  its  work, for example to generate a .dvi file from a .tex file or
1790       to view a postscript file.  This section describes some important  fea‐
1791       tures of how the commands are specified.  (Note that some of the possi‐
1792       bilities listed here do not apply to the $kpsewhich variable;  see  its
1793       documentation.)
1794
1795       Placeholders:  Supposed you wanted latexmk to use the command elatex in
1796       place of the regular latex  command,  and  suppose  moreover  that  you
1797       wanted  to  give  it the option "--shell-escape".  You could do this by
1798       the following setting:
1799
1800            $latex = 'elatex --shell-escape %O %S';
1801
1802       The two items starting with the % character  are  placeholders.   These
1803       are  substituted by appropriate values before the command is run.  Thus
1804       %S will be replaced by the source file that elatex will be applied  to,
1805       and  %O will be replaced by any options that latexmk has decided to use
1806       for this command.  (E.g., if you used the -silent option in the invoca‐
1807       tion  of  latexmk,   it  results in the replacement of %O by "-interac‐
1808       tion=batchmode".)
1809
1810       The available placeholders are:
1811
1812       %A     basename of the main tex file.  Unlike %R, this is unaffected by
1813              the setting of a jobname by  the -jobname option or the $jobname
1814              configuration value.
1815
1816       %B     base of filename for current command.   E.g.,  if  a  postscript
1817              file  document.ps  is being made from the dvi file document.dvi,
1818              then the basename is document.
1819
1820       %D     destination file (e.g., the name of  the  postscript  file  when
1821              converting a dvi file to postscript).
1822
1823       %O     options
1824
1825       %P     If  the  variable $pre_tex_code is non-empty, then %P is substi‐
1826              tuted  by  the  contents  of  $pre_tex_code  followed  by   \in‐
1827              put{SOURCE},  where  SOURCE  stands  for  the name of the source
1828              file.  Appropriate quoting is done.  This enables TeX code to be
1829              passed  to  one  of the *latex engines to be executed before the
1830              source file is read.
1831
1832              If the variable $pre_tex_code is the empty string,  then  %P  is
1833              equivalent to %S.
1834
1835       %R     root filename.  This is the base name for the main tex file.
1836
1837              By  default  this is the basename of the main tex file.  However
1838              the value can be changed by the use of the  -jobname  option  or
1839              the $jobname configuration variable.
1840
1841       %S     source  file  (e.g.,  the name of the dvi file when converting a
1842              .dvi file to ps).
1843
1844       %T     The name of the primary tex file.
1845
1846       %U     If the variable $pre_tex_code is non-empty, then  its  value  is
1847              substituted  for %U (appropriately quoted).  Otherwise it is re‐
1848              placed by a null string.
1849
1850       %Y     Name of directory for auxiliary output files (see the configura‐
1851              tion variable $aux_dir).  A directory separation character ('/')
1852              is appended if $aux_dir is non-empty and does not end in a suit‐
1853              able character, with suitable characters being those appropriate
1854              to UNIX and MS-Windows, i.e., ':', '/' and '\'.   Note  that  if
1855              after  initialization,  $out_dir is set, but $aux_dir is not set
1856              (i.e., it is blank), then latexmk  sets  $aux_dir  to  the  same
1857              value $out_dir.
1858
1859       %Z     Name  of directory for output files (see the configuration vari‐
1860              able $out_dir).  A directory separation character ('/')  is  ap‐
1861              pended  if  $out_dir is non-empty and does not end in a suitable
1862              character, with suitable characters being those  appropriate  to
1863              UNIX and MS-Windows, i.e., ':', '/' and '\'.
1864
1865       If  for  some  reason you need a literal % character in your string not
1866       subject to the above rules, use "%%".
1867
1868       Appropriate quoting will be applied to the filename  substitutions,  so
1869       you  mustn't  supply them yourself even if the names of your files have
1870       spaces in them.  (But if your TeX filenames have spaces in them, beware
1871       that  some  older  versions  of the TeX program cannot correctly handle
1872       filenames containing spaces.)  In case latexmk's quoting does not  work
1873       correctly  on your system, you can turn it off -- see the documentation
1874       for the variable $quote_filenames.
1875
1876       See the default values in the section "List of configuration  variables
1877       usable in initialization files" for what is normally the most appropri‐
1878       ate usage.
1879
1880       If you omit to supply any placeholders whatever in the specification of
1881       a  command,  latexmk will supply what its author thinks are appropriate
1882       defaults.  This gives compatibility with configuration files for previ‐
1883       ous versions of latexmk, which didn't use placeholders.
1884
1885       "Detaching"  a  command: Normally when latexmk runs a command, it waits
1886       for the command to run to completion.  This is appropriate for commands
1887       like latex, of course.  But for previewers, the command should normally
1888       run detached, so that latexmk gets the previewer running and  then  re‐
1889       turns  to  its next task (or exits if there is nothing else to do).  To
1890       achieve this effect of detaching a command, you  need  to  precede  the
1891       command name with "start ", as in
1892
1893            $dvi_previewer = 'start xdvi %O %S';
1894
1895       This  will  be translated to whatever is appropriate for your operating
1896       system.
1897
1898       Notes: (1) In some circumstances, latexmk will always run a command de‐
1899       tached.   This  is the case for a previewer in preview continuous mode,
1900       since otherwise previewing continuously makes no sense.  (2) This  pre‐
1901       cludes  the  possibility  of running a command named start.  (3) If the
1902       word start occurs more than  once  at  the  beginning  of  the  command
1903       string,  that is equivalent to having just one.  (4) Under cygwin, some
1904       complications happen, since cygwin amounts to a complicated merging  of
1905       UNIX  and  MS-Windows.   See  the  source code for how I've handled the
1906       problem.
1907
1908       Command names containing spaces: Under MS-Windows it is common that the
1909       name of a command includes spaces, since software is often installed in
1910       a subdirectory of "C:\Program Files".  Such command names should be en‐
1911       closed in double quotes, as in
1912
1913            $lpr_pdf  =  '"c:/Program  Files/Ghostgum/gsview/gsview32.exe"  /p
1914       %S';
1915            $pdf_previewer   =   'start   "c:/Program   Files/SumatraPDF/Suma‐
1916       traPDF.exe" %O %S';
1917            $pdf_previewer  =  'start "c:/Program Files/SumatraPDF (x86)/Suma‐
1918       traPDF.exe" %O %S';
1919
1920
1921       (Note about the above example: Under  MS-Windows  forward  slashes  are
1922       equivalent to backslashes in a filename under almost all circumstances,
1923       provided that the filename is inside double quotes.  It  is  easier  to
1924       use forward slashes in examples like the one above, since then one does
1925       not have to worry about the rules for dealing with forward  slashes  in
1926       strings in the Perl language.)
1927
1928       Command  names  under  Cygwin: If latexmk is executed by Cygwin's Perl,
1929       be particularly certain that pathnames in commands have forward slashes
1930       not  the  usual  backslashes  for the separator of pathname components.
1931       See the above examples.  Backslashes often get  misinterpreted  by  the
1932       Unix shell used by Cygwin's Perl to execute external commands.  Forward
1933       slashes don't suffer from this problem, and (when quoted, as above) are
1934       equally acceptable to MS-Windows.
1935
1936       Using  MS-Windows  file  associations: A useful trick under modern ver‐
1937       sions of MS-Windows (e.g., WinXP) is to use just the command 'start' by
1938       itself:
1939
1940            $dvi_previewer = 'start %S';
1941
1942       Under MS-Windows, this will cause to be run whatever program the system
1943       has associated with dvi files.  (The  same  applies  for  a  postscript
1944       viewer and a pdf viewer.)  But note that this trick is not always suit‐
1945       able for the pdf previwer, if your system has acroread for the  default
1946       pdf viewer.  As explained elsewhere, acroread under MS-Windows does not
1947       work well with latex and latexmk, because acroread locks the pdf file.
1948
1949       Not using a certain command: If a command is not to be run, the command
1950       name NONE is used, as in
1951
1952            $lpr  = 'NONE lpr';
1953
1954       This  typically  is  used when an appropriate command does not exist on
1955       your system.  The string after the "NONE" is effectively a comment.
1956
1957       Options to commands: Setting the name of a command can be used not only
1958       for changing the name of the command called, but also to add options to
1959       command.  Suppose you want latexmk to use latex  with  source  specials
1960       enabled.   Then  you  might use the following line in an initialization
1961       file:
1962
1963            $latex = 'latex --src-specials %O %S';
1964
1965       Running a subroutine instead of an external command: Use  a  specifica‐
1966       tion starting with "internal", as in
1967
1968            $latex = 'internal mylatex %O %S';
1969            sub mylatex {
1970                my @args = @_;
1971                # Possible preprocessing here
1972                return system 'latex', @args;
1973            }
1974
1975       For  some  of the more exotic possibilities that then become available,
1976       see the section "ADVANCED CONFIGURATION: Some extra resources  and  ad‐
1977       vanced  tricks".  Also  see some of the examples in the directory exam‐
1978       ple_rcfiles in the latexmk distribution.
1979
1980       Advanced tricks: Normally one specifies a single command for  the  com‐
1981       mands  invoked by latexmk.  Naturally, if there is some complicated ad‐
1982       ditional processing you need to do in your special situation,  you  can
1983       write a script (or batch file) to do the processing, and then configure
1984       latexmk to use your script in place of the standard program.
1985
1986       You can also use a Perl subroutine instead of a script  --  see  above.
1987       This is generally the most flexible and portable solution.
1988
1989       It is also possible to configure latexmk to run multiple commands.  For
1990       example, if when running pdflatex to generate a pdf  file  from  a  tex
1991       file you need to run another program after pdflatex to perform some ex‐
1992       tra processing, you could do something like:
1993
1994            $pdflatex = 'pdflatex --shell-escape  %O  %S;  pst2pdf_for_latexmk
1995       %B';
1996
1997       This  definition  assumes  you  are using a UNIX-like system (which in‐
1998       cludes Linux and OS-X), so that the two commands to be  run  are  sepa‐
1999       rated by the semicolon in the middle of the string.
2000
2001       If you are using MS-Windows, you would replace the above line by
2002
2003          $pdflatex = 'cmd /c pdflatex --shell-escape %O %S'
2004                      . '&& pst2pdf_for_latexmk %B';
2005
2006       Here,  the  UNIX  command  separator ; is replaced by &&.  In addition,
2007       there is a problem that some versions of Perl on MS-Windows do not obey
2008       the  command separator; this problem is overcome by explicitly invoking
2009       the MS-Windows command-line processor cmd.exe.
2010
2011

LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES

2013       In this section are specified the variables whose  values  can  be  ad‐
2014       justed  to  configure  latexmk.   (See  the earlier section "Configura‐
2015       tion/Initialization (rc) Files" for the files where the  configurations
2016       are done.)
2017
2018       Default values are indicated in brackets.  Note that for variables that
2019       are boolean in character, concerning whether latexmk does or  does  not
2020       behave  in a certain way, a non-zero value, normally 1, indicates true,
2021       i.e., the behavior occurs, while a zero value indicates a false  value,
2022       i.e., the behavior does not occur.
2023
2024
2025       $allow_switch [1]
2026
2027              This  controls  what happens when the output extension of latex,
2028              pdflatex, lualatex or xelatex differs  from  what  is  expected.
2029              (The possible extensions are .dvi, .pdf, .xdv.)  This can happen
2030              with the use of the \pdfoutput macro in a document compiled  un‐
2031              der  latex or pdflatex, or with the use of the \outputmode macro
2032              under lualatex.  It can also happen with certain kinds of incor‐
2033              rect configuration.
2034
2035              In  such a case, latexmk can appropriately adjust its network of
2036              rules.  The adjustment is made if $allow_switch is on, and if no
2037              request for a dvi or ps file has been made.
2038
2039              See the section ALLOWING FOR CHANGE OF OUTPUT EXTENSION.
2040
2041
2042       $always_view_file_via_temporary [0]
2043              Whether  .ps and .pdf files are initially to be made in a tempo‐
2044              rary directory and then moved to the final location.  (This  ap‐
2045              plies to dvips, dvipdf, and ps2pdf operations, and the filtering
2046              operators on .dvi and .ps files.  It does not apply to pdflatex,
2047              unfortunately,  since  pdflatex  provides no way of specifying a
2048              chosen name for the output file.)
2049
2050              This use of a temporary file solves a problem that the making of
2051              these files can occupy a substantial time.  If a viewer (notably
2052              gv) sees that the file has changed, it may read the new file be‐
2053              fore the program writing the file has not yet finished its work,
2054              which  can cause havoc.
2055
2056              See the $pvc_view_file_via_temporary variable for a setting that
2057              applies  only  if preview-continuous mode (-pvc option) is used.
2058              See $tmpdir for the setting of the directory where the temporary
2059              file is created.
2060
2061
2062       $analyze_input_log_always [1]
2063
2064              After  a run of latex (etc), always analyze .log for input files
2065              in the <...> and (...) constructions.  Otherwise,  only  do  the
2066              analysis when fls file doesn't exist or is out of date.
2067
2068              Under  normal  circumstances,  the data in the fls file is reli‐
2069              able, and the test of the log file gets lots of false positives;
2070              usually  $analyze_input_log_always is best set to zero.  But the
2071              test of the log file is needed at least in the following  situa‐
2072              tion:  When a user needs to persuade latexmk that a certain file
2073              is a source file, and latexmk doesn't otherwise find  it.   Then
2074              the  user  can  write  code  that causes a line with (...) to be
2075              written to log file.  One important case is for lualatex,  which
2076              doesn't  always  generate  lines  in the .fls file for input lua
2077              files.  (The situation with lualatex is  HIGHLY  version  depen‐
2078              dent,  e.g.,  there  was  a  big change between TeXLive 2016 and
2079              TeXLive 2017.)
2080
2081              To keep backward compatibility with older versions  of  latexmk,
2082              the default is to set $analyze_input_log_always to 1.
2083
2084
2085       $auto_rc_use [1]
2086              Whether  to  automatically read the standard initialization (rc)
2087              files, which are the system RC file, the user's RC file, and the
2088              RC file in the current directory.  The command line option -norc
2089              can be used to turn this setting off.  Each RC file co2uld  also
2090              turn  this  setting off, i.e., it could set $auto_rc_use to zero
2091              to prevent automatic reading of the later RC files.
2092
2093              This variable does not affect the reading of RC files  specified
2094              on the command line by the -r option.
2095
2096       $aux_dir [""]
2097              The  aux directory, i.e., the directory in which auxiliary files
2098              (aux, log, etc) are to be written by a run of *latex.
2099
2100              If this variable is not set, but $out_dir is set,  then  latexmk
2101              takes  the  aux directory to equal the output directory which is
2102              the directory to which final output files are to be written.
2103
2104              If neither variable is set, then the current directory when *la‐
2105              tex is invoked is used both for the aux and output directories.
2106
2107              If the aux and output directories are distinct, then the aux di‐
2108              rectory contains all generated files with the exception of  "fi‐
2109              nal  output  files",  which  are  defined to be .dvi, .ps, .pdf,
2110              .synctex, and .synctex.gz files.
2111
2112              See the section AUXILIARY AND OUTPUT DIRECTORIES  for  more  de‐
2113              tails.
2114
2115
2116
2117       $aux_out_dir_report [0]
2118              For  each primary .tex file processed, list the settings for aux
2119              and output directories, after they have been normalized from the
2120              settings specified during initialization.
2121
2122              This  report  gives  a  reminder  of where to look for generated
2123              files.
2124
2125              The report has to be done per primary .tex file, because of pos‐
2126              sible  directory  changes  for each file (when the -cd option is
2127              used).  In the simplest cases, the directory names are the  same
2128              as  originally  specified.  But in general some clean up/normal‐
2129              ization is performed; this helps performance and cleans up  out‐
2130              put to the screen.
2131
2132
2133
2134       $bad_warning_is_error [0]
2135              Whether  to treat bad warnings reported by *latex in log file as
2136              errors. The  specifications  of  the  warning  messages  are  in
2137              @bad_warnings.
2138
2139
2140       @bad_warnings
2141              Array  of  regular  expressions  specifying messages in log file
2142              that are officially treated as warnings rather  than  errors  by
2143              *latex,  but  which  a  user may treat as errors: See $bad_warn‐
2144              ing_is_error.
2145
2146              Currently the default set of these warnings is those about  \end
2147              occuring inside constructs.
2148
2149
2150       $banner [0]
2151              If  nonzero, the banner message is printed across each page when
2152              converting the dvi file to postscript.   Without  modifying  the
2153              variable  $banner_message,  this is equivalent to specifying the
2154              -d option.
2155
2156              Note that if $banner is nonzero, the $postscript_mode is assumed
2157              and the postscript file is always generated, even if it is newer
2158              than the dvi file.
2159
2160       $banner_intensity [0.95]
2161              Equivalent to the -bi option, this is a decimal number between 0
2162              and  1 that specifies how dark to print the banner message. 0 is
2163              black, 1 is white.  The default is just right if your toner car‐
2164              tridge isn't running too low.
2165
2166       $banner_message ["DRAFT"]
2167              The banner message to print across each page when converting the
2168              dvi file to postscript.  This is equivalent to the -bm option.
2169
2170       $banner_scale [220.0]
2171              A decimal number that specifies how  large  the  banner  message
2172              will  be printed.  Experimentation is necessary to get the right
2173              scale for your message, as a rule of thumb the scale  should  be
2174              about  equal  to 1100 divided by the number of characters in the
2175              message.  The Default is just right for  5  character  messages.
2176              This is equivalent to the -bs option.
2177
2178       @BIBINPUTS
2179              This  is  an array variable, now mostly obsolete, that specifies
2180              directories where latexmk should look for .bib  files.   By  de‐
2181              fault  it  is set from the BIBINPUTS environment variable of the
2182              operating system.  If that environment variable is  not  set,  a
2183              single  element list consisting of the current directory is set.
2184              The format of the directory names depends on your operating sys‐
2185              tem, of course.  Examples for setting this variable are:
2186
2187                      @BIBINPUTS = ( ".", "C:\\bibfiles" );
2188                      @BIBINPUTS = ( ".", "\\server\bibfiles" );
2189                      @BIBINPUTS = ( ".", "C:/bibfiles" );
2190                      @BIBINPUTS = ( ".", "//server/bibfiles" );
2191                      @BIBINPUTS = ( ".", "/usr/local/texmf/bibtex/bib" );
2192
2193              Note  that  under  MS  Windows,  either a forward slash "/" or a
2194              backward slash "\" can be used to separate pathname  components,
2195              so  the  first  two  and the second two examples are equivalent.
2196              Each backward slash should be doubled to avoid running afoul  of
2197              Perl's  rules for writing strings. Generally, it is simplest al‐
2198              ways to use forward slashes instead of backward slashes.
2199
2200              Important note: This variable is now mostly obsolete in the cur‐
2201              rent  version  of  latexmk, since it now uses a better method of
2202              searching for files using the kpsewhich  command.   However,  if
2203              your system is an unusual one without the kpsewhich command, you
2204              may need to set the variable @BIBINPUTS.
2205
2206
2207       $biber ["biber %O %S"]
2208              The biber processing program.
2209
2210
2211       $biber_silent_switch ["--onlylog"]
2212              Switch(es) for the biber processing program when silent mode  is
2213              on.
2214
2215       $bibtex ["bibtex %O %S"]
2216              The BibTeX processing program.
2217
2218       $bibtex_fudge [1]
2219              When  using  bibtex, whether to change directory to $aux_dir be‐
2220              fore running bibtex.
2221
2222              The need arises as follows:
2223
2224              a. With bibtex before about 2019, if the filename  given  to  it
2225              contains a path component, there was a bug that bibtex would not
2226              find extra aux files, as produced by  the  \include  command  in
2227              TeX.
2228
2229              b.  With  all  moderately  recent versions of bibtex, bibtex may
2230              refuse to write its bbl and blg files, for security reasons, for
2231              certain cases of the path component of the filename given to it.
2232
2233              However,  there  are  also rare cases where the change-directory
2234              method prevents bibtex from finding certain bib  or  bst  files.
2235              Then $bibtex_fudge needs to be set to 0.
2236
2237
2238       $bibtex_silent_switch ["-terse"]
2239              Switch(es) for the BibTeX processing program when silent mode is
2240              on.
2241
2242
2243       $bibtex_use [1]
2244              Under what conditions to run bibtex or biber.  When latexmk dis‐
2245              covers  from the log file that one (or more) bibtex/biber-gener‐
2246              ated bibliographies are used, it can run bibtex or  biber  when‐
2247              ever  it  appears  necessary  to regenerate the bbl file(s) from
2248              their source bib  database  file(s).   But  sometimes,  the  bib
2249              file(s) are not available (e.g., for a document obtained from an
2250              external archive), but the bbl files are provided.  In that case
2251              use  of  bibtex or biber will result in incorrect overwriting of
2252              the precious  bbl  files.   The  variable  $bibtex_use  controls
2253              whether  this  happens,  and  also  controls whether or not .bbl
2254              files are deleted in a cleanup operation.
2255
2256              The possible values of $bibtex_use are:
2257                0: never use bibtex or biber; never delete  .bbl  files  in  a
2258              cleanup.
2259                1: only use bibtex if the bib file(s) exist; never delete .bbl
2260              files in a cleanup.
2261                1.5: only use bibtex if the  bib  files  exist;  conditionally
2262              delete  .bbl files in a cleanup (i.e., delete them only when the
2263              bib files all exist).
2264                2: run bibtex or biber whenever it appears necessary to update
2265              the  bbl  file(s),  without testing for the existence of the bib
2266              files; always delete .bbl files in a cleanup.
2267
2268
2269       $cleanup_includes_cusdep_generated [0]
2270              If nonzero, specifies that cleanup also deletes files  that  are
2271              generated by custom dependencies.  (When doing a clean up, e.g.,
2272              by use of the -C option, custom dependencies are those listed in
2273              the .fdb_latexmk file from a previous run.)
2274
2275
2276       $cleanup_includes_generated [0]
2277              If  nonzero,  specifies that cleanup also deletes files that are
2278              detected in the fls file (or failing that, in log file) as being
2279              generated.   It  will  also  include files made from these first
2280              generation generated files.
2281
2282              This operation is somewhat dangerous, and  can  have  unintended
2283              consequences,  since the files to be deleted are determined from
2284              a file created by *latex, which can contain  erroneous  informa‐
2285              tion. Therefore this variable is turned off by default, and then
2286              files to be deleted are restricted to those explicitly specified
2287              by    patterns    configured   in   the   variables   clean_ext,
2288              clean_full_ext, and @generated_exts.  Standard cases (e.g., .log
2289              files)  appear  in latexmk's initial value for the array @gener‐
2290              ated_exts.
2291
2292       $cleanup_mode [0]
2293              If nonzero, specifies cleanup mode: 1 for full  cleanup,  2  for
2294              cleanup  except  for .dvi, .ps and .pdf files, 3 for cleanup ex‐
2295              cept for dep and aux files.  (There is also  extra  cleaning  as
2296              specified by the $clean_ext, $clean_full_ext and @generated_exts
2297              variables.)
2298
2299              This variable is equivalent to specifying one of the  -c  or  -C
2300              options.   But there should be no need to set this variable from
2301              an RC file.
2302
2303       $clean_ext [""]
2304              Extra extensions of files for latexmk to remove when any of  the
2305              clean-up  options  (-c  or  -C)  is selected.  The value of this
2306              variable is a string containing the extensions separated by spa‐
2307              ces.
2308
2309              It is also possible to specify a more general pattern of file to
2310              be deleted, by using the place holder %R, as in commands, and it
2311              is also possible to use wildcards.  Thus setting
2312
2313                  $clean_ext  =  "out  %R-blx.bib  %R-figures*.log  pythontex-
2314              files-%R/*";
2315
2316              in an initialization file will imply that when a clean-up opera‐
2317              tion  is  specified,  not  only  is  the  standard  set of files
2318              deleted, but also files of the form FOO.out,  FOO-blx.bib,  FOO-
2319              figures*.log,  and  pythontex-files-FOO/*,  where FOO stands for
2320              the basename of the file being processed (as in FOO.tex).
2321
2322              Most of the files to be deleted are relative  to  the  directory
2323              specified  by  $aux_dir.  Note that if $out_dir but not $aux_dir
2324              is set, then in its initialization, latexmk sets $aux_dir  equal
2325              to  $out_dir.   A  normal  situation  is therefore that $aux_dir
2326              equals $out_dir, which is the only case  directly  supported  by
2327              TeXLive,  unlike  MiKTeX.   Note  that even with TeXLive latexmk
2328              does now support different values for the directories -- see the
2329              explanation of the $emulate_aux variable.
2330
2331              If $out_dir and $aux_dir different, latexmk actually deletes any
2332              files of the specified names in both $aux_dir and $out_dir; this
2333              is  because under certain error conditions, the files may be put
2334              in $out_dir instead of $aux_dir.  This also handles the case  of
2335              deleting any fls file, since that file is in $out_dir.
2336
2337              The  filenames  specified for a clean-up operation can refer not
2338              only to regular files but also to directories.  Directories  are
2339              only deleted if they are empty.  An example of an application is
2340              to pythontex, which creates files  in  a  particular  directory.
2341              You  can  arrange  to remove both the files and the directory by
2342              setting
2343
2344                  $clean_ext = "pythontex-files-%R pythontex-files-%R";
2345
2346              See also the (array) variable  @generated_exts.   In  the  past,
2347              this  variable  had certain uses beyond that of $clean_ext.  But
2348              now, they accomplish the same things.  In fact,  after  initial‐
2349              ization  including  the  processing of command line options, la‐
2350              texmk simply appends the list of extensions in $clean_ext to the
2351              array @generated_exts.
2352
2353       $clean_full_ext [""]
2354              Extra  extensions of files for latexmk to remove when the -C op‐
2355              tion is selected, i.e., extensions of files to remove  when  the
2356              .dvi, etc files are to be cleaned-up.
2357
2358              More general patterns are allowed, as for $clean_ext.
2359
2360              The  files  specified by $clean_full_ext to be deleted are rela‐
2361              tive to the directory specified by $out_dir.
2362
2363
2364       $compiling_cmd [""], $failure_cmd [""], $warning_cmd [""], $success_cmd
2365       [""]
2366
2367              These  variables  specify  commands that are executed at certain
2368              points of compilations.  One motivation for their  existence  is
2369              to  allow  very useful convenient visual indications of compila‐
2370              tion status even when the window receiving the screen output  of
2371              the  compilation is hidden.  This is particularly useful in pre‐
2372              view-continuous mode.
2373
2374              The commands are executed  at  the  following  points:  $compil‐
2375              ing_cmd  at the start of compilation, $success_cmd at the end of
2376              a completely successful compilation, $failure_cmd at the end  of
2377              an unsuccessful compilation, $warning_cmd at the of an otherwise
2378              successful compilation that gives warnings about undefined cita‐
2379              tions or references or about multiply defined references. If any
2380              of above variables is undefined or  blank  (the  default  situa‐
2381              tion), then the corresponding command is not executed.
2382
2383              However,  when  $warning_cmd  is  not set, then in the case of a
2384              compilation with warnings about  references  or  citations,  but
2385              with  no  other  error,  one  or other of $success_cmd or $fail‐
2386              ure_cmd is used (if it is  set)  according  to  the  setting  of
2387              $warnings_as_errors.
2388
2389              An example of a simple setting of these variables is as follows
2390
2391                  $compiling_cmd  =  "xdotool  search --name \"%D\" set_window
2392              --name \"%D compiling\"";
2393                  $success_cmd   = "xdotool search  --name  \"%D\"  set_window
2394              --name \"%D OK\"";
2395                  $warning_cmd   = "xdotool search --name \"%D\" ".
2396                                   "set_window --name \"%D CITE/REF ISSUE\"";
2397                  $failure_cmd    =  "xdotool  search --name \"%D\" set_window
2398              --name \"%D FAILURE\"";
2399
2400              These assume that the program xdotool  is  installed,  that  the
2401              previewer  is using an X-Window system for display, and that the
2402              title of the window contains the name of the displayed file,  as
2403              it  normally  does.   When the commands are executed, the place‐
2404              holder string %D is replaced by  the  name  of  the  destination
2405              file, which is the previewed file.  The above commands result in
2406              an appropriate string being appended to the filename in the win‐
2407              dow title: " compiling", " OK", or " FAILURE".
2408
2409              Other  placeholders that can be used are %S, %T, and %R, with %S
2410              and %T normally being identical. These can be useful for a  com‐
2411              mand  changing  the title of the edit window. The visual indica‐
2412              tion in a window title can useful, since the user does not  have
2413              to  keep shifting attention to the (possibly hidden) compilation
2414              window to know the status of the compilation.
2415
2416              More complicated situations can best be handled  by  defining  a
2417              Perl  subroutine to invoke the necessary commands, and using the
2418              "internal" keyword in the definitions to get the  subroutine  to
2419              be invoked.  (See the section "Format of Command Specifications"
2420              for how to do this.)
2421
2422              Naturally, the above settings that invoke  the  xdotool  program
2423              are  only  applicable  when  the X-Window system is used for the
2424              relevant window(s).  For other cases, you will have to find what
2425              software solutions are available.
2426
2427
2428       @cus_dep_list [()]
2429              Custom dependency list -- see section on "Custom Dependencies".
2430
2431       @default_excluded_files [()]
2432              When  latexmk  is invoked with no files specified on the command
2433              line, then, by default, it will process all files in the current
2434              directory with the extension .tex.  (In general, it will process
2435              the files specified in the @default_files variable.)
2436
2437              But sometimes you want to exclude particular files from this de‐
2438              fault  list.  In that case you can specify the excluded files in
2439              the array @default_excluded_files.  For example if you wanted to
2440              process  all  .tex files with the exception of common.tex, which
2441              is a not a standard alone LaTeX file but a file input by some or
2442              all of the others, you could do
2443
2444                   @default_files = ("*.tex");
2445
2446                   @default_excluded_files = ("common.tex");
2447
2448              If you have a variable or large number of files to be processed,
2449              this method saves you from having to list them in detail in @de‐
2450              fault_files  and having to update the list every time you change
2451              the set of files to be processed.
2452
2453              Notes: 1. This variable has no effect except when no  files  are
2454              specified on the latexmk command line.  2. Wildcards are allowed
2455              in @default_excluded_files.
2456
2457       @default_files [("*.tex")]
2458              Default list of files to be processed.
2459
2460              If no filenames are specified on the command line, latexmk  pro‐
2461              cesses  all  tex files specified in the @default_files variable,
2462              which by default is set to all tex files ("*.tex") in  the  cur‐
2463              rent  directory.  This is a convenience: just run latexmk and it
2464              will process an appropriate set of  files.   But  sometimes  you
2465              want only some of these files to be processed.  In this case you
2466              can list the files to be processed by setting @default_files  in
2467              an  initialization  file (e.g., the file "latexmkrc" in the cur‐
2468              rent directory).  Then if no files are specified on the  command
2469              line  then  the  files you specify by setting @default_files are
2470              processed.
2471
2472              Three examples:
2473
2474                   @default_files = ("paper_current");
2475
2476                   @default_files = ("paper1", "paper2.tex");
2477
2478                   @default_files = ("*.tex", "*.dtx");
2479
2480              Note that more than file may be given, and that the default  ex‐
2481              tension is ".tex".  Wild cards are allowed.  The parentheses are
2482              because @default_files is an array variable, i.e., a sequence of
2483              filename specifications is possible.
2484
2485              If  you want latexmk to process all .tex files with a few excep‐
2486              tions, see the @default_excluded_files array variable.
2487
2488       $dependents_phony [0]
2489              If a list of dependencies is output,  this  variable  determines
2490              whether  to include a phony target for each source file.  If you
2491              use the dependents list in a  Makefile,  the  dummy  rules  work
2492              around  errors make gives if you remove header files without up‐
2493              dating the Makefile to match.
2494
2495       $dependents_list [0]
2496              Whether to display a list(s) of dependencies at  the  end  of  a
2497              run.
2498
2499       $deps_file ["-"]
2500              Name  of file to receive list(s) of dependencies at the end of a
2501              run, to be used if $dependesnt_list is set.  If the filename  is
2502              "-",  then  the dependency list is set to stdout (i.e., normally
2503              the screen).
2504
2505
2506       $do_cd [0]
2507              Whether to change working directory to the  directory  specified
2508              for  the main source file before processing it.  The default be‐
2509              havior is not to do this, which is the same as the  behavior  of
2510              *latex  programs.   This variable is set by the -cd and -cd- op‐
2511              tions on latexmk's command line.
2512
2513       $dvi_filter [empty]
2514              The dvi file filter to be run on the newly produced dvi file be‐
2515              fore other processing.  Equivalent to specifying the -dF option.
2516
2517
2518       $dvilualatex ["dvilualatex %O %S"]
2519              Specifies  the  command  line to invoke the dvilualatex program.
2520              Note that as with other programs, you can use this variable  not
2521              just  to  change  the name of the program used, but also specify
2522              options to the program.  E.g.,
2523
2524                                  $dvilualatex =  "dvilualatex  --src-specials
2525              %O %S";
2526
2527              To  do  a  coordinated  setting  of all of $dvilualatex, $latex,
2528              $pdflatex, $lualatex, and $xelatex, see  the  section  "Advanced
2529              Configuration".
2530
2531
2532       $dvi_mode [See below for default]
2533              If  one, generate a dvi version of the document by use of latex.
2534              Equivalent to the -dvi option.
2535
2536              If 2, generate a dvi version of the document by use of dviluala‐
2537              tex.  Equivalent to the -dvilua option.
2538
2539              The  variable  $dvi_mode  defaults  to 0, but if no explicit re‐
2540              quests are made for other types of file (postscript, pdf),  then
2541              $dvi_mode  will  be  set  to 1.  In addition, if a request for a
2542              file for which a .dvi file is a prerequisite  and  $dvi_mode  is
2543              zero, then $dvi_mode is set to 1.
2544
2545
2546
2547       $dvilualatex_silent_switch ["-interaction=batchmode"]
2548              Switch(es)  for  the dvilualatex program (specified in the vari‐
2549              able $dvilualatex) when silent mode is on.
2550
2551              See details of the $latex_silent_switch  for  other  information
2552              that equally applies to $dvilualatex_silent_switch.
2553
2554
2555       $dvi_previewer ["start xdvi %O %S" under UNIX]
2556              The  command  to  invoke a dvi-previewer.  [Under MS-Windows the
2557              default is "start"; then latexmk arranges to use the  MS-Windows
2558              start  program,  which will cause to be run whatever command the
2559              system has associated with .dvi files.]
2560
2561              Important note: Normally you will want to have a  previewer  run
2562              detached, so that latexmk doesn't wait for the previewer to ter‐
2563              minate before continuing its work.  So normally you should  pre‐
2564              fix  the  command  by  "start  ", which flags to latexmk that it
2565              should do the detaching of the  previewer  itself  (by  whatever
2566              method  is  appropriate to the operating system).  But sometimes
2567              letting latexmk do the detaching is not appropriate (for a vari‐
2568              ety  of non-trivial reasons), so you should put the "start " bit
2569              in yourself, whenever it is needed.
2570
2571       $dvi_previewer_landscape ["start xdvi %O %S"]
2572              The command to invoke a dvi-previewer in landscape mode.  [Under
2573              MS-Windows  the default is "start"; then latexmk arranges to use
2574              the MS-Windows start program, which will cause to be  run  what‐
2575              ever command the system has associated with .dvi files.]
2576
2577       $dvipdf ["dvipdf -dALLOWPSTRANSPARENCY %O %S %D"]
2578              Command  to convert .dvi to .pdf file.  A common reconfiguration
2579              is to use the dvipdfm command, which needs its  arguments  in  a
2580              different order:
2581
2582                   $dvipdf = "dvipdfm %O -o %D %S";
2583
2584              WARNING:  The  default  dvipdf  script  generates pdf files with
2585              bitmapped fonts, which do not look good when viewed by acroread.
2586              That  script  should  be  modified to give dvips the options "-P
2587              pdf" to ensure that type 1 fonts are used in the pdf file.
2588
2589       $dvipdf_silent_switch ["-q"]
2590              Switch(es) for dvipdf program when silent mode is on.
2591
2592              N.B. The standard dvipdf program runs silently,  so  adding  the
2593              silent  switch has no effect, but is actually innocuous.  But if
2594              an alternative program is used, e.g., dvipdfmx, then the  silent
2595              switch  has  an  effect.   The  default  setting  is correct for
2596              dvipdfm and dvipdfmx.
2597
2598       $dvips ["dvips %O -o %D %S"]
2599              The program to used as a filter to convert a .dvi file to a  .ps
2600              file.   If pdf is going to be generated from pdf, then the value
2601              of the $dvips_pdf_switch variable -- see below --  will  be  in‐
2602              cluded in the options substituted for "%O".
2603
2604       $dvips_landscape ["dvips -tlandscape %O -o %D %S"]
2605              The  program to used as a filter to convert a .dvi file to a .ps
2606              file in landscape mode.
2607
2608       $dvips_pdf_switch ["-P pdf"]
2609              Switch(es) for dvips program when pdf file is  to  be  generated
2610              from .ps file.
2611
2612       $dvips_silent_switch ["-q"]
2613              Switch(es) for dvips program when silent mode is on.
2614
2615       $dvi_update_command [""]
2616              When  the  dvi  previewer is set to be updated by running a com‐
2617              mand, this is the command that is run.  See the information  for
2618              the variable $dvi_update_method for further information, and see
2619              information on the variable $pdf_update_method  for  an  example
2620              for the analogous case of a pdf previewer.
2621
2622       $dvi_update_method [2 under UNIX, 1 under MS-Windows]
2623              How  the  dvi  viewer  updates its display when the dvi file has
2624              changed.   The  values  here  apply  equally  to  the   $pdf_up‐
2625              date_method and to the $ps_update_method variables.
2626                  0 => update is automatic,
2627                  1=> manual update by user, which may only mean a mouse click
2628              on the viewer's window or may mean a more serious action.
2629                  2 => Send the  signal,  whose  number  is  in  the  variable
2630              $dvi_update_signal.   The  default  value under UNIX is suitable
2631              for xdvi.
2632                  3 => Viewer cannot do an update, because it locks the  file.
2633              (As with acroread under MS-Windows.)
2634                  4  => run a command to do the update.  The command is speci‐
2635              fied by the variable $dvi_update_command.
2636
2637              See information on the variable $pdf_update_method for an  exam‐
2638              ple of updating by command.
2639
2640       $dvi_update_signal  [Under  UNIX:  SIGUSR1, which is a system-dependent
2641       value]
2642              The number of the signal that is sent to the dvi viewer when  it
2643              is  updated  by  sending  a signal -- see the information on the
2644              variable $dvi_update_method.  The default value is the  one  ap‐
2645              propriate for xdvi on a UNIX system.
2646
2647       $emulate_aux [0]
2648              Whether  to  emulate  the use of aux directory when $aux_dir and
2649              $out_dir are different, rather than using the -aux-directory op‐
2650              tion  for the *latex programs.  (MiKTeX supports -aux-directory,
2651              but TeXLive doesn't.)
2652
2653              If you use a version of *latex that doesn't support  -aux-direc‐
2654              tory,  e.g.,  TeXLive, latexmk will automatically switch aux_dir
2655              emulation on after the first run of *latex, because it will find
2656              the .log file in the wrong place.  But it is better to set $emu‐
2657              late_aux to 1 in an rc file, or equivalently to  use  the  -emu‐
2658              late-aux-dir option. This emulation mode works equally well with
2659              MiKTeX.
2660
2661              Aux directory emulation means that when *latex is  invoked,  the
2662              output directory provided to *latex is set to be the desired aux
2663              directory. After that, any files that need to be in  the  output
2664              directory  will  be moved there by latexmk. (These are the files
2665              with extensions .dvi, .ps, .pdf, .synctex, .synctex.gz, and, de‐
2666              pending  on  the setting of the $fls_uses_out_dir variable, also
2667              the .fls file.)
2668
2669
2670       $failure_cmd [undefined]
2671              See the documentation for $compiling_cmd.
2672
2673
2674       $fdb_ext ["fdb_latexmk"]
2675              The extension of the file which latexmk generates to  contain  a
2676              database  of information on source files.  You will not normally
2677              need to change this.
2678
2679
2680       $fls_uses_out_dir [0]
2681              This variable determines whether or not the .fls file should  be
2682              in  the output directory instead of the natural directory, which
2683              is the aux directory.  If the variable is nonzero, the .fls file
2684              is to be in the output directory.  See the section AUXILIARY AND
2685              OUTPUT DIRECTORIES for more  details  about  these  directories.
2686              The    rationale    for    the   existence   of   the   variable
2687              $fls_uses_aux_dir is explained there.
2688
2689              In all cases, if latexmk finds that an .fls file has been gener‐
2690              ated   in  the  opposite  directory  to  the  one  specified  by
2691              $fls_uses_out_dir, it copies the file  to  the  other  directory
2692              (aux  or  output  directory as appropriate).  The file is copied
2693              rather than simply moved, to avoid potential clashes with  other
2694              software  that  assumes the .fls file is generated in the direc‐
2695              tory it was written to by *latex. Thus the effect  an  incorrect
2696              setting of $fls_uses_out_dir is only to cause a superfluous copy
2697              of the .fls file to be generated.
2698
2699
2700       $force_mode [0]
2701              If nonzero, continue processing past minor latex errors  includ‐
2702              ing unrecognized cross references.  Equivalent to specifying the
2703              -f option.
2704
2705
2706       @generated_exts [( 'aux', 'bcf', 'fls',  'idx',  'ind',  'lof',  'lot',
2707       'out', 'toc', 'blg', 'ilg', 'log', 'xdv' )]
2708
2709              This  contains a list of extensions for files that are generated
2710              during processing, and that should  be  deleted  during  a  main
2711              clean  up  operation,  as invoked by the command line option -c.
2712              (The use of -C or -gg gives this clean up and more.)
2713
2714              The default values are extensions for standard  files  generated
2715              by  *latex,  bibtex, and the like.  (Note that the clean up also
2716              deletes the fdb_latexmk file, but that's separately  coded  into
2717              latexmk, currently.)
2718
2719              After  initialization  of latexmk and the processing of its com‐
2720              mand line, the  items  in  clean_ext  are  appended  to  @gener‐
2721              ated_exts.   So  these two variables have the same meaning (con‐
2722              trary to older versions of latexmk).
2723
2724              The items in @generated_exts are normally extensions  of  files,
2725              whose  base  name  is  the same as the main tex file.  But it is
2726              also possible to specify patterns including  that  basename  ---
2727              see the explanation of the variable $clean_ext.
2728
2729              In addition to specifying files to be deleted in a clean up, la‐
2730              texmk uses the same specification to assist its  examination  of
2731              changes  in source files: Under some situations it needs to find
2732              those changes in files (since a previous run) that are  expected
2733              to  be  due to the user editing a file.  This contrasts with the
2734              cases of files that are generated by some program run by latexmk
2735              and  that differ from the results of the previous run.  This use
2736              of @generated_exts is normally unimportant, given the usual  ac‐
2737              curacy  of  latexmk's  other ways of determining these generated
2738              files.
2739
2740              A convenient way to add an extra extension to the list,  without
2741              losing  the already defined ones is to use a push command in the
2742              line in an RC file.  E.g.,
2743
2744                              push @generated_exts, "end";
2745
2746              adds the extension "end" to the list of predefined generated ex‐
2747              tensions.   (This  extension  is used by the RevTeX package, for
2748              example.)
2749
2750
2751       $go_mode [0]
2752              If nonzero, process files regardless of timestamps, and is  then
2753              equivalent to the -g option.
2754
2755       %hash_calc_ignore_pattern
2756              !!!This variable is for experts only!!!
2757
2758              The  general rule latexmk uses for determining when an extra run
2759              of some program is needed is that one of the  source  files  has
2760              changed.   But  consider for example a latex package that causes
2761              an encapsulated postscript file (an "eps" file) to be made  that
2762              is  to  be read in on the next run.  The file contains a comment
2763              line giving its creation date and time.  On  the  next  run  the
2764              time  changes,  latex  sees  that  the eps file has changed, and
2765              therefore reruns latex.  This causes an infinite loop,  that  is
2766              only  terminated  because  latexmk  has a limit on the number of
2767              runs to guard against pathological situations.
2768
2769              But the changing line has no real effect, since it is a comment.
2770              You can instruct latex to ignore the offending line as follows:
2771
2772                 $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate: ';
2773
2774              This creates a rule for files with extension .eps about lines to
2775              ignore.  The left-hand side is a Perl idiom for setting an  item
2776              in  a hash.  Note that the file extension is specified without a
2777              period.  The value, on the right-hand side, is a string contain‐
2778              ing  a  regular  expression.  (See documentation on Perl for how
2779              they are to be specified in general.)  This  particular  regular
2780              expression  specifies that lines beginning with "%%CreationDate:
2781              " are to be ignored in deciding whether a file of the given  ex‐
2782              tension .eps has changed.
2783
2784              There  is  only one regular expression available for each exten‐
2785              sion.  If you need more one pattern to specify lines to  ignore,
2786              then  you need to combine the patterns into a single regular ex‐
2787              pression.  The simplest method is separate the different  simple
2788              patterns  by  a vertical bar character (indicating "alternation"
2789              in the jargon of regular expressions).  For example,
2790
2791                 $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate:  |^%%Ti‐
2792              tle: ';
2793
2794              causes lines starting with either "^%%CreationDate: " or "^%%Ti‐
2795              tle: " to be ignored.
2796
2797              It may happen that a pattern to be ignored is specified in,  for
2798              example,  in  a system or user initialization file, and you wish
2799              to remove this in a file that is read later.  To  do  this,  you
2800              use Perl's delete function, e.g.,
2801
2802                  delete $hash_calc_ignore_pattern{'eps'};
2803
2804
2805       $jobname [""]
2806
2807              This  specifies the jobname, i.e., the basename that is used for
2808              generated files (.aux, .log, .dvi, .ps,  .pdf,  etc).   If  this
2809              variable  is a null string, then the basename is the basename of
2810              the main tex file.  (At present, the string in  $jobname  should
2811              not contain spaces.)
2812
2813              The  placeholder  '%A' is permitted. This will be substituted by
2814              the basename of the TeX file.  The primary purpose is when a va‐
2815              riety  of  tex  files are to be processed, and you want to use a
2816              different jobname for each but one that is  distinct  for  each.
2817              Thus  if you wanted to compare compilations of a set of files on
2818              different operating systems, with distinct filenames for all the
2819              cases, you could set
2820
2821                 $jobname = "%A-$^O";
2822
2823              in  an initialization file.  (Here $^O is a variable provided by
2824              perl that contains perl's name for the operating system.)
2825
2826              Suppose you had .tex files test1.tex and test2.tex.   Then  when
2827              you run
2828
2829                 latexmk -pdf *.tex
2830
2831              both  files  will  be  compiled.  The .aux, .log, and .pdf files
2832              will have basenames test1-MSWin32 ante test2-MSWin32  on  a  MS-
2833              Windows system, test1-darwin and test2-darwin on an OS-X system,
2834              and a variety of similar cases on linux systems.
2835
2836
2837       $kpsewhich ["kpsewhich %S"]
2838              The program called to locate a source file when the  name  alone
2839              is  not  sufficient.  Most filenames used by latexmk have suffi‐
2840              cient path information to be found directly.  But sometimes, no‐
2841              tably when a .bib or a .bst file is found from the log file of a
2842              bibtex or biber run, only the base name of the  file  is  known,
2843              but not its path. The program specified by $kpsewhich is used to
2844              find it.
2845
2846              (For advanced users: Because of the different way in  which  la‐
2847              texmk uses the command specified in $kpsewhich, some of the pos‐
2848              sibilities listed in the FORMAT OF COMMAND SPECIFICATIONS do not
2849              apply.   The  internal  and  start keywords are not available. A
2850              simple command specification with possible options and then "%S"
2851              is  all  that  is  guaranteed to work.  Note that for other com‐
2852              mands, "%S" is substituted by a single source file. In contrast,
2853              for $kpsewhich, "%S" may be substituted by a long list of space-
2854              separated filenames, each of which is  quoted.   The  result  on
2855              STDOUT of running the command is then piped to latexmk.)
2856
2857              See  also  the  @BIBINPUTS variable for another way that latexmk
2858              also uses to try to locate files; it applies only in the case of
2859              .bib files.
2860
2861       $kpsewhich_show [0]
2862              Whether  to show diagnostics about invocations of kpsewhich: the
2863              command line use to invoke it and the results.   These  diagnos‐
2864              tics  are shown if $kpsewhich_show is non-zero or if diagnostics
2865              mode is on.  (But in the second case, lots of other  diagnostics
2866              are  also  shown.)   Without  these diagnostics there is nothing
2867              visible in latexmk's screen output about  invocations  of  kpse‐
2868              which.
2869
2870       $landscape_mode [0]
2871              If nonzero, run in landscape mode, using the landscape mode pre‐
2872              viewers and dvi to postscript converters.  Equivalent to the  -l
2873              option.  Normally not needed with current previewers.
2874
2875       $latex ["latex %O %S"]
2876              Specifies  the  command  line  for the LaTeX processing program.
2877              Note that as with other programs, you can use this variable  not
2878              just  to  change  the name of the program used, but also specify
2879              options to the program.  E.g.,
2880
2881                                  $latex = "latex --src-specials %O %S";
2882
2883              To do a coordinated setting  of  all  of  $dvilualatex,  $latex,
2884              $pdflatex,  $lualatex,  and  $xelatex, see the section "Advanced
2885              Configuration".
2886
2887
2888       %latex_input_extensions
2889              This variable specifies the extensions tried by latexmk when  it
2890              finds  that a LaTeX run resulted in an error that a file has not
2891              been found, and the file is given without  an  extension.   This
2892              typically  happens  when LaTeX commands of the form \input{file}
2893              or \includegraphics{figure}, when the relevant source file  does
2894              not exist.
2895
2896              In  this  situation, latexmk searches for custom dependencies to
2897              make the missing file(s), but restricts  it  to  the  extensions
2898              specified  by the variable %latex_input_extensions.  The default
2899              extensions are 'tex' and 'eps'.
2900
2901              (For Perl experts: %latex_input_extensions is a hash whose  keys
2902              are  the  extensions.   The values are irrelevant.)  Two subrou‐
2903              tines are provided for manipulating this and the  related  vari‐
2904              able  %pdflatex_input_extensions,  add_input_ext  and remove_in‐
2905              put_ext.  They are used as in the following examples are  possi‐
2906              ble lines in an initialization file:
2907
2908                  remove_input_ext( 'latex', 'tex' );
2909
2910              removes the extension 'tex' from latex_input_extensions
2911
2912                  add_input_ext( 'latex', 'asdf' );
2913
2914              add  the  extension 'asdf to latex_input_extensions.  (Naturally
2915              with such an extension, you should have made an appropriate cus‐
2916              tom dependency for latexmk, and should also have done the appro‐
2917              priate programming in the LaTeX source file to enable  the  file
2918              to  be  read.   The standard extensions are handled by LaTeX and
2919              its graphics/graphicx packages.)
2920
2921       $latex_silent_switch ["-interaction=batchmode"]
2922              Switch(es) for the LaTeX processing program when silent mode  is
2923              on.
2924
2925              If  you  use MikTeX, you may prefer the results if you configure
2926              the options to include -c-style-errors, e.g., by  the  following
2927              line in an initialization file
2928
2929                $latex_silent_switch  =  "-interaction=batchmode  -c-style-er‐
2930              rors";
2931
2932
2933       $lpr ["lpr %O %S" under UNIX/Linux, "NONE lpr" under MS-Windows]
2934              The command to print postscript files.
2935
2936              Under MS-Windows (unlike UNIX/Linux), there is no standard  pro‐
2937              gram for printing files.  But there are ways you can do it.  For
2938              example, if you have gsview installed, you could use it with the
2939              option "/p":
2940
2941                  $lpr = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p';
2942
2943              If  gsview  is installed in a different directory, you will need
2944              to make the appropriate change.  Note the combination of  single
2945              and  double  quotes  around the name.  The single quotes specify
2946              that this is a string to be assigned to the configuration  vari‐
2947              able  $lpr.   The double quotes are part of the string passed to
2948              the operating system to get the command obeyed; this  is  neces‐
2949              sary because one part of the command name ("Program Files") con‐
2950              tains a space which would otherwise be misinterpreted.
2951
2952       $lpr_dvi ["NONE lpr_dvi"]
2953              The printing program to print dvi files.
2954
2955       $lpr_pdf ["NONE lpr_pdf"]
2956              The printing program to print pdf files.
2957
2958              Under MS-Windows you could set this to use gsview, if it is  in‐
2959              stalled, e.g.,
2960
2961                  $lpr = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p';
2962
2963              If  gsview  is installed in a different directory, you will need
2964              to make the appropriate change.  Note the double  quotes  around
2965              the name: this is necessary because one part of the command name
2966              ("Program Files") contains a space which would otherwise be mis‐
2967              interpreted.
2968
2969       $lualatex ["lualatex %O %S"]
2970              Specifies the command line for the LaTeX processing program that
2971              is to be used when the lualatex program is called for (e.g.,  by
2972              the option -lualatex.
2973
2974              To  do  a  coordinated  setting  of all of $dvilualatex, $latex,
2975              $pdflatex, $lualatex, and $xelatex, see  the  section  "Advanced
2976              Configuration".
2977
2978
2979       %lualatex_input_extensions
2980              This  variable specifies the extensions tried by latexmk when it
2981              finds that a lualatex run resulted in an error that a  file  has
2982              not  been  found,  and  the  file is given without an extension.
2983              This typically happens when LaTeX  commands  of  the  form  \in‐
2984              put{file}  or \includegraphics{figure}, when the relevant source
2985              file does not exist.
2986
2987              In this situation, latexmk searches for custom  dependencies  to
2988              make  the  missing  file(s),  but restricts it to the extensions
2989              specified by the variable %pdflatex_input_extensions.   The  de‐
2990              fault extensions are 'tex', 'pdf', 'jpg, and 'png'.
2991
2992              See details of the %latex_input_extensions for other information
2993              that equally applies to %lualatex_input_extensions.
2994
2995       $lualatex_silent_switch ["-interaction=batchmode"]
2996              Switch(es) for the lualatex program (specified in  the  variable
2997              $lualatex) when silent mode is on.
2998
2999              See  details  of  the $latex_silent_switch for other information
3000              that equally applies to $lualatex_silent_switch.
3001
3002       $make ["make"]
3003              The make processing program.
3004
3005       $makeindex ["makeindex %O -o %D %S"]
3006              The index processing program.
3007
3008       $makeindex_fudge [0]
3009              When using makeindex, whether to change  directory  to  $aux_dir
3010              before  running  makeindex.   Set to 1 if $aux_dir is not an ex‐
3011              plicit subdirectory of current  directory,  otherwise  makeindex
3012              will refuse to write its output and log files, for security rea‐
3013              sons.
3014
3015       $makeindex_silent_switch ["-q"]
3016              Switch(es) for the index processing program when silent mode  is
3017              on.
3018
3019       $max_repeat [5]
3020              The  maximum  number of times latexmk will run *latex before de‐
3021              ciding that there may be an infinite loop and that it  needs  to
3022              bail  out,  rather than rerunning *latex again to resolve cross-
3023              references, etc.  The default value covers all normal cases.
3024
3025              (Note that the "etc" covers a lot of cases where one run of *la‐
3026              tex generates files to be read in on a later run.)
3027
3028       $MSWin_back_slash [1]
3029              This  configuration  variable only has an effect when latexmk is
3030              running under MS-Windows.  With the default value of 1 for  this
3031              variable,  when  a command is executed under MS-Windows, latexmk
3032              substitutes "\" for the separator character  between  components
3033              of  a  directory name.  Internally, latexmk uses "/" for the di‐
3034              rectory separator character, which  is  the  character  used  by
3035              Unix-like systems.
3036
3037              For  almost  all programs and for almost all filenames under MS-
3038              Windows, both "\" and "/" are acceptable as the directory  sepa‐
3039              rator  character,  provided at least that filenames are properly
3040              quoted.  But it is possible that programs exist that only accept
3041              "\"  on  the  command line, since that is the standard directory
3042              separator for MS-Windows.  So for safety latexmk makes the  sub‐
3043              stitution from "/" to "\", by default.
3044
3045              However  there  are also programs on MS-Windows for which a back
3046              slash "\" is interpreted differently than as a directory separa‐
3047              tor;  for these the directory separator should be "/".  Programs
3048              with this behavior  include  all  the  *latex  programs  in  the
3049              TeXLive  implementation  (but  not  the  MiKTeX implementation).
3050              Hence if you use TeXLive on MS-Windows,  then  $MSWin_back_slash
3051              should be set to zero.
3052
3053
3054       $new_viewer_always [0]
3055              This  variable  applies  to  latexmk  only in continuous-preview
3056              mode.  If $new_viewer_always is 0, latexmk will check for a pre‐
3057              viously  running  previewer on the same file, and if one is run‐
3058              ning will not start a new one.  If  $new_viewer_always  is  non-
3059              zero,  this check will be skipped, and latexmk will behave as if
3060              no viewer is running.
3061
3062       $out_dir [""]
3063              If non-blank, this variable specifies the output directory.
3064
3065              This is the directory in which final output  files  are  written
3066              (dvi,  ps,  pdf,  synctex, synctex.gz).  In addition, if the aux
3067              directory equals the output directory, as is  the  case  by  de‐
3068              fault,  then  other generated files are in effect written to the
3069              output directory.
3070
3071              If $out_dir is blank, the output directory is the current direc‐
3072              tory  at the invocation of *latex; this is equivalent to setting
3073              $out_dir to '.'.
3074
3075              See the section AUXILIARY AND OUTPUT DIRECTORIES  for  more  de‐
3076              tails.
3077
3078
3079
3080       $pdf_mode [0]
3081              If  zero,  do  NOT  generate  a pdf version of the document.  If
3082              equal to 1, generate a pdf version of the document using  pdfla‐
3083              tex,  using the command specified by the $pdflatex variable.  If
3084              equal to 2, generate a pdf version of the document from  the  ps
3085              file,  by  using  the command specified by the $ps2pdf variable.
3086              If equal to 3, generate a pdf version of the document  from  the
3087              dvi  file,  by  using the command specified by the $dvipdf vari‐
3088              able.  If equal to 4, generate a pdf version of the document us‐
3089              ing lualatex, using the command specified by the $lualatex vari‐
3090              able.  If equal to 5, generate a pdf version (and  an  xdv  ver‐
3091              sion)  of  the document using xelatex, using the commands speci‐
3092              fied by the $xelatex and xdvipdfmx variables.
3093
3094              In $pdf_mode=2, it is ensured that .dvi and .ps files  are  also
3095              made.   In  $pdf_mode=3,  it is ensured that a .dvi file is also
3096              made.  But this may be overridden by the document.
3097
3098       $pdflatex ["pdflatex %O %S"]
3099              Specifies the command line for the LaTeX processing program in a
3100              version that makes a pdf file instead of a dvi file.
3101
3102              An example use of this variable is to add certain options to the
3103              command line for the program, e.g.,
3104
3105                   $pdflatex = "pdflatex --shell-escape %O %S";
3106
3107              (In some earlier versions of latexmk, you needed to use  an  as‐
3108              signment  to  $pdflatex  to allow the use of lualatex or xelatex
3109              instead of pdflatex.  There are now separate configuration vari‐
3110              ables  for  the  use  of lualatex or xelatex.  See $lualatex and
3111              $xelatex.)
3112
3113              To do a coordinated setting  of  all  of  $dvilualatex,  $latex,
3114              $pdflatex,  $lualatex,  and  $xelatex, see the section "Advanced
3115              Configuration".
3116
3117
3118       %pdflatex_input_extensions
3119              This variable specifies the extensions tried by latexmk when  it
3120              finds  that  a pdflatex run resulted in an error that a file has
3121              not been found, and the file  is  given  without  an  extension.
3122              This  typically  happens  when  LaTeX  commands of the form \in‐
3123              put{file} or \includegraphics{figure}, when the relevant  source
3124              file does not exist.
3125
3126              In  this  situation, latexmk searches for custom dependencies to
3127              make the missing file(s), but restricts  it  to  the  extensions
3128              specified  by  the variable %pdflatex_input_extensions.  The de‐
3129              fault extensions are 'tex', 'pdf', 'jpg, and 'png'.
3130
3131              See details of the %latex_input_extensions for other information
3132              that equally applies to %pdflatex_input_extensions.
3133
3134       $pdflatex_silent_switch ["-interaction=batchmode"]
3135              Switch(es)  for  the pdflatex program (specified in the variable
3136              $pdflatex) when silent mode is on.
3137
3138              See details of the $latex_silent_switch  for  other  information
3139              that equally applies to $pdflatex_silent_switch.
3140
3141       $pdf_previewer ["start acroread %O %S"]
3142              The command to invoke a pdf-previewer.
3143
3144              On  MS-Windows, the default is changed to "cmd /c start """; un‐
3145              der more recent versions of Windows, this will cause to  be  run
3146              whatever command the system has associated with .pdf files.  But
3147              this may be undesirable if this association is  to  acroread  --
3148              see the notes in the explanation of the -pvc option.]
3149
3150              On  OS-X  the  default is changed to "open %S", which results in
3151              OS-X starting up (and detaching) the viewer associated with  the
3152              file.   By  default, for pdf files this association is to OS-X's
3153              preview, which is quite satisfactory.
3154
3155              WARNING:  Problem under MS-Windows: if acroread is used  as  the
3156              pdf  previewer,  and  it is actually viewing a pdf file, the pdf
3157              file cannot be updated.  Thus makes acroread  a  bad  choice  of
3158              previewer  if you use latexmk's previous-continuous mode (option
3159              -pvc) under MS-windows.  This problem does not occur if, for ex‐
3160              ample, SumatraPDF or gsview is used to view pdf files.
3161
3162              Important  note:  Normally you will want to have a previewer run
3163              detached, so that latexmk doesn't wait for the previewer to ter‐
3164              minate  before continuing its work.  So normally you should pre‐
3165              fix the command by "start ", which  flags  to  latexmk  that  it
3166              should  do  the  detaching  of the previewer itself (by whatever
3167              method is appropriate to the operating system).   But  sometimes
3168              letting latexmk do the detaching is not appropriate (for a vari‐
3169              ety of non-trivial reasons), so you should put the "start "  bit
3170              in yourself, whenever it is needed.
3171
3172       $pdf_update_command [""]
3173              When  the  pdf  previewer is set to be updated by running a com‐
3174              mand, this is the command that is run.  See the information  for
3175              the variable $pdf_update_method.
3176
3177       $pdf_update_method [1 under UNIX, 3 under MS-Windows]
3178              How  the  pdf  viewer  updates its display when the pdf file has
3179              changed. See the information on the variable  $dvi_update_method
3180              for the codes.  (Note that information needs be changed slightly
3181              so that for the value 4, to run a command to do the update,  the
3182              command  is  specified  by the variable $pdf_update_command, and
3183              for the value 2, to specify update  by  signal,  the  signal  is
3184              specified by $pdf_update_signal.)
3185
3186              Note that acroread under MS-Windows (but not UNIX) locks the pdf
3187              file, so the default value is then 3.
3188
3189              Arranging to use a command to get a previewer explicitly updated
3190              requires three variables to be set.  For example:
3191
3192                  $pdf_previewer = "start xpdf -remote %R %O %S";
3193                  $pdf_update_method = 4;
3194                  $pdf_update_command = "xpdf -remote %R -reload";
3195
3196              The  first  setting  arranges for the xpdf program to be used in
3197              its "remote server mode", with the server name specified as  the
3198              rootname  of  the TeX file.  The second setting arranges for up‐
3199              dating to be done in response to a command, and the  third  set‐
3200              ting sets the update command.
3201
3202       $pdf_update_signal  [Under  UNIX:  SIGHUP,  which is a system-dependent
3203       value]
3204              The number of the signal that is sent to the pdf viewer when  it
3205              is  updated  by  sending  a signal -- see the information on the
3206              variable $pdf_update_method.  The default value is the  one  ap‐
3207              propriate for gv on a UNIX system.
3208
3209       $pid_position[1 under UNIX, -1 under MS-Windows]
3210              The  variable  $pid_position  is  used  to specify which word in
3211              lines of the output from $pscmd corresponds to the  process  ID.
3212              The  first word in the line is numbered 0.  The default value of
3213              1 (2nd word in line) is correct for Solaris 2.6, Linux, and OS-X
3214              with their default settings of $pscmd.
3215
3216              Setting  the  variable  to -1 is used to indicate that $pscmd is
3217              not to be used.
3218
3219       $postscript_mode [0]
3220              If nonzero, generate  a  postscript  version  of  the  document.
3221              Equivalent to the -ps option.
3222
3223              If  some  other  request  is made for which a postscript file is
3224              needed, then $postscript_mode will be set to 1.
3225
3226       $pre_tex_code ['']
3227
3228              Sets TeX code to be executed before inputting the  source  file.
3229              This  works  if the relevant one of $latex, etc contains a suit‐
3230              able command line with a %P or %U substitution.  For example you
3231              could do
3232
3233                   $latex = 'latex %O %P';
3234                   $pre_tex_code = '\AtBeginDocument{An initial message\par}';
3235
3236              To  set  all  of  $latex, $pdflatex, $lualatex, and $xelatex you
3237              could use the subroutine alt_tex_cmds:
3238
3239                   &alt_tex_cmds;
3240                   $pre_tex_code = '\AtBeginDocument{An initial message\par}';
3241
3242
3243
3244       $preview_continuous_mode [0]
3245              If nonzero, run a previewer to view the document,  and  continue
3246              running latexmk to keep .dvi up-to-date.  Equivalent to the -pvc
3247              option.  Which previewer is run depends on the  other  settings,
3248              see the command line options -view=, and the variable $view.
3249
3250       $preview_mode [0]
3251              If nonzero, run a previewer to preview the document.  Equivalent
3252              to the -pv option.  Which previewer is run depends on the  other
3253              settings,  see the command line options -view=, and the variable
3254              $view.
3255
3256       $printout_mode [0]
3257              If nonzero, print the document using the  command  specified  in
3258              the $lpr variable.  Equivalent to the -p option.  This is recom‐
3259              mended not to be set from an RC file, otherwise you could  waste
3260              lots of paper.
3261
3262       $print_type = ["auto"]
3263              Type  of  file  to  printout:  possibilities  are "auto", "dvi",
3264              "none", "pdf", or "ps".   See the option -print= for the meaning
3265              of the "auto" value.
3266
3267       $pscmd Command used to get all the processes currently run by the user.
3268              The -pvc option uses  the  command  specified  by  the  variable
3269              $pscmd  to  determine  if there is an already running previewer,
3270              and to find the process ID (needed if latexmk  needs  to  signal
3271              the previewer about file changes).
3272
3273              Each line of the output of this command is assumed to correspond
3274              to one process.  See the  $pid_position  variable  for  how  the
3275              process number is determined.
3276
3277              The  default  for  pscmd  is  "NONE" under MS-Windows and cygwin
3278              (i.e., the command is not used), "ps -ww  -u  $ENV{USER}"  under
3279              OS-X,  and  "ps  -f -u $ENV{USER}" under other operating systems
3280              (including Linux).  In these specifications "$ENV{USER}" is sub‐
3281              stituted by the username.
3282
3283       $ps2pdf ["ps2pdf -dALLOWPSTRANSPARENCY %O %S %D"]
3284              Command to convert .ps to .pdf file.
3285
3286       $ps_filter [empty]
3287              The postscript file filter to be run on the newly produced post‐
3288              script file before other processing.  Equivalent  to  specifying
3289              the -pF option.
3290
3291       $ps_previewer ["start gv %O %S", but start %O %S under MS-Windows]
3292              The  command  to  invoke a ps-previewer.  (The default under MS-
3293              Windows will cause to be run whatever command the system has as‐
3294              sociated with .ps files.)
3295
3296              Note  that  gv  could be used with the -watch option updates its
3297              display whenever the postscript file changes, whereas  ghostview
3298              does  not.  However, different versions of gv have slightly dif‐
3299              ferent ways of writing this  option.   You  can  configure  this
3300              variable appropriately.
3301
3302              WARNING: Linux systems may have installed one (or more) versions
3303              of gv under different names, e.g.,  ggv,  kghostview,  etc,  but
3304              perhaps not one actually called gv.
3305
3306              Important  note:  Normally you will want to have a previewer run
3307              detached, so that latexmk doesn't wait for the previewer to ter‐
3308              minate  before continuing its work.  So normally you should pre‐
3309              fix the command by "start ", which  flags  to  latexmk  that  it
3310              should  do  the  detaching  of the previewer itself (by whatever
3311              method is appropriate to the operating system).   But  sometimes
3312              letting latexmk do the detaching is not appropriate (for a vari‐
3313              ety of non-trivial reasons), so you should put the "start "  bit
3314              in yourself, whenever it is needed.
3315
3316
3317       $ps_previewer_landscape  ["start gv -swap %O %S", but start %O %S under
3318       MS-Windows]
3319              The command to invoke a ps-previewer in landscape mode.
3320
3321       $ps_update_command [""]
3322              When the postscript previewer is set to be updated by running  a
3323              command,  this  is the command that is run.  See the information
3324              for the variable $ps_update_method.
3325
3326       $ps_update_method [0 under UNIX, 1 under MS-Windows]
3327              How the postscript viewer updates its display when the .ps  file
3328              has  changed.  See  the  information  on  the  variable $dvi_up‐
3329              date_method for the codes.   (Note  that  information  needs  be
3330              changed slightly so that for the value 4, to run a command to do
3331              the update, the command is specified  by  the  variable  $ps_up‐
3332              date_command,  and for the value 2, to specify update by signal,
3333              the signal is specified by $ps_update_signal.)
3334
3335       $ps_update_signal [Under UNIX:  SIGHUP,  which  is  a  system-dependent
3336       value]
3337              The  number of the signal that is sent to the pdf viewer when it
3338              is updated by sending a signal --  see  $ps_update_method.   The
3339              default value is the one appropriate for gv on a UNIX system.
3340
3341       $pvc_timeout [0]
3342              If  this  variable  is  nonzero, there will be a  timeout in pvc
3343              mode after a period of inactivity.  Inactivity  means  a  period
3344              when  latexmk  has  detected  no  file changes and hence has not
3345              taken any actions like compiling the document. The period of in‐
3346              activity is in the variable $pvc_timeout_mins.
3347
3348
3349       $pvc_timeout_mins [30]
3350              The period of inactivity, in minutes, after which pvc mode times
3351              out.  This is used if $pvc_timeout is nonzero.
3352
3353       $pvc_view_file_via_temporary [1]
3354              The same as $always_view_file_via_temporary, except that it only
3355              applies in preview-continuous mode (-pvc option).
3356
3357       $quote_filenames [1]
3358              This specifies whether substitutions for placeholders in command
3359              specifications  (as  in  $pdflatex)  are  surrounded  by  double
3360              quotes.   If this variable is 1 (or any other value Perl regards
3361              as true), then quoting is done.  Otherwise quoting is omitted.
3362
3363              The quoting method used by latexmk is tested to  work  correctly
3364              under  UNIX systems (including Linux and Mac OS-X) and under MS-
3365              Windows.  It allows the  use  of  filenames  containing  special
3366              characters,  notably  spaces.   (But  note that many versions of
3367              *latex cannot correctly deal with TeX files whose names  contain
3368              spaces.   Latexmk's quoting only ensures that such filenames are
3369              correctly treated by the operating system in  passing  arguments
3370              to programs.)
3371
3372       $rc_report [1]
3373              After  initialization,  whether  to  give a list of the RC files
3374              read.
3375
3376       $recorder [1]
3377              Whether to use the -recorder option to *latex.  Use of this  op‐
3378              tion  results  in  a file of extension .fls containing a list of
3379              the files that these programs have read  and  written.   Latexmk
3380              will then use this file to improve its detection of source files
3381              and generated files after a run of *latex.
3382
3383              It is generally recommended to use this option (or to  configure
3384              the  $recorder  variable to be on.)  But it only works if *latex
3385              supports the -recorder option, which is true  for  most  current
3386              implementations
3387
3388              Note  about  the  name of the .fls file: Most implementations of
3389              *latex produce an .fls file with the same basename as  the  main
3390              document's LaTeX, e.g., for Document.tex, the .fls file is Docu‐
3391              ment.fls.  However, some implementations instead  produce  files
3392              named for the program, i.e., latex.fls or pdflatex.fls.  In this
3393              second case, latexmk copies the latex.fls or pdflatex.fls  to  a
3394              file  with  the basename of the main LaTeX document, e.g., Docu‐
3395              ment.fls.
3396
3397       $search_path_separator [See below for default]
3398              The character separating paths in the environment variables TEX‐
3399              INPUTS,  BIBINPUTS, and BSTINPUTS.  This variable is mainly used
3400              by latexmk when the -outdir, -output-directory, -auxdir,  and/or
3401              -aux-directory  options are used.  In that case latexmk needs to
3402              communicate  appropriately  modified  search  paths  to  bibtex,
3403              dvipdf, dvips, and *latex.
3404
3405              [Comment  to  technically savvy readers: *latex doesn't actually
3406              need the modified search path.  But,  surprisingly,  dvipdf  and
3407              dvips  do, because sometimes graphics files get generated in the
3408              output or aux directories.]
3409
3410              The default under MSWin and Cygwin is ';'  and  under  UNIX-like
3411              operating  systems  (including Linux and OS-X) is ':'.  Normally
3412              the defaults give correct behavior.  But there can be  difficul‐
3413              ties  if  your operating system is of one kind, but some of your
3414              software is running under an emulator for the other kind of  op‐
3415              erating  system;  in  that  case you'll need to find out what is
3416              needed, and set $search_path_separator  explicitly.   (The  same
3417              goes,  of  course, for unusual operating systems that are not in
3418              the MSWin, Linux, OS-X, Unix collection.)
3419
3420       $show_time [0]
3421              Whether to show time used, both the  total  and  for  individual
3422              steps.
3423
3424              Note: On MS Windows, this is clock time.  On other OSs it is the
3425              CPU time used (by latexmk and the child processes  it  invokes).
3426              The OS-dependence is because of a limitation of Windows.  If you
3427              wish to force the use of clock instead of CPU time, you can set
3428
3429                  $times_are_clock = 1;
3430
3431
3432
3433       $silence_logfile_warnings [0]
3434              Whether after a run of *latex to summarize warnings in  the  log
3435              file  about  undefined  citations  and references.  Setting $si‐
3436              lence_logfile_warnings=0 gives the summary of warnings (provided
3437              silent  mode isn't also set), and this is useful to locate unde‐
3438              fined citations and references  without  searching  through  the
3439              much  more verbose log file or the screen output of *latex.  But
3440              the summary can also be excessively annoying.   The  default  is
3441              not  to  give  these  warnings.   The  command line options -si‐
3442              lence_logfile_warning_list  and   -silence_logfile_warning_list-
3443              also set this variable.
3444
3445              Note  that multiple occurrences for the same undefined object on
3446              the same page and same line will be compressed to a single warn‐
3447              ing.
3448
3449       $silent [0]
3450              Whether  to run silently.  Setting $silent to 1 has the same ef‐
3451              fect as the -quiet of -silent options on the command line.
3452
3453       $sleep_time [2]
3454              The time to sleep (in seconds) between checking for source  file
3455              changes when running with the -pvc option.  This is subject to a
3456              minimum of one second delay, except that zero delay is also  al‐
3457              lowed.
3458
3459              A  value  of  exactly 0 gives no delay, and typically results in
3460              100% CPU usage, which may not be desirable.
3461
3462       $texfile_search [""]
3463              This is an obsolete variable,  replaced  by  the  @default_files
3464              variable.
3465
3466              For   backward   compatibility,  if  you  choose  to  set  $tex‐
3467              file_search, it is a string of  space-separated  filenames,  and
3468              then latexmk replaces @default_files with the filenames in $tex‐
3469              file_search to which is added "*.tex".
3470
3471       $success_cmd [undefined]
3472              See the documentation for $compiling_cmd.
3473
3474       $tmpdir [See below for default]
3475              Directory to store temporary files  that  latexmk  may  generate
3476              while running.
3477
3478              The  default  under MSWindows (including cygwin), is to set $tm‐
3479              pdir to the value of the first of whichever of the system  envi‐
3480              ronment  variables  TMPDIR or TEMP exists, otherwise to the cur‐
3481              rent directory.  Under other operating systems (expected  to  be
3482              UNIX/Linux,  including  OS-X),  the  default is the value of the
3483              system environment  variable  TMPDIR  if  it  exists,  otherwise
3484              "/tmp".
3485
3486       $use_make_for_missing_files [0]
3487              Whether to use make to try and make files that are missing after
3488              a run of *latex, and for which a custom dependency has not  been
3489              found.   This  is  generally useful only when latexmk is used as
3490              part of a bigger project which is built by using the  make  pro‐
3491              gram.
3492
3493              Note that once a missing file has been made, no further calls to
3494              make will be made on a subsequent run of latexmk to  update  the
3495              file.   Handling  this  problem is the job of a suitably defined
3496              Makefile.  See the section "USING latexmk WITH make" for how  to
3497              do  this.   The intent of calling make from latexmk is merely to
3498              detect dependencies.
3499
3500       $view ["default"]
3501              Which kind of file is to be previewed if a  previewer  is  used.
3502              The  possible  values  are  "default",  "dvi", "ps", "pdf".  The
3503              value of "default" means that the "highest" of the kinds of file
3504              generated is to be used (among .dvi, .ps and .pdf).
3505
3506
3507       $warnings_as_errors [0]
3508              Normally  latexmk copies the behavior of latex in treating unde‐
3509              fined references and citations and multiply  defined  references
3510              as  conditions  that give a warning but not an error.  The vari‐
3511              able $warnings_as_errors controls whether this behavior is modi‐
3512              fied.
3513
3514              When  the  variable  is  non-zero, latexmk at the end of its run
3515              will return a non-zero status code to the  operating  system  if
3516              any  of  the files processed gives a warning about problems with
3517              citations or references (i.e., undefined citations or references
3518              or multiply defined references).  This is after latexmk has com‐
3519              pleted all the runs it needs to try and resolve  references  and
3520              citations.   Thus  $warnings_as_errors  being nonzero causes la‐
3521              texmk to treat such warnings as errors, but only when they occur
3522              on the last run of *latex and only after processing is complete.
3523              A non-zero value $warnings_as_errors can be set by the  command-
3524              line option -Werror.
3525
3526              The default behavior is normally satisfactory in the usual edit-
3527              compile-edit cycle.  But, for example, latexmk can also be  used
3528              as  part  of  a build process for some bigger project, e.g., for
3529              creating documentation in the build of a  software  application.
3530              Then  it is often sensible to treat citation and reference warn‐
3531              ings as errors that require the  overall  build  process  to  be
3532              aborted.  Of course, since multiple runs of *latex are generally
3533              needed to resolve references and citations, what matters is  not
3534              the warnings on the first run, but the warnings on the last run;
3535              latexmk takes this into account appropriately.
3536
3537              In addition, when preview-continuous mode is  used,  a  non-zero
3538              value  for  $warnings_as_errors  changes the use of the commands
3539              $failure_cmd, $warning_cmd, and $success_cmd  after  a  complia‐
3540              tion.  If there are citation or reference warnings, but no other
3541              errors, the behavior is as follows. If $warning_cmd is  set,  it
3542              is  used.  If it is not set, then then if $warnings_as_errors is
3543              non-zero and $failure_cmd is set, then $failure_cmd.   Otherwise
3544              $success_cmd  is used, if it is set.  (The foregoing explanation
3545              is rather complicated, because latexmk has to deal with the case
3546              that one or more of the commands isn't set.)
3547
3548
3549       $xdv_mode [0]
3550              If  one, generate an xdv version of the document by use of xela‐
3551              tex.
3552
3553
3554       $xdvipdfmx ["xdvipdfmx -E -o %D %O %S"]
3555
3556              The program to make a pdf file from an xdv file  (used  in  con‐
3557              junction with xelatex when $pdf_mode=5).
3558
3559       $xdvipdfmx_silent_switch ["-q"]
3560              Switch(es) for the xdvipdfmx program when silent mode is on.
3561
3562       $xelatex ["xelatex %O %S"]
3563              Specifies  the  command line for the LaTeX processing program of
3564              when the xelatex program is called for.  See  the  documentation
3565              of  the -xelatex option for some special properties of latexmk's
3566              use of xelatex.
3567
3568              Note about xelatex: latexmk uses xelatex to make an .xdv  rather
3569              than  .pdf  file, with the .pdf file being created in a separate
3570              step.  This is enforced by the use of the -no-pdf option.  If %O
3571              is  part  of the command for invoking xelatex, then latexmk will
3572              insert the -no-pdf option automatically, otherwise you must pro‐
3573              vide  the option yourself.  See the documentation for the -pdfxe
3574              option for why latexmk makes a .xdv file rather than a .pdf file
3575              when xelatex is used.
3576
3577              To  do  a  coordinated  setting  of all of $dvilualatex, $latex,
3578              $pdflatex, $lualatex, and $xelatex, see  the  section  "Advanced
3579              Configuration".
3580
3581
3582       %xelatex_input_extensions
3583              This  variable specifies the extensions tried by latexmk when it
3584              finds that an xelatex run resulted in an error that a  file  has
3585              not  been  found,  and  the  file is given without an extension.
3586              This typically happens when LaTeX  commands  of  the  form  \in‐
3587              put{file}  or \includegraphics{figure}, when the relevant source
3588              file does not exist.
3589
3590              In this situation, latexmk searches for custom  dependencies  to
3591              make  the  missing  file(s),  but restricts it to the extensions
3592              specified by the variable  %xelatex_input_extensions.   The  de‐
3593              fault extensions are 'tex', 'pdf', 'jpg, and 'png'.
3594
3595              See details of the %latex_input_extensions for other information
3596              that equally applies to %xelatex_input_extensions.
3597
3598       $xelatex_silent_switch ["-interaction=batchmode"]
3599              Switch(es) for the xelatex program (specified  in  the  variable
3600              $xelatex) when silent mode is on.
3601
3602              See  details  of  the $latex_silent_switch for other information
3603              that equally applies to $xelatex_silent_switch.
3604
3605
3606
3607

CUSTOM DEPENDENCIES

3609       In any RC file a set of custom dependencies can be set up to convert  a
3610       file with one extension to a file with another.  An example use of this
3611       would be to allow latexmk to convert a .fig file to .eps to be included
3612       in the .tex file.
3613
3614
3615   Defining a custom dependency:
3616       The old method of configuring latexmk to use a custom dependency was to
3617       directly manipulate the @cus_dep_list array that  contains  information
3618       defining  the  custom  dependencies.   (See  the section "Old Method of
3619       Defining Custom Dependencies" for details.) This  method  still  works,
3620       but is no longer preferred.
3621
3622       A better method is to use the subroutines that allow convenient manipu‐
3623       lations of the custom dependency list.  These are
3624
3625           add_cus_dep( fromextension, toextension, must, subroutine )
3626           remove_cus_dep( fromextension, toextension )
3627           show_cus_dep()
3628
3629       The arguments are as follows:
3630
3631       from extension:
3632              The extension of the file we are converting from  (e.g.  "fig").
3633              It is specified without a period.
3634
3635       to extension:
3636              The extension of the file we are converting to (e.g. "eps").  It
3637              is specified without a period.
3638
3639       must:  If non-zero, the file from which we are converting  must  exist,
3640              if  it doesn't exist latexmk will give an error message and exit
3641              unless the -f option is specified.  If must is zero and the file
3642              we  are  converting from doesn't exist, then no action is taken.
3643              Generally, the appropriate value of must is zero.
3644
3645       function:
3646              The name of the subroutine that latexmk should call  to  perform
3647              the  file  conversion.   The first argument to the subroutine is
3648              the base name of the file to be converted without any extension.
3649              The  subroutines  are declared in the syntax of Perl.  The func‐
3650              tion should return 0 if it was successful and a  nonzero  number
3651              if it failed.
3652
3653
3654       Naturally  add_cus_dep adds a custom dependency with the specified from
3655       and to extensions.  If a custom dependency has been previously  defined
3656       (e.g.,  in an rcfile that was read earlier), then it is replaced by the
3657       new one.
3658
3659       The subroutine remove_cus_dep removes the specified custom  dependency.
3660       The subroutine show_cus_dep causes a list of the currently defined cus‐
3661       tom dependencies to be sent to the screen output.
3662
3663
3664   How custom dependencies are used:
3665       An instance of a custom dependency rule is created whenever latexmk de‐
3666       tects  that a run of *latex needs to read a file, like a graphics file,
3667       whose extension is the to-extension of a custom dependency.   Then  la‐
3668       texmk  examines  whether a file exists with the same name, but with the
3669       corresponding from-extension, as specified  in  the  custom-dependency.
3670       If  it  does, then a corresponding instance of the custom dependency is
3671       created, after which the rule is invoked whenever the destination  file
3672       (the one with the to-extension) is out-of-date with respect to the cor‐
3673       responding source file.
3674
3675       To make the new destination file, the Perl subroutine specified in  the
3676       rule is invoked, with an argument that is the base name of the files in
3677       question.  Simple cases just involve a subroutine invoking an  external
3678       program;  this  can  be  done by following the templates below, even by
3679       those without knowledge of the Perl programming language.   Of  course,
3680       experts could do something much more elaborate.
3681
3682       One  item  in the specification of each custom-dependency rule, labeled
3683       "must" above, specifies how the rule should be applied when the  source
3684       file fails to exist.
3685
3686       When  latex reports that an input file (e.g., a graphics file) does not
3687       exist, latexmk tries to find a source file and a custom dependency that
3688       can be used to make it.  If it succeeds, then it creates an instance of
3689       the custom dependency and invokes it to make the  missing  file,  after
3690       which the next pass of latex etc will be able to read the newly created
3691       file.
3692
3693       Note for advanced usage: The operating  system's  environment  variable
3694       TEXINPUTS can be used to specify a search path for finding files by la‐
3695       tex etc.  Correspondingly, when a missing  file  is  reported,  latexmk
3696       looks  in the directories specified in TEXINPUTS as well as in the cur‐
3697       rent directory, to find a source file from which an instance of a  cus‐
3698       tom dependency can be used to make the missing file.
3699
3700
3701   Function to implement custom dependency, traditional method:
3702       The  function  that implements a custom dependency gets the information
3703       on the files to be processed in two ways.  The first is through its one
3704       argument;  the argument contains the base name of the source and desti‐
3705       nation files.  The second way is described later.
3706
3707       A simple and typical example of code in an initialization rcfile  using
3708       the first method is:
3709
3710           add_cus_dep( 'fig', 'eps', 0, 'fig2eps' );
3711           sub fig2eps {
3712               system( "fig2dev -Leps \"$_[0].fig\" \"$_[0].eps\"" );
3713           }
3714
3715       The  first  line adds a custom dependency that converts a file with ex‐
3716       tension "fig", as created by the xfig program, to an encapsulated post‐
3717       script  file,  with extension "eps".  The remaining lines define a sub‐
3718       routine that carries out the conversion.   If  a  rule  for  converting
3719       "fig"  to  "eps"  files already exists (e.g., from a previously read-in
3720       initialization file), the latexmk will delete this rule  before  making
3721       the new one.
3722
3723       Suppose  latexmk  is  using this rule to convert a file "figure.fig" to
3724       "figure.eps".  Then it will invoke the fig2eps  subroutine  defined  in
3725       the  above  code with a single argument "figure", which is the basename
3726       of each of the files (possibly with a path component).   This  argument
3727       is  referred to by Perl as $_[0].  In the example above, the subroutine
3728       uses the Perl command system to invoke the program fig2dev.  The double
3729       quotes around the string are a Perl idiom that signify that each string
3730       of the form of a variable name, $_[0] in this case, is  to  be  substi‐
3731       tuted by its value.
3732
3733       If  the  return  value of the subroutine is non-zero, then latexmk will
3734       assume an error occurred during the execution of  the  subroutine.   In
3735       the  above  example, no explicit return value is given, and instead the
3736       return value is the value returned by the last  (and  only)  statement,
3737       i.e., the invocation of system, which returns the value 0 on success.
3738
3739       If  you  use  pdflatex,  lualatex or xelatex instead of latex, then you
3740       will probably prefer to convert your graphics files to pdf  format,  in
3741       which  case  you would replace the above code in an initialization file
3742       by
3743
3744           add_cus_dep( 'fig', 'pdf, 0, 'fig2pdf' );
3745           sub fig2pdf {
3746               system( "fig2dev -Lpdf \"$_[0].fig\" \"$_[0].pdf\"" );
3747           }
3748
3749       Note 1: In the command lines given in the system commands in the  above
3750       examples,  double  quotes have been inserted around the file names (im‐
3751       plemented by '\"' in the Perl language).  They immunize the running  of
3752       the  program against special characters in filenames.  Very often these
3753       quotes are not necessary, i.e., they can be omitted.  But  it  is  nor‐
3754       mally  safer  to  keep them in.  Even though the rules for quoting vary
3755       between operating systems, command  shells  and  individual  pieces  of
3756       software, the quotes in the above examples do not cause problems in the
3757       cases I have tested.
3758
3759       Note 2: One case in which the quotes are important is  when  the  files
3760       are  in  a subdirectory and your operating system is Microsoft Windows.
3761       Then the separator character for directory components can be  either  a
3762       forward  slash  '/' or Microsoft's more usual backward slash '\'.  For‐
3763       ward slashes are generated by latexmk,  to  maintain  its  sanity  from
3764       software  like  MiKTeX  that mixes both directory separators; but their
3765       correct use normally requires quoted filenames.  (See a log file from a
3766       run  of  MiKTeX  (at least in v. 2.9) for an example of the use of both
3767       directory separators.)
3768
3769       Note 3: The subroutines implementing custom dependencies in  the  exam‐
3770       ples  given  just  have  a  single  line  invoking an external program.
3771       That's the usual situation.  But since the subroutines are in the  Perl
3772       language,  you  can  implement  much more complicated processing if you
3773       need it.
3774
3775
3776   Removing custom dependencies, and when you might need to do this:
3777       If you have some general custom dependencies defined in the  system  or
3778       user  initialization  file,  you may find that for a particular project
3779       they are undesirable.  So you might want to delete the  unneeded  ones.
3780       A  situation  where this would be desirable is where there are multiple
3781       custom dependencies with the same from-extension or the same  to-exten‐
3782       sion.  In  that case, latexmk might choose a different one from the one
3783       you want for a specific project.  As an example, to remove any "fig" to
3784       "eps" rule you would use:
3785
3786           remove_cus_dep( 'fig', 'eps' );
3787
3788       If  you  have  complicated sets of custom dependencies, you may want to
3789       get a listing of the custom dependencies.  This is done  by  using  the
3790       line
3791
3792           show_cus_dep();
3793
3794       in an initialization file.
3795
3796
3797   Function implementing custom dependency, alternative methods:
3798       So far the examples for functions to implement custom dependencies have
3799       used the argument of the function to specify the base name of converted
3800       file.   This  method  has been available since very old versions of la‐
3801       texmk, and many examples can be found, e.g., on the web.
3802
3803       However in later versions of latexmk the internal structure of the  im‐
3804       plementation of its "rules" for the steps of processing, including cus‐
3805       tom dependencies, became much more powerful.  The function implementing
3806       a custom dependency is executed within a special context where a number
3807       of extra variables and subroutines are  defined.   Publicly  documented
3808       ones,  intended  to  be  long-term  stable, are listed below, under the
3809       heading "Variables and subroutines for processing a rule".
3810
3811       Examples of their use is given in the  following  examples,  concerning
3812       multiple index files and glossaries.
3813
3814       The  only  index-file  conversion built-in to latexmk is from an ".idx"
3815       file written on one run of *latex to an ".ind" file to be read in on  a
3816       subsequent  run.   But with the index.sty package, for example, you can
3817       create extra indexes with extensions that you configure.  Latexmk  does
3818       not know how to deduce the extensions from the information it has.  But
3819       you can easily write a custom dependency.  For example  if  your  latex
3820       file uses the command "\newindex{special}{ndx}{nnd}{Special index}" you
3821       will need to get latexmk to convert files with the  extension  .ndx  to
3822       .nnd.   The  most elementary method is to define a custom dependency as
3823       follows:
3824
3825           add_cus_dep( 'ndx', 'nnd', 0, 'ndx2nnd' );
3826           sub ndx2nnd {
3827               return system( "makeindex -o \"$_[0].nnd\" \"$_[0].ndx\"" );
3828           }
3829           push @generated_exts, 'ndx', 'nnd';
3830
3831       Notice the added line compared with earlier examples.  The  extra  line
3832       gets the extensions "ndx" and "nnd" added to the list of extensions for
3833       generated files; then the extra index files will be deleted by clean-up
3834       operations
3835
3836       But  if  you have yet more indexes with yet different extensions, e.g.,
3837       "adx" and "and", then you will need a separate function for  each  pair
3838       of  extensions.   This  is  quite  annoying.  You can use the Run_subst
3839       function to simplify the definitions to use a single function:
3840
3841           add_cus_dep( 'ndx', 'nnd', 0, 'dx2nd' );
3842           add_cus_dep( 'adx', 'and', 0, 'dx2nd' );
3843           sub dx2nd {
3844               return Run_subst( "makeindex -o %D %S" );
3845           }
3846           push @generated_exts, 'ndx', 'nnd', 'adx', 'and';
3847
3848       You could also instead use
3849
3850           add_cus_dep( 'ndx', 'nnd', 0, 'dx2nd' );
3851           add_cus_dep( 'adx', 'and', 0, 'dx2nd' );
3852           sub dx2nd {
3853               return Run_subst( $makeindex );
3854           }
3855           push @generated_exts, 'ndx', 'nnd', 'adx', 'and';
3856
3857       This last example uses the command specification in $makeindex, and  so
3858       any  customization you have made for the standard index also applies to
3859       your extra indexes.
3860
3861       Similar techniques can be applied for glossaries.
3862
3863       Those of you with experience with Makefiles, may get concerned that the
3864       .ndx  file  is  written during a run of *latex and is always later than
3865       the .nnd last read in.  Thus the .nnd appears to be perpetually out-of-
3866       date.   This  situation, of circular dependencies, is endemic to latex,
3867       and is one of the issues that latexmk is programmed  to  overcome.   It
3868       examines  the  contents  of  the files (by use of a checksum), and only
3869       does a remake when the file contents have actually changed.
3870
3871       Of course if you choose to write random data to the .nnd (or  the  .aux
3872       file,  etc) that changes on each new run, then you will have a problem.
3873       For real experts: See the %hash_calc_ignore_pattern if you have to deal
3874       with such problems.
3875
3876
3877   Old Method of Defining Custom Dependencies:
3878       In  much  older versions of latexmk, the only method of defining custom
3879       dependencies was to directly manipulate the table of  custom  dependen‐
3880       cies.  This is contained in the @cus_dep_list array.  It is an array of
3881       strings, and each string in the array has four items in it, each  sepa‐
3882       rated  by  a  space,  the  from-extension, the to-extension, the "must"
3883       item, and the name of the subroutine for the custom dependency.   These
3884       were all defined above.
3885
3886       An example of the old method of defining custom dependencies is as fol‐
3887       lows. It is the code in an RC file to ensure  automatic  conversion  of
3888       .fig files to .eps files:
3889
3890           push @cus_dep_list, "fig eps 0 fig2eps";
3891           sub fig2eps {
3892               return system( "fig2dev -Lps \"$_[0].fig\" \"$_[0].eps\"" );
3893           }
3894
3895       This  method  still  works,  and is almost equivalent to the code given
3896       earlier that used the add_cus_dep subroutine.  However, the old  method
3897       doesn't  delete any previous custom-dependency for the same conversion.
3898       So the new method is preferable.
3899
3900
3901

ADVANCED CONFIGURATION: Some extra resources and advanced tricks

3903       For most purposes, simple configuration for latexmk along the lines  of
3904       the  examples  given  is  sufficient.  But sometimes you need something
3905       harder.  In this section, I indicate some extra possibilities.   Gener‐
3906       ally  to  use  these, you need to be fluent in the Perl language, since
3907       this is what is used in the rc files.
3908
3909       See also the section DEALING WITH ERRORS, PROBLEMS, ETC.  See also  the
3910       examples in the directory example_rcfiles in the latexmk distributions.
3911       Even if none of the examples apply to your case, they may give you use‐
3912       ful ideas
3913
3914
3915   Utility subroutines
3916       ensure_path( var, values ...)
3917
3918              The  first parameter is the name of one of the system's environ‐
3919              ment variables for search paths.  The remaining  parameters  are
3920              values  that  should  be in the variable.  For each of the value
3921              parameters, if it isn't already in  the  variable,  then  it  is
3922              prepended to the variable; in that case the environment variable
3923              is created if it doesn't already exist. For  separating  values,
3924              the  character  appropriate  the the operating system is used --
3925              see the configuration variable $search_path_separator.
3926
3927              Example:
3928
3929                ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );
3930
3931              (In this example, the trailing '//' is documented by TeX systems
3932              to  mean that *latex search for files in the specified directory
3933              and in all subdirectories.)
3934
3935              Technically  ensure_path  works  by  setting   Perl's   variable
3936              $ENV{var},  where  var  is the name of the target variable.  The
3937              changed value is then passed as an environment variable  to  any
3938              invoked programs.
3939
3940
3941   Variables and subroutines for processing a rule
3942       A step in the processing is called a rule. One possibility to implement
3943       the processing of a rule is by a Perl subroutine.  This is  always  the
3944       case  for  custom dependencies. Also, for any other rule, you can use a
3945       subroutine by prefixing the command specification by the  word  "inter‐
3946       nal" -- see the section FORMAT OF COMMAND SPECIFICATIONS.
3947
3948       When  you use a subroutine for processing a rule, all the possibilities
3949       of Perl programming are available, of course.  In addition, some of la‐
3950       texmk's  internal  variables  and  subroutines are available.  The ones
3951       listed below are intended to be  available  to  (advanced)  users,  and
3952       their specifications will generally have stability under upgrades. Gen‐
3953       erally, the variables should be treated as  read-only:  Changing  their
3954       values  can  have  bad  consequences, since it is liable to mess up the
3955       consistency of what latexmk is doing.
3956
3957       $rule  This variable has the name of the rule,  as  known  to  latexmk.
3958              Note  that  the exact contents of this variable for a given rule
3959              may be dependent on the version of latexmk
3960
3961       $$Psource
3962              This gives the name of the primary source file.  Note the double
3963              dollar signs.
3964
3965       $$Pdest
3966              This  gives  the  name of the main output file if any.  Note the
3967              double dollar signs.
3968
3969       rdb_ensure_file( $rule, file )
3970              This a subroutine that ensures that the given file is among  the
3971              source files for the specified rule.  It is typically used when,
3972              during the processing of a rule, it is known that  a  particular
3973              extra  file  is among the dependencies that latexmk should know,
3974              but its default methods don't find the dependency. Almost always
3975              the  first argument is the name of the rule currently being pro‐
3976              cessed, so it is then appropriate to specify it by $rule.
3977
3978              For examples of its use, see some of the files in the  directory
3979              example_rcfiles  of latexmk's distribution.  Currently the cases
3980              that use this  subroutine  are  bib2gls-latexmkrc,  exceltex_la‐
3981              texmkrc  and  texinfo-latexmkrc.  These illustrate typical cases
3982              where latexmk's normal processing fails to detect certain  extra
3983              source files.
3984
3985       rdb_remove_files( $rule, file, ... )
3986              This  subroutine  removes  one or more files from the dependency
3987              list for the given rule.
3988
3989       rdb_list_source( $rule )
3990              This subroutine returns the list of source files (i.e., the  de‐
3991              pendency list) for the given rule.
3992
3993       rdb_set_source( $rule, file, ... )
3994
3995       rdb_set_source( $rule, @files )
3996              This  subroutine  sets the dependency list for the given rule to
3997              be the specified files.  Files that are already in the list have
3998              unchanged  information.   Files  that  were  not in the list are
3999              added to it.  Files in the previous dependency list that are not
4000              in the newly specified list of files are removed from the depen‐
4001              dency list.
4002
4003       Run_subst( command_spec )
4004              This subroutine runs the command specified by command_spec.  The
4005              specification  is  a  string in the format listed in the section
4006              "Format of Command Specifications".  An important action of  the
4007              Run_subst is to make substitutions of placeholders, e.g., %S and
4008              %D for source and destination files; these get  substituted  be‐
4009              fore the command is run.  In addition, the command after substi‐
4010              tution is printed to the screen unless  latexmk  is  running  in
4011              silent mode.
4012
4013
4014   Coordinated Setting of Commands for *latex
4015       To  set all of $dvilualatex, $latex, $pdflatex, $lualatex, and $xelatex
4016       to a common pattern, you can use  one  of  the  following  subroutines,
4017       std_tex_cmds, alt_tex_cmds, and set_tex_cmds.
4018
4019       They work as follows
4020
4021          &std_tex_cmds;
4022
4023       This results in $latex = 'latex %O %S', and similarly for $dvilualatex,
4024       $pdflatex, $lualatex, and $xelatex.  Note the ampersand in the  invoca‐
4025       tion; this indicates to Perl that a subroutine is being called.
4026
4027          &alt_tex_cmds;
4028
4029       This results in $latex = 'latex %O %P', and similarly for $dvilualatex,
4030       $pdflatex, $lualatex, and $xelatex.  Note the ampersand in the  invoca‐
4031       tion; this indicates to Perl that a subroutine is being called.
4032
4033         set_tex_cmds( CMD_SPEC );
4034
4035       Here  CMD_SPEC  is  the command line without the program name. This re‐
4036       sults in $latex = 'latex CMD_SPEC', and similarly for  $pdflatex,  $lu‐
4037       alatex, and $xelatex. An example would be
4038
4039         set_tex_cmds( '--interaction=batchmode %O %S' );
4040
4041
4042   Advanced configuration: Using latexmk with make
4043       This  section  is targeted only at advanced users who use the make pro‐
4044       gram for complex projects, as for software development, with the depen‐
4045       dencies specified by a Makefile.
4046
4047       Now  the  basic  task  of latexmk is to run the appropriate programs to
4048       make a viewable version of a LaTeX document.  However, the  usual  make
4049       program  is not suited to this purpose for at least two reasons.  First
4050       is that the use of LaTeX involves circular dependencies (e.g., via .aux
4051       files), and these cannot be handled by the standard make program.  Sec‐
4052       ond is that in a large document the set  of  source  files  can  change
4053       quite  frequently,  particularly  with included graphics files; in this
4054       situation keeping a Makefile manually updated is inappropriate and  er‐
4055       ror-prone, especially when the dependencies can be determined automati‐
4056       cally.  Latexmk solves both of these problems robustly.
4057
4058       Thus for many standard LaTeX documents latexmk can be  used  by  itself
4059       without  the  make program.  In a complex project it simply needs to be
4060       suitably configured.  A standard configuration would be to define  cus‐
4061       tom  dependencies to make graphics files from their source files (e.g.,
4062       as created by the xfig program).   Custom  dependencies  are  latexmk's
4063       equivalent of pattern rules in Makefiles.
4064
4065       Nevertheless  there  are  projects for which a Makefile is appropriate,
4066       and it is useful to know how to use latexmk from a Makefile.  A typical
4067       example would be to generate documentation for a software project.  Po‐
4068       tentially the interaction with the rest of the rules  in  the  Makefile
4069       could be quite complicated, for example if some of the source files for
4070       a LaTeX document are generated by the project's software.
4071
4072       In this section, I give a couple of examples of how latexmk can be use‐
4073       fully  invoked  from a Makefile.  The examples use specific features of
4074       current versions of GNU make, which is the default on  both  linux  and
4075       OS-X systems.  They may need modifications for other versions of make.
4076
4077       The simplest method is simply to delegate all the relevant tasks to la‐
4078       texmk, as is suitable for a straightforward LaTeX document.  For this a
4079       suitable Makefile is like
4080
4081           .PHONY : FORCE_MAKE
4082           all : try.pdf
4083           %.pdf : %.tex FORCE_MAKE
4084               latexmk -pdf -dvi- -ps- $<
4085
4086       (Note:  the  last  line must be introduced by a tab for the Makefile to
4087       function correctly!)  Naturally, if making try.pdf from its  associated
4088       LaTeX  file try.tex were the only task to be performed, a direct use of
4089       latexmk without a Makefile would normally be better.   The  benefit  of
4090       using  a  Makefile  for  a LaTeX document would be in a larger project,
4091       where lines such as the above would be only be a small part of a larger
4092       Makefile.
4093
4094       The above example has a pattern rule for making a .pdf file from a .tex
4095       file, and it is defined to use latexmk in the obvious way.  There is  a
4096       conventional  default  target  named  "all",  with  a  prerequisite  of
4097       try.pdf.  So when make is invoked, by default it  makes  try.pdf.   The
4098       only  complication  is  that  there  may  be  many  source files beyond
4099       try.tex, but these aren't specified in the Makefile, so changes in them
4100       will  not by themselves cause latexmk to be invoked.  Instead, the pat‐
4101       tern rule is equipped with a "phony" prerequisite FORCE_MAKE; this  has
4102       the  effect  of  causing the rule to be always out-of-date, so that la‐
4103       texmk is always run.  It is latexmk that decides whether any action  is
4104       needed,  e.g., a rerun of pdflatex.  Effectively the Makefile delegates
4105       all decisions to latexmk, while make has no knowledge of  the  list  of
4106       source files except for primary LaTeX file for the  document.  If there
4107       are, for example, graphics files to be made, these must be made by cus‐
4108       tom dependencies configured in latexmk.
4109
4110       But  something better is needed in more complicated situations, for ex‐
4111       ample, when the making of graphics files needs to be specified by rules
4112       in  the  Makefile.  To do this, one can use a Makefile like the follow‐
4113       ing:
4114
4115            TARGETS = document1.pdf document2.pdf
4116            DEPS_DIR = .deps
4117            LATEXMK = latexmk -recorder -use-make -deps \
4118                  -e 'warn qq(In Makefile, turn off custom dependencies\n);' \
4119                  -e '@cus_dep_list = ();' \
4120                  -e 'show_cus_dep();'
4121            all : $(TARGETS)
4122            $(foreach file,$(TARGETS),$(eval -include $(DEPS_DIR)/$(file)P))
4123            $(DEPS_DIR) :
4124                   mkdir $@
4125            %.pdf : %.tex
4126                   if [ ! -e $(DEPS_DIR) ]; then mkdir $(DEPS_DIR); fi
4127                   $(LATEXMK) -pdf -dvi- -ps- -deps-out=$(DEPS_DIR)/$@P $<
4128            %.pdf : %.fig
4129                   fig2dev -Lpdf $< $@
4130
4131       (Again, the lines containing the  commands  for  the  rules  should  be
4132       started with tabs.)  This example was inspired by how GNU automake han‐
4133       dles automatic dependency tracking of C source files.
4134
4135       After each run of latexmk, dependency information is put in a  file  in
4136       the  .deps subdirectory.  The Makefile causes these dependency files to
4137       be read by make, which now has the full dependency information for each
4138       target  .pdf  file.   To make things less trivial it is specificed that
4139       two files document1.pdf and document2.pdf are the targets.  The  depen‐
4140       dency files are .deps/document1.pdfP and .deps/document2.pdfP.
4141
4142       There  is  now  no need for the phony prerequisite for the rule to make
4143       .pdf files from .tex files.  But I have added a rule to make .pdf files
4144       from  .fig  files produced by the xfig program; these are commonly used
4145       for graphics insertions in LaTeX documents.   Latexmk  is  arranged  to
4146       output a dependency file after each run.  It is given the -recorder op‐
4147       tion, which improves its detection of files generated during a  run  of
4148       pdflatex;  such files should not be in the dependency list.  The -e op‐
4149       tions are used to turn off all custom  dependencies,  and  to  document
4150       this.   Instead the -use-make is used to delegate the making of missing
4151       files to make itself.
4152
4153       Suppose in the LaTeX file there is a  command  \includegraphics{graph},
4154       and  an xfig file "graph.fig" exists.  On a first run, pdflatex reports
4155       a missing file, named "graph". Latexmk succeeds in  making  "graph.pdf"
4156       by calling "make graph.pdf", and after completion of its work, it lists
4157       "fig.pdf" among the dependents of the file latexmk is making.  Then let
4158       "fig.fig"  be  updated,  and  then let make be run.  Make first remakes
4159       "fig.pdf", and only then reruns latexmk.
4160
4161       Thus we now have a method by which all  the  subsidiary  processing  is
4162       delegated to make.
4163
4164

NON_ASCII CHARACTERS IN FILENAMES, RC FILES, ETC

4166       Modern operating systems and file systems allow non-ASCII characters in
4167       the names of files and directories  that  encompass  the  full  Unicode
4168       range.  Mostly, latexmk deals with these correctly.  However, there are
4169       some situations in which there are problems, notably on Microsoft  Win‐
4170       dows.  Prior to version 4.77, latexmk had problems with non-ASCII file‐
4171       names on Windows, even though there were no corresponding  problems  on
4172       macOS and Linux.  These problems are corrected in the present version.
4173
4174       DETAILS TO BE FILLED IN
4175
4176
4177

SEE ALSO

4179       latex(1), bibtex(1), lualatex(1), pdflatex(1), xelatex(1).
4180
4181

BUGS (SELECTED)

4183       Sometimes a viewer (gv) tries to read an updated .ps or .pdf file after
4184       its creation is started but before the file is complete.  Work  around:
4185       manually refresh (or reopen) display.  Or use one of the other preview‐
4186       ers and update methods.
4187
4188       (The following isn't really a bug, but concerns  features  of  preview‐
4189       ers.)   Preview  continuous mode only works perfectly with certain pre‐
4190       viewers: Xdvi on UNIX/Linux works for  dvi  files.   Gv  on  UNIX/Linux
4191       works  for  both  postscript  and pdf.  Ghostview on UNIX/Linux needs a
4192       manual update (reopen); it views postscript and pdf.  Gsview under  MS-
4193       Windows  works  for both postscript and pdf, but only reads the updated
4194       file when its screen is refreshed.   Acroread  under  UNIX/Linux  views
4195       pdf,  but  the  file needs to be closed and reopened to view an updated
4196       version.  Under MS-Windows, acroread locks its input file  and  so  the
4197       pdf  file  cannot  be updated.  (Remedy: configure latexmk to use suma‐
4198       trapdf instead.)
4199

THANKS TO

4201       Authors of previous versions.  Many users with their feedback, and  es‐
4202       pecially David Coppit (username david at node coppit.org) who made many
4203       useful suggestions that contributed to version 3, and  Herbert  Schulz.
4204       (Please  note  that the e-mail addresses are not written in their stan‐
4205       dard form to avoid being harvested too easily.)
4206

AUTHOR

4208       Current version, by John Collins (Version 4.79).  Report  bugs  etc  to
4209       his e-mail (jcc8 at psu.edu).
4210
4211       Released      version      can      be      obtained     from     CTAN:
4212       <http://www.ctan.org/pkg/latexmk/>,  and  from  the  author's   website
4213       <http://www.personal.psu.edu/jcc8/latexmk/>.
4214       Modifications and enhancements by Evan McLean (Version 2.0)
4215       Original script called "go" by David J. Musliner (RCS Version 3.2)
4216
4217
4218
4219
4220
4221
4222
4223
4224
4225
4226
4227
4228                                7 January 2023                      LATEXMK(1)
Impressum