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

EXAMPLES

1271       % latexmk thesis    # run latex enough times to resolve
1272                           cross-references
1273
1274       % latexmk -pvc -ps thesis# run latex enough times to resolve
1275                           cross-references, make a postscript
1276                           file, start a previewer.  Then
1277                           watch for changes in the source
1278                           file thesis.tex and any files it
1279                           uses.  After any changes rerun latex
1280                           the appropriate number of times and
1281                           remake the postscript file.  If latex
1282                           encounters an error, latexmk will
1283                           keep running, watching for
1284                           source file changes.
1285
1286       % latexmk -c        # remove .aux, .log, .bbl, .blg, .dvi,
1287                           .pdf, .ps & .bbl files
1288
1289
1290

DEALING WITH ERRORS, PROBLEMS, ETC

1292       Some possibilities:
1293
1294       a. If you get a strange error, do look carefully at the output that  is
1295       on  the  screen  and in log files.  While there is much that is notori‐
1296       ously verbose in the output of latex (and that is added to by latexmk),
1297       the  verbosity  is  there  for a reason: to enable the user to diagnose
1298       problems.  Latexmk does repeat some messages at the end of a  run  that
1299       it  thinks  would otherwise be easy to miss in the middle of other out‐
1300       put.
1301
1302       b. Generally, remember that latexmk does its work by running other pro‐
1303       grams.  Your first priority in dealing with errors should be to examine
1304       what went wrong with the individual programs.  Then you need to correct
1305       the  causes of errors in the runs of these programs.  (Often these come
1306       from errors in the source document, but they could also be about  miss‐
1307       ing LaTeX packages, etc.)
1308
1309       c. If latexmk doesn't run the programs the way you would like, then you
1310       need to look in this documentation at the list of command line  options
1311       and  then at the sections on configuration/initialization files.  A lot
1312       of latexmk's behavior is configurable to deal  with  particular  situa‐
1313       tions.  (But there is a lot of reading!)
1314
1315       The  remainder  of  these notes consists of ideas for dealing with more
1316       difficult situations.
1317
1318       d. Further tricks can involve replacing the standard commands that  la‐
1319       texmk runs by other commands or scripts.
1320
1321       e.  For possible examples of code for use in an RC file, see the direc‐
1322       tory  example_rcfiles  in  the  distribution  of  latexmk   (e.g.,   at
1323       http://mirror.ctan.org/support/latexmk/example_rcfiles).  Even if these
1324       examples don't do what you want, they may provide suitable inspiration.
1325
1326       f. There's a useful trick that can be used when you  use  lualatex  in‐
1327       stead  of  pdflatex  (and  in some related situations).  The problem is
1328       that latexmk won't notice a dependency on a file, bar.baz say, that  is
1329       input  by  the  lua code in your document instead of by the LaTeX part.
1330       (Thus if you change bar.baz and rerun latexmk, then latexmk will  think
1331       no  files have changed and not rerun lualatex, whereas if you had '\in‐
1332       put{bar.baz}' in the LaTeX part of the document, latexmk  would  notice
1333       the  change.)   One  solution is just to put the following somewhere in
1334       the LaTeX part of the document:
1335
1336                     \typeout{(bar.baz)}
1337
1338       This puts a line in the log file that latexmk will  treat  as  implying
1339       that  the file bar.baz was read.  (At present I don't know a way of do‐
1340       ing this automatically.)  Of course, if the file has a different  name,
1341       change bar.baz to the name of your file.
1342
1343       g. See also the section "Advanced Configuration: Some extra resources".
1344
1345       h.    Look   on   tex.stackexchange,   i.e.,   at   http://tex.stackex
1346       change.com/questions/tagged/latexmk  Someone may  have  already  solved
1347       your problem.
1348
1349       i. Ask a question at tex.stackexchange.com.
1350
1351       j.  Or ask me (the author of latexmk).  My e-mail is at the end of this
1352       documentation.
1353
1354
1355

ALLOWING FOR CHANGE OF OUTPUT FILE TYPE

1357       When one of the latex engines is run, the usual situation is that latex
1358       produces  a .dvi file, while pdflatex and lualatex produce a .pdf file.
1359       For xelatex the default is to produce a .pdf file, but to optimize pro‐
1360       cessing  time  latexmk  runs xelatex its -no-pdf option so that it pro‐
1361       duces an .xdv file.  Further processing by  latexmk  takes  this  as  a
1362       starting point.
1363
1364       However, the actual output file may differ from the normal expectation;
1365       and then latexmk can adjust its processing to accommodate  this  situa‐
1366       tion.   The  difference in output file type can happen for two reasons:
1367       One is that for latex, pdflatex and lualatex the  document  itself  can
1368       override  the defaults. The other is that there may be a configuration,
1369       or misconfiguration, such that the program that latexmk invokes to com‐
1370       pile  the  document is not the expected one, or is given options incom‐
1371       patible with what latexmk initially expects.
1372
1373       Under latex and pdflatex, control of the output format by the  document
1374       is  done by setting the \pdfoutput macro.  Under lualatex, the \output‐
1375       mode macro is used instead.
1376
1377       One example of an important use-case for document control of the output
1378       format  is  a document that uses the psfrag package to insert graphical
1379       elements in the output file. The psfrag package achieves its effects by
1380       inserting postscript code in the output of the compilation of the docu‐
1381       ment.  This entails the use of compilation to a .dvi file, followed  by
1382       the  use  of  conversion  to  a postscript file (either directly, as by
1383       dvips or implicitly, as an intermediate step by dvipdf).   Then  it  is
1384       useful  to  force output to be of the .dvi format by inserting \pdfout‐
1385       put=0 in the preamble of the document.
1386
1387       Another example is where the document uses graphics file of  the  .pdf,
1388       .jpg,  and  png types.  With the default setting for the graphicx pack‐
1389       age, these can be processed in compilation to .pdf but not with  compi‐
1390       lation  to  .dvi.  In this case, it is useful to insert \pdfoutput=1 in
1391       the preamble of the document to force compilation to .pdf  output  for‐
1392       mat.
1393
1394       In all of these cases, it is needed that latexmk has to adjust its pro‐
1395       cessing to deal with a mismatch between the actual output  format  (out
1396       of  .pdf,  .dvi,  .xdv) and the initially expected output, if possible.
1397       Latexmk does this provided the following conditions are met.
1398
1399       The first is that latexmk's $allow_switch configuration variable is set
1400       to  a  non-zero value as it is by default.  If this variable is zero, a
1401       mismatch of filetypes in the compilation results in an erro.
1402
1403       The second condition for latexmk to be able to handle a change of  out‐
1404       put  type is that no explicit requests for .dvi or .ps output files are
1405       made.   Explicit  requests  are  by  the  -dvi  and  -ps,   -print=dvi,
1406       -print=ps,  -view=dvi,  and -view=ps options, and by corresponding set‐
1407       tings of the $dvi_mode, $postscript_mode, $print_type, and  $view  con‐
1408       figuration  variables.   The print-type and view-type restrictions only
1409       apply when printing and viewing are explicitly requested, respectively.
1410       For  this  purpose,  the use of the -pdfdvi and -pdfps options (and the
1411       corresponding setting of the $pdf_mode variable) does not count  as  an
1412       explicit  request  for the .dvi and .ps files; they are merely regarded
1413       as a request for making a .pdf file together with an  initial  proposal
1414       for the processing route to make it.
1415
1416       Note that when accommodating a change in output file type, there is in‐
1417       volved a substantial change in the network of rules that  latexmk  uses
1418       in  its  actions.  The second condition applied to accommodate a change
1419       is to avoid situations where the change in the rule network is too rad‐
1420       ical to be readily handled automatically.
1421
1422
1423

CONFIGURATION/INITIALIZATION (RC) FILES

1425       In  this section is explained which configuration files are read by la‐
1426       texmk. Subsequent sections "How  to  Set  Variables  in  Initialization
1427       Files",  "Format  of  Command  Specifications",  "List of Configuration
1428       Variables Usable in Initialization Files", "Custom  Dependencies",  and
1429       "Advanced  Configuration"  give  details  on what can be configured and
1430       how.
1431
1432       Latexmk can be customized using initialization files, which are read at
1433       startup in the following order:
1434
1435       1) The system RC file, if it exists.
1436          On a UNIX system, latexmk searches for following places for its sys‐
1437       tem RC file, in the following order, and reads the first it finds:
1438          "/opt/local/share/latexmk/LatexMk",
1439          "/usr/local/share/latexmk/LatexMk",
1440          "/usr/local/lib/latexmk/LatexMk".
1441          On a Fedora system, it only looks for "/etc/latexmk.conf".
1442          On a MS-Windows system it looks for "C:\latexmk\LatexMk".
1443          On a cygwin system (i.e., a MS-Windows system in which Perl is  that
1444       of cygwin), latexmk reads the first it finds of
1445          "/cygdrive/c/latexmk/LatexMk",
1446          "/opt/local/share/latexmk/LatexMk",
1447          "/usr/local/share/latexmk/LatexMk",
1448          "/usr/local/lib/latexmk/LatexMk".
1449
1450       In addition, it then tries the same set of locations, but with the file
1451       name replaced "LatexMk" replaced by "latexmkrc".
1452
1453       If the environment variable LATEXMKRCSYS is set, its value is  used  as
1454       the name of the system RC file, instead of any of the above.
1455
1456       2) The user's RC file, if it exists.  This can be in one of two places.
1457       The traditional one is ".latexmkrc" in the user's home directory.   The
1458       other  possibility  is "latexmk/latexmkrc" in the user's XDG configura‐
1459       tion home directory.  The actual file read is the first  of  "$XDG_CON‐
1460       FIG_HOME/latexmk/latexmkrc"  or  "$HOME/.latexmkrc" which exists.  (See
1461       https://specifications.freedesktop.org/basedir-spec/basedir-spec-lat
1462       est.html for details on the XDG Base Directory Specification.)
1463
1464       Here  $HOME  is  the  user's  home  directory.  [Latexmk determines the
1465       user's home directory as follows:  It is the value of  the  environment
1466       variable  HOME,  if this variable exists, which normally is the case on
1467       UNIX-like systems (including Linux and OS-X).  Otherwise  the  environ‐
1468       ment  variable USERPROFILE is used, if it exists, which normally is the
1469       case on MS-Windows systems. Otherwise a blank string is used instead of
1470       $HOME, in which case latexmk does not look for an RC file in it.]
1471
1472       $XDG_CONFIG_HOME  is  the  value  of  the environment variable XDG_CON‐
1473       FIG_HOME if it exists.  If this environment variable  does  not  exist,
1474       but  $HOME  is  non-blank,  then $XDG_CONFIG_HOME is set to the default
1475       value of $HOME/.config.  Otherwise $XDG_CONFIG_HOME is blank,  and  la‐
1476       texmk does not look for an RC file under it.
1477
1478
1479       3)  The  RC  file  in  the current working directory.  This file can be
1480       named either "latexmkrc" or ".latexmkrc", and the first of these to  be
1481       found is used, if any.
1482
1483       4) Any RC file(s) specified on the command line with the -r option.
1484
1485       Each RC file is a sequence of Perl commands.  Naturally, a user can use
1486       this in creative ways.  But for most purposes, one simply  uses  a  se‐
1487       quence of assignment statements that override some of the built-in set‐
1488       tings of Latexmk.  Straightforward cases can be handled without  knowl‐
1489       edge  of  the  Perl  language by using the examples in this document as
1490       templates.  Comment lines are introduced by the "#" character.
1491
1492       Note that command line options are obeyed in the order  in  which  they
1493       are written; thus any RC file specified on the command line with the -r
1494       option can override previous options but can be  itself  overridden  by
1495       later  options on the command line.  There is also the -e option, which
1496       allows initialization code to be specified in latexmk's command line.
1497
1498        For possible examples of code for in an RC file, see the directory ex‐
1499       ample_rcfiles  in  the  distribution  of  latexmk (e.g., at http://mir
1500       ror.ctan.org/support/latexmk/example_rcfiles).
1501
1502

HOW TO SET VARIABLES IN INITIALIZATION FILES

1504       The important variables that can be configured  are  described  in  the
1505       section  "List  of  configuration  variables  usable  in initialization
1506       files".  (See the earlier  section  "Configuration/Initialization  (rc)
1507       Files"  for  the  files where the configurations are done.)  Syntax for
1508       setting these variables is of the following forms:
1509
1510                           $bibtex = 'bibtex %O %S';
1511
1512       for the setting of a string variable,
1513
1514                           $preview_mode = 1;
1515
1516       for the setting of a numeric variable, and
1517
1518                           @default_files = ('paper', 'paper1');
1519
1520       for the setting of an array of strings.  It is possible  to  append  an
1521       item to an array variable as follows:
1522
1523                           push @default_files, 'paper2';
1524
1525       Note  that  simple  "scalar"  variables  have names that begin with a $
1526       character and array variables have names that begin with a @ character.
1527       Each statement ends with a semicolon.
1528
1529       Strings  should  be  enclosed  in single quotes.  (You could use double
1530       quotes, as in many programming languages.  But then the  Perl  program‐
1531       ming  language  brings  into  play some special rules for interpolating
1532       variables into strings.  People not fluent in Perl will want  to  avoid
1533       these complications.)
1534
1535       You  can do much more complicated things, but for this you will need to
1536       consult a manual for the Perl programming language.
1537
1538
1539
1540

FORMAT OF COMMAND SPECIFICATIONS

1542       Some of the variables set the commands that latexmk uses  for  carrying
1543       out  its  work, for example to generate a .dvi file from a .tex file or
1544       to view a postscript file.  This section describes some important  fea‐
1545       tures of how the commands are specified.  (Note that some of the possi‐
1546       bilities listed here do not apply to the $kpsewhich variable;  see  its
1547       documentation.)
1548
1549       Placeholders:  Supposed you wanted latexmk to use the command elatex in
1550       place of the regular latex  command,  and  suppose  moreover  that  you
1551       wanted  to  give  it the option "--shell-escape".  You could do this by
1552       the following setting:
1553
1554            $latex = 'elatex --shell-escape %O %S';
1555
1556       The two items starting with the % character  are  placeholders.   These
1557       are  substituted by appropriate values before the command is run.  Thus
1558       %S will be replaced by the source file that elatex will be applied  to,
1559       and  %O will be replaced by any options that latexmk has decided to use
1560       for this command.  (E.g., if you used the -silent option in the invoca‐
1561       tion  of  latexmk,   it  results in the replacement of %O by "-interac‐
1562       tion=batchmode".)
1563
1564       The available placeholders are:
1565
1566       %A     basename of the main tex file.  Unlike %R, this is unaffected by
1567              the setting of a jobname by  the -jobname option or the $jobname
1568              configuration value.
1569
1570       %B     base of filename for current command.   E.g.,  if  a  postscript
1571              file  document.ps  is being made from the dvi file document.dvi,
1572              then the basename is document.
1573
1574       %D     destination file (e.g., the name of  the  postscript  file  when
1575              converting a dvi file to postscript).
1576
1577       %O     options
1578
1579       %P     If  the  variable $pre_tex_code is non-empty, then %P is substi‐
1580              tuted  by  the  contents  of  $pre_tex_code  followed  by   \in‐
1581              put{SOURCE},  where  SOURCE  stands  for  the name of the source
1582              file.  Appropriate quoting is done.  This enables TeX code to be
1583              passed  to  one  of the *latex engines to be executed before the
1584              source file is read.
1585
1586              If the variable $pre_tex_code is the empty string,  then  %P  is
1587              equivalent to %S.
1588
1589       %R     root filename.  This is the base name for the main tex file.
1590
1591              By  default  this is the basename of the main tex file.  However
1592              the value can be changed by the use of the  -jobname  option  or
1593              the $jobname configuration variable.
1594
1595       %S     source  file  (e.g.,  the name of the dvi file when converting a
1596              .dvi file to ps).
1597
1598       %T     The name of the primary tex file.
1599
1600       %U     If the variable $pre_tex_code is non-empty, then  its  value  is
1601              substituted  for %U (appropriately quoted).  Otherwise it is re‐
1602              placed by a null string.
1603
1604       %Y     Name of directory for auxiliary output files (see the configura‐
1605              tion variable $aux_dir).  A directory separation character ('/')
1606              is appended if $aux_dir is non-empty and does not end in a suit‐
1607              able character, with suitable characters being those appropriate
1608              to UNIX and MS-Windows, i.e., ':', '/' and '\'.   Note  that  if
1609              after  initialization,  $out_dir is set, but $aux_dir is not set
1610              (i.e., it is blank), then latexmk  sets  $aux_dir  to  the  same
1611              value $out_dir.
1612
1613       %Z     Name  of directory for output files (see the configuration vari‐
1614              able $out_dir).  A directory separation character ('/')  is  ap‐
1615              pended  if  $out_dir is non-empty and does not end in a suitable
1616              character, with suitable characters being those  appropriate  to
1617              UNIX and MS-Windows, i.e., ':', '/' and '\'.
1618
1619       If  for  some  reason you need a literal % character in your string not
1620       subject to the above rules, use "%%".
1621
1622       Appropriate quoting will be applied to the filename  substitutions,  so
1623       you  mustn't  supply them yourself even if the names of your files have
1624       spaces in them.  (But if your TeX filenames have spaces in them, beware
1625       that  some  older  versions  of the TeX program cannot correctly handle
1626       filenames containing spaces.)  In case latexmk's quoting does not  work
1627       correctly  on your system, you can turn it off -- see the documentation
1628       for the variable $quote_filenames.
1629
1630       See the default values in the section "List of configuration  variables
1631       usable in initialization files" for what is normally the most appropri‐
1632       ate usage.
1633
1634       If you omit to supply any placeholders whatever in the specification of
1635       a  command,  latexmk will supply what its author thinks are appropriate
1636       defaults.  This gives compatibility with configuration files for previ‐
1637       ous versions of latexmk, which didn't use placeholders.
1638
1639       "Detaching"  a  command: Normally when latexmk runs a command, it waits
1640       for the command to run to completion.  This is appropriate for commands
1641       like latex, of course.  But for previewers, the command should normally
1642       run detached, so that latexmk gets the previewer running and  then  re‐
1643       turns  to  its next task (or exits if there is nothing else to do).  To
1644       achieve this effect of detaching a command, you  need  to  precede  the
1645       command name with "start ", as in
1646
1647            $dvi_previewer = 'start xdvi %O %S';
1648
1649       This  will  be translated to whatever is appropriate for your operating
1650       system.
1651
1652       Notes: (1) In some circumstances, latexmk will always run a command de‐
1653       tached.   This  is the case for a previewer in preview continuous mode,
1654       since otherwise previewing continuously makes no sense.  (2) This  pre‐
1655       cludes  the  possibility  of running a command named start.  (3) If the
1656       word start occurs more than  once  at  the  beginning  of  the  command
1657       string,  that is equivalent to having just one.  (4) Under cygwin, some
1658       complications happen, since cygwin amounts to a complicated merging  of
1659       UNIX  and  MS-Windows.   See  the  source code for how I've handled the
1660       problem.
1661
1662       Command names containing spaces: Under MS-Windows it is common that the
1663       name of a command includes spaces, since software is often installed in
1664       a subdirectory of "C:\Program Files".  Such command names should be en‐
1665       closed in double quotes, as in
1666
1667            $lpr_pdf  =  '"c:/Program  Files/Ghostgum/gsview/gsview32.exe"  /p
1668       %S';
1669            $pdf_previewer   =   'start   "c:/Program   Files/SumatraPDF/Suma‐
1670       traPDF.exe" %O %S';
1671            $pdf_previewer  =  'start "c:/Program Files/SumatraPDF (x86)/Suma‐
1672       traPDF.exe" %O %S';
1673
1674
1675       (Note about the above example: Under  MS-Windows  forward  slashes  are
1676       equivalent to backslashes in a filename under almost all circumstances,
1677       provided that the filename is inside double quotes.  It  is  easier  to
1678       use forward slashes in examples like the one above, since then one does
1679       not have to worry about the rules for dealing with forward  slashes  in
1680       strings in the Perl language.)
1681
1682       Command  names  under  Cygwin: If latexmk is executed by Cygwin's Perl,
1683       be particularly certain that pathnames in commands have forward slashes
1684       not  the  usual  backslashes  for the separator of pathname components.
1685       See the above examples.  Backslashes often get  misinterpreted  by  the
1686       Unix shell used by Cygwin's Perl to execute external commands.  Forward
1687       slashes don't suffer from this problem, and (when quoted, as above) are
1688       equally acceptable to MS-Windows.
1689
1690       Using  MS-Windows  file  associations: A useful trick under modern ver‐
1691       sions of MS-Windows (e.g., WinXP) is to use just the command 'start' by
1692       itself:
1693
1694            $dvi_previewer = 'start %S';
1695
1696       Under MS-Windows, this will cause to be run whatever program the system
1697       has associated with dvi files.  (The  same  applies  for  a  postscript
1698       viewer and a pdf viewer.)  But note that this trick is not always suit‐
1699       able for the pdf previwer, if your system has acroread for the  default
1700       pdf viewer.  As explained elsewhere, acroread under MS-Windows does not
1701       work well with latex and latexmk, because acroread locks the pdf file.
1702
1703       Not using a certain command: If a command is not to be run, the command
1704       name NONE is used, as in
1705
1706            $lpr  = 'NONE lpr';
1707
1708       This  typically  is  used when an appropriate command does not exist on
1709       your system.  The string after the "NONE" is effectively a comment.
1710
1711       Options to commands: Setting the name of a command can be used not only
1712       for changing the name of the command called, but also to add options to
1713       command.  Suppose you want latexmk to use latex  with  source  specials
1714       enabled.   Then  you  might use the following line in an initialization
1715       file:
1716
1717            $latex = 'latex --src-specials %O %S';
1718
1719       Running a subroutine instead of an external command: Use  a  specifica‐
1720       tion starting with "internal", as in
1721
1722            $latex = 'internal mylatex %O %S';
1723            sub mylatex {
1724                my @args = @_;
1725                # Possible preprocessing here
1726                return system 'latex', @args;
1727            }
1728
1729       For  some  of the more exotic possibilities that then become available,
1730       see the section "ADVANCED CONFIGURATION: Some extra resources  and  ad‐
1731       vanced  tricks".  Also  see some of the examples in the directory exam‐
1732       ple_rcfiles in the latexmk distribution.
1733
1734       Advanced tricks: Normally one specifies a single command for  the  com‐
1735       mands  invoked by latexmk.  Naturally, if there is some complicated ad‐
1736       ditional processing you need to do in your special situation,  you  can
1737       write a script (or batch file) to do the processing, and then configure
1738       latexmk to use your script in place of the standard program.
1739
1740       You can also use a Perl subroutine instead of a script  --  see  above.
1741       This is generally the most flexible and portable solution.
1742
1743       It is also possible to configure latexmk to run multiple commands.  For
1744       example, if when running pdflatex to generate a pdf  file  from  a  tex
1745       file you need to run another program after pdflatex to perform some ex‐
1746       tra processing, you could do something like:
1747
1748            $pdflatex = 'pdflatex --shell-escape  %O  %S;  pst2pdf_for_latexmk
1749       %B';
1750
1751       This  definition  assumes  you  are using a UNIX-like system (which in‐
1752       cludes Linux and OS-X), so that the two commands to be  run  are  sepa‐
1753       rated by the semicolon in the middle of the string.
1754
1755       If you are using MS-Windows, you would replace the above line by
1756
1757          $pdflatex = 'cmd /c pdflatex --shell-escape %O %S'
1758                      . '&& pst2pdf_for_latexmk %B';
1759
1760       Here,  the  UNIX  command  separator ; is replaced by &&.  In addition,
1761       there is a problem that some versions of Perl on MS-Windows do not obey
1762       the  command separator; this problem is overcome by explicitly invoking
1763       the MS-Windows command-line processor cmd.exe.
1764
1765

LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES

1767       In this section are specified the variables whose  values  can  be  ad‐
1768       justed  to  configure  latexmk.   (See  the earlier section "Configura‐
1769       tion/Initialization (rc) Files" for the files where the  configurations
1770       are done.)
1771
1772       Default values are indicated in brackets.  Note that for variables that
1773       are boolean in character, concerning whether latexmk does or  does  not
1774       behave  in a certain way, a non-zero value, normally 1, indicates true,
1775       i.e., the behavior occurs, while a zero value indicates a false  value,
1776       i.e., the behavior does not occur.
1777
1778
1779       $allow_switch [1]
1780
1781              This  controls  what happens when the output extension of latex,
1782              pdflatex, lualatex or xelatex differs  from  what  is  expected.
1783              (The possible extensions are .dvi, .pdf, .xdv.)  This can happen
1784              with the use of the \pdfoutput macro in a document compiled  un‐
1785              der  latex or pdflatex, or with the use of the \outputmode macro
1786              under lualatex.  It can also happen with certain kinds of incor‐
1787              rect configuration.
1788
1789              In  such a case, latexmk can appropriately adjust its network of
1790              rules.  The adjustment is made if $allow_switch is on, and if no
1791              request for a dvi or ps file has been made.
1792
1793              See the section ALLOWING FOR CHANGE OF OUTPUT EXTENSION.
1794
1795
1796       $always_view_file_via_temporary [0]
1797              Whether  .ps and .pdf files are initially to be made in a tempo‐
1798              rary directory and then moved to the final location.  (This  ap‐
1799              plies to dvips, dvipdf, and ps2pdf operations, and the filtering
1800              operators on .dvi and .ps files.  It does not apply to pdflatex,
1801              unfortunately,  since  pdflatex  provides no way of specifying a
1802              chosen name for the output file.)
1803
1804              This use of a temporary file solves a problem that the making of
1805              these files can occupy a substantial time.  If a viewer (notably
1806              gv) sees that the file has changed, it may read the new file be‐
1807              fore the program writing the file has not yet finished its work,
1808              which  can cause havoc.
1809
1810              See the $pvc_view_file_via_temporary variable for a setting that
1811              applies  only  if preview-continuous mode (-pvc option) is used.
1812              See $tmpdir for the setting of the directory where the temporary
1813              file is created.
1814
1815
1816       $analyze_input_log_always [1]
1817
1818              After  a run of latex (etc), always analyze .log for input files
1819              in the <...> and (...) constructions.  Otherwise,  only  do  the
1820              analysis when fls file doesn't exist or is out of date.
1821
1822              Under  normal  circumstances,  the data in the fls file is reli‐
1823              able, and the test of the log file gets lots of false positives;
1824              usually  $analyze_input_log_always is best set to zero.  But the
1825              test of the log file is needed at least in the following  situa‐
1826              tion:  When a user needs to persuade latexmk that a certain file
1827              is a source file, and latexmk doesn't otherwise find  it.   Then
1828              the  user  can  write  code  that causes a line with (...) to be
1829              written to log file.  One important case is for lualatex,  which
1830              doesn't  always  generate  lines  in the .fls file for input lua
1831              files.  (The situation with lualatex is  HIGHLY  version  depen‐
1832              dent,  e.g.,  there  was  a  big change between TeXLive 2016 and
1833              TeXLive 2017.)
1834
1835              To keep backward compatibility with older versions  of  latexmk,
1836              the default is to set $analyze_input_log_always to 1.
1837
1838
1839       $auto_rc_use [1]
1840              Whether  to  automatically read the standard initialization (rc)
1841              files, which are the system RC file, the user's RC file, and the
1842              RC file in the current directory.  The command line option -norc
1843              can be used to turn this setting off.  Each RC file  could  also
1844              turn  this  setting off, i.e., it could set $auto_rc_use to zero
1845              to prevent automatic reading of the later RC files.
1846
1847              This variable does not affect the reading of RC files  specified
1848              on the command line by the -r option.
1849
1850       $aux_dir [""]
1851              The directory in which auxiliary files (aux, log, etc) are to be
1852              written by a run of *latex.  If this variable is  not  set,  but
1853              $out_dir  is set, then $aux_dir is set to $out_dir, which is the
1854              directory to which general output files are to be written.
1855
1856              Important note:  The  effect  of  $aux_dir,  if  different  from
1857              $out_dir, is achieved by giving *latex the -aux-directory.  Cur‐
1858              rently (Dec. 2011 and later) this only works on the MiKTeX  ver‐
1859              sion of *latex.
1860
1861              See also the documentation of $out_dir for some complications on
1862              what directory names are suitable.
1863
1864              If you also use the -cd option, and $out_dir (or $aux_dir)  con‐
1865              tains  a relative path, then the path is interpreted relative to
1866              the document directory.
1867
1868       $banner [0]
1869              If nonzero, the banner message is printed across each page  when
1870              converting  the  dvi  file to postscript.  Without modifying the
1871              variable $banner_message, this is equivalent to  specifying  the
1872              -d option.
1873
1874              Note that if $banner is nonzero, the $postscript_mode is assumed
1875              and the postscript file is always generated, even if it is newer
1876              than the dvi file.
1877
1878       $banner_intensity [0.95]
1879              Equivalent to the -bi option, this is a decimal number between 0
1880              and 1 that specifies how dark to print the banner message. 0  is
1881              black, 1 is white.  The default is just right if your toner car‐
1882              tridge isn't running too low.
1883
1884       $banner_message ["DRAFT"]
1885              The banner message to print across each page when converting the
1886              dvi file to postscript.  This is equivalent to the -bm option.
1887
1888       $banner_scale [220.0]
1889              A  decimal  number  that  specifies how large the banner message
1890              will be printed.  Experimentation is necessary to get the  right
1891              scale  for  your message, as a rule of thumb the scale should be
1892              about equal to 1100 divided by the number of characters  in  the
1893              message.   The  Default  is just right for 5 character messages.
1894              This is equivalent to the -bs option.
1895
1896       @BIBINPUTS
1897              This is an array variable, now mostly obsolete,  that  specifies
1898              directories  where  latexmk  should look for .bib files.  By de‐
1899              fault it is set from the BIBINPUTS environment variable  of  the
1900              operating  system.   If  that environment variable is not set, a
1901              single element list consisting of the current directory is  set.
1902              The format of the directory names depends on your operating sys‐
1903              tem, of course.  Examples for setting this variable are:
1904
1905                      @BIBINPUTS = ( ".", "C:\\bibfiles" );
1906                      @BIBINPUTS = ( ".", "\\server\bibfiles" );
1907                      @BIBINPUTS = ( ".", "C:/bibfiles" );
1908                      @BIBINPUTS = ( ".", "//server/bibfiles" );
1909                      @BIBINPUTS = ( ".", "/usr/local/texmf/bibtex/bib" );
1910
1911              Note that under MS Windows, either a  forward  slash  "/"  or  a
1912              backward  slash "\" can be used to separate pathname components,
1913              so the first two and the second  two  examples  are  equivalent.
1914              Each  backward slash should be doubled to avoid running afoul of
1915              Perl's rules for writing strings.
1916
1917              Important note: This variable is now mostly obsolete in the cur‐
1918              rent version of latexmk, since it has a better method of search‐
1919              ing for files using the kpsewhich  command.   However,  if  your
1920              system  is an unusual one without the kpsewhich command, you may
1921              need to set the variable @BIBINPUTS.
1922
1923       $biber ["biber %O %S"]
1924              The biber processing program.
1925
1926       $biber_silent_switch ["--onlylog"]
1927              Switch(es) for the biber processing program when silent mode  is
1928              on.
1929
1930       $bibtex ["bibtex %O %S"]
1931              The BibTeX processing program.
1932
1933       $bibtex_fudge [1]
1934              When  using  bibtex, whether to change directory to $aux_dir be‐
1935              fore running bibtex.
1936
1937              The need arises as follows:
1938
1939              a. With bibtex before about 2019, if the filename  given  to  it
1940              contains a path component, there was a bug that bibtex would not
1941              find extra aux files, as produced by  the  \include  command  in
1942              TeX.
1943
1944              b.  With  all  moderately  recent versions of bibtex, bibtex may
1945              refuse to write its bbl and blg files, for security reasons, for
1946              certain cases of the path component of the filename given to it.
1947
1948              However,  there  are  also rare cases where the change-directory
1949              method prevents bibtex from finding certain bib  or  bst  files.
1950              Then $bibtex_fudge needs to be set to 0.
1951
1952
1953       $bibtex_silent_switch ["-terse"]
1954              Switch(es) for the BibTeX processing program when silent mode is
1955              on.
1956
1957       $bibtex_use [1]
1958              Under what conditions to run bibtex or biber.  When latexmk dis‐
1959              covers  from the log file that one (or more) bibtex/biber-gener‐
1960              ated bibliographies are used, it can run bibtex or  biber  when‐
1961              ever  it  appears  necessary  to regenerate the bbl file(s) from
1962              their source bib  database  file(s).   But  sometimes,  the  bib
1963              file(s) are not available (e.g., for a document obtained from an
1964              external archive), but the bbl files are provided.  In that case
1965              use  of  bibtex or biber will result in incorrect overwriting of
1966              the precious  bbl  files.   The  variable  $bibtex_use  controls
1967              whether  this  happens,  and  also  controls whether or not .bbl
1968              files are deleted in a cleanup operation.
1969
1970              The possible values of $bibtex_use are:
1971                0: never use BibTeX or biber; never delete  .bbl  files  in  a
1972              cleanup.
1973                1:  only  use  bibtex  or  biber if the bib files exist; never
1974              delete .bbl files in a cleanup.
1975                1.5: only use bibtex or biber if the bib files  exist;  condi‐
1976              tionally  delete .bbl files in a cleanup (i.e., delete them only
1977              when the bib files all exist).
1978                2: run bibtex or biber whenever it appears necessary to update
1979              the  bbl  files,  without  testing  for the existence of the bib
1980              files; always delete .bbl files in a cleanup.
1981
1982              Note that the value 1.5 does not work properly if  the  document
1983              uses biber instead of bibtex.  (There's a long story why not.)
1984
1985
1986       $cleanup_includes_cusdep_generated [0]
1987              If  nonzero,  specifies that cleanup also deletes files that are
1988              generated by custom dependencies.  (When doing a clean up, e.g.,
1989              by use of the -C option, custom dependencies are those listed in
1990              the .fdb_latexmk file from a previous run.)
1991
1992       $cleanup_includes_generated [0]
1993              If nonzero, specifies that cleanup also deletes files  that  are
1994              detected in the fls file (or failing that, in log file) as being
1995              generated.  It will also include files  made  from  these  first
1996              generation generated files.
1997
1998              This  operation  is  somewhat dangerous, and can have unintended
1999              consequences, since the files to be deleted are determined  from
2000              a  file  created by *latex, which can contain erroneous informa‐
2001              tion. Therefore this variable is turned off by default, and then
2002              files  to be deleted are restricted to those explictly specified
2003              by   patterns   configured   in   the    variables    clean_ext,
2004              clean_full_ext,  and  @generated_exts,  together with those very
2005              standard cases that  are  hardwired  into  latexmk  (e.g.,  .log
2006              files).
2007
2008       $cleanup_mode [0]
2009              If  nonzero,  specifies  cleanup mode: 1 for full cleanup, 2 for
2010              cleanup except for .dvi, .ps and .pdf files, 3 for  cleanup  ex‐
2011              cept  for  dep  and aux files.  (There is also extra cleaning as
2012              specified by the $clean_ext, $clean_full_ext and @generated_exts
2013              variables.)
2014
2015              This  variable  is  equivalent to specifying one of the -c or -C
2016              options.  But there should be no need to set this variable  from
2017              an RC file.
2018
2019       $clean_ext [""]
2020              Extra  extensions of files for latexmk to remove when any of the
2021              clean-up options (-c or -C) is  selected.   The  value  of  this
2022              variable is a string containing the extensions separated by spa‐
2023              ces.
2024
2025              It is also possible to specify a more general pattern of file to
2026              be deleted, by using the place holder %R, as in commands, and it
2027              is also possible to use wildcards.  Thus setting
2028
2029                  $clean_ext  =  "out  %R-blx.bib  %R-figures*.log  pythontex-
2030              files-%R/*";
2031
2032              in an initialization file will imply that when a clean-up opera‐
2033              tion is specified,  not  only  is  the  standard  set  of  files
2034              deleted,  but  also files of the form FOO.out, FOO-blx.bib, FOO-
2035              figures*.log, and pythontex-files-FOO/*, where  FOO  stands  for
2036              the basename of the file being processed (as in FOO.tex).
2037
2038              The  files to be deleted are relative to the directory specified
2039              by $aux_dir.  (Note that if $out_dir but not  $aux_dir  is  set,
2040              then  in  its  initialization,  latexmk  sets  $aux_dir equal to
2041              $out_dir.  A normal situation is therefore that $aux_dir  equals
2042              $out_dir,  which  is  the only case supported by TeXLive, unlike
2043              MiKTeX.)
2044
2045              The filenames specfied for a clean-up operation  can  refer  not
2046              only  to regular files but also to directories.  Directories are
2047              only deleted if they are empty.  An example of an application is
2048              to  pythontex,  which  creates  files in a particular directory.
2049              You can arrange to remove both the files and  the  directory  by
2050              setting
2051
2052                  $clean_ext = "pythontex-files-%R pythontex-files-%R";
2053
2054              See also the variable @generated_exts.
2055
2056       $clean_full_ext [""]
2057              Extra  extensions of files for latexmk to remove when the -C op‐
2058              tion is selected, i.e., extensions of files to remove  when  the
2059              .dvi, etc files are to be cleaned-up.
2060
2061              More general patterns are allowed, as for $clean_ext.
2062
2063              The  files  specified by $clean_full_ext to be deleted are rela‐
2064              tive to the directory specified by $out_dir.
2065
2066
2067       $compiling_cmd [""], $failure_cmd [""], $warning_cmd [""], $success_cmd
2068       [""]
2069
2070              These  variables  specify  commands that are executed at certain
2071              points of compilations.  One motivation for their  existance  is
2072              to  allow  very useful convenient visual indications of compila‐
2073              tion status even when the window receiving the screen output  of
2074              the  compilation is hidden.  This is particularly useful in pre‐
2075              view-continuous mode.
2076
2077              The commands are executed  at  the  following  points:  $compil‐
2078              ing_cmd  at the start of compilation, $success_cmd at the end of
2079              a completely successful compilation, $failure_cmd at the end  of
2080              an unsuccessful compilation, $warning_cmd at the of an otherwise
2081              successful compilation that gives warnings about undefined cita‐
2082              tions or references or about multiply defined references. If any
2083              of above variables is undefined or  blank  (the  default  situa‐
2084              tion), then the corresponding command is not executed.
2085
2086              However,  when  $warning_cmd  is  not set, then in the case of a
2087              compilation with warnings about  references  or  citations,  but
2088              with  no  other  error,  one  or other of $success_cmd or $fail‐
2089              ure_cmd is used (if it is  set)  according  to  the  setting  of
2090              $warnings_as_errors.
2091
2092              An example of a simple setting of these variables is as follows
2093
2094                  $compiling_cmd  =  "xdotool  search --name \"%D\" set_window
2095              --name \"%D compiling\"";
2096                  $success_cmd   = "xdotool search  --name  \"%D\"  set_window
2097              --name \"%D OK\"";
2098                  $warning_cmd   = "xdotool search --name \"%D\" ".
2099                                   "set_window --name \"%D CITE/REF ISSUE\"";
2100                  $failure_cmd    =  "xdotool  search --name \"%D\" set_window
2101              --name \"%D FAILURE\"";
2102
2103              These assume that the program xdotool  is  installed,  that  the
2104              previewer  is using an X-Window system for display, and that the
2105              title of the window contains the name of the displayed file,  as
2106              it  normally  does.   When the commands are executed, the place‐
2107              holder string %D is replaced by  the  name  of  the  destination
2108              file, which is the previewed file.  The above commands result in
2109              an appropriate string being appended to the filename in the win‐
2110              dow title: " compiling", " OK", or " FAILURE".
2111
2112              Other  placeholders that can be used are %S, %T, and %R, with %S
2113              and %T normally being identical. These can be useful for a  com‐
2114              mand  changing  the title of the edit window. The visual indica‐
2115              tion in a window title can useful, since the user does not  have
2116              to  keep shifting attention to the (possibly hidden) compilation
2117              window to know the status of the compilation.
2118
2119              More complicated situations can best be handled  by  defining  a
2120              Perl  subroutine to invoke the necessary commands, and using the
2121              "internal" keyword in the definitions to get the  subroutine  to
2122              be invoked.  (See the section "Format of Command Specifications"
2123              for how to do this.)
2124
2125              Naturally, the above settings that invoke  the  xdotool  program
2126              are  only  applicable  when  the X-Window system is used for the
2127              relevant window(s).  For other cases, you will have to find what
2128              software solutions are available.
2129
2130
2131       @cus_dep_list [()]
2132              Custom dependency list -- see section on "Custom Dependencies".
2133
2134       @default_excluded_files [()]
2135              When  latexmk  is invoked with no files specified on the command
2136              line, then, by default, it will process all files in the current
2137              directory with the extension .tex.  (In general, it will process
2138              the files specified in the @default_files variable.)
2139
2140              But sometimes you want to exclude particular files from this de‐
2141              fault  list.  In that case you can specify the excluded files in
2142              the array @default_excluded_files.  For example if you wanted to
2143              process  all  .tex files with the exception of common.tex, which
2144              is a not a standard alone LaTeX file but a file input by some or
2145              all of the others, you could do
2146
2147                   @default_files = ("*.tex");
2148
2149                   @default_excluded_files = ("common.tex");
2150
2151              If you have a variable or large number of files to be processed,
2152              this method saves you from having to list them in detail in @de‐
2153              fault_files  and having to update the list every time you change
2154              the set of files to be processed.
2155
2156              Notes: 1. This variable has no effect except when no  files  are
2157              specified on the latexmk command line.  2. Wildcards are allowed
2158              in @default_excluded_files.
2159
2160       @default_files [("*.tex")]
2161              Default list of files to be processed.
2162
2163              If no filenames are specified on the command line, latexmk  pro‐
2164              cesses  all  tex files specified in the @default_files variable,
2165              which by default is set to all tex files ("*.tex") in  the  cur‐
2166              rent  directory.  This is a convenience: just run latexmk and it
2167              will process an appropriate set of  files.   But  sometimes  you
2168              want only some of these files to be processed.  In this case you
2169              can list the files to be processed by setting @default_files  in
2170              an  initialization  file (e.g., the file "latexmkrc" in the cur‐
2171              rent directory).  Then if no files are specified on the  command
2172              line  then  the  files you specify by setting @default_files are
2173              processed.
2174
2175              Three examples:
2176
2177                   @default_files = ("paper_current");
2178
2179                   @default_files = ("paper1", "paper2.tex");
2180
2181                   @default_files = ("*.tex", "*.dtx");
2182
2183              Note that more than file may be given, and that the default  ex‐
2184              tension is ".tex".  Wild cards are allowed.  The parentheses are
2185              because @default_files is an array variable, i.e., a sequence of
2186              filename specifications is possible.
2187
2188              If  you want latexmk to process all .tex files with a few excep‐
2189              tions, see the @default_excluded_files array variable.
2190
2191       $dependents_phony [0]
2192              If a list of dependencies is output,  this  variable  determines
2193              whether  to include a phony target for each source file.  If you
2194              use the dependents list in a  Makefile,  the  dummy  rules  work
2195              around  errors make gives if you remove header files without up‐
2196              dating the Makefile to match.
2197
2198       $dependents_list [0]
2199              Whether to display a list(s) of dependencies at  the  end  of  a
2200              run.
2201
2202       $deps_file ["-"]
2203              Name  of file to receive list(s) of dependencies at the end of a
2204              run, to be used if $dependesnt_list is set.  If the filename  is
2205              "-",  then  the dependency list is set to stdout (i.e., normally
2206              the screen).
2207
2208       $do_cd [0]
2209              Whether to change working directory to the  directory  specified
2210              for  the main source file before processing it.  The default be‐
2211              havior is not to do this, which is the same as the  behavior  of
2212              *latex  programs.   This variable is set by the -cd and -cd- op‐
2213              tions on latexmk's command line.
2214
2215       $dvi_filter [empty]
2216              The dvi file filter to be run on the newly produced dvi file be‐
2217              fore other processing.  Equivalent to specifying the -dF option.
2218
2219       $dvi_mode [See below for default]
2220              If  nonzero, generate a dvi version of the document.  Equivalent
2221              to the -dvi option.
2222
2223              The variable $dvi_mode defaults to 0, but  if  no  explicit  re‐
2224              quests  are made for other types of file (postscript, pdf), then
2225              $dvi_mode will be set to 1.  In addition, if  a  request  for  a
2226              file  for  which  a  .dvi file is a prerequisite, then $dvi_mode
2227              will be set to 1.
2228
2229       $dvi_previewer ["start xdvi %O %S" under UNIX]
2230              The command to invoke a dvi-previewer.   [Under  MS-Windows  the
2231              default  is "start"; then latexmk arranges to use the MS-Windows
2232              start program, which will cause to be run whatever  command  the
2233              system has associated with .dvi files.]
2234
2235              Important  note:  Normally you will want to have a previewer run
2236              detached, so that latexmk doesn't wait for the previewer to ter‐
2237              minate  before continuing its work.  So normally you should pre‐
2238              fix the command by "start ", which  flags  to  latexmk  that  it
2239              should  do  the  detaching  of the previewer itself (by whatever
2240              method is appropriate to the operating system).   But  sometimes
2241              letting latexmk do the detaching is not appropriate (for a vari‐
2242              ety of non-trivial reasons), so you should put the "start "  bit
2243              in yourself, whenever it is needed.
2244
2245       $dvi_previewer_landscape ["start xdvi %O %S"]
2246              The command to invoke a dvi-previewer in landscape mode.  [Under
2247              MS-Windows the default is "start"; then latexmk arranges to  use
2248              the  MS-Windows  start program, which will cause to be run what‐
2249              ever command the system has associated with .dvi files.]
2250
2251       $dvipdf ["dvipdf -dALLOWPSTRANSPARENCY %O %S %D"]
2252              Command to convert .dvi to .pdf file.  A common  reconfiguration
2253              is  to  use  the dvipdfm command, which needs its arguments in a
2254              different order:
2255
2256                   $dvipdf = "dvipdfm %O -o %D %S";
2257
2258              WARNING: The default dvipdf  script  generates  pdf  files  with
2259              bitmapped fonts, which do not look good when viewed by acroread.
2260              That script should be modified to give  dvips  the  options  "-P
2261              pdf" to ensure that type 1 fonts are used in the pdf file.
2262
2263       $dvipdf_silent_switch ["-q"]
2264              Switch(es) for dvipdf program when silent mode is on.
2265
2266              N.B.  The  standard  dvipdf program runs silently, so adding the
2267              silent switch has no effect, but is actually innocuous.  But  if
2268              an  alternative program is used, e.g., dvipdfmx, then the silent
2269              switch has an  effect.   The  default  setting  is  correct  for
2270              dvipdfm and dvipdfmx.
2271
2272       $dvips ["dvips %O -o %D %S"]
2273              The  program to used as a filter to convert a .dvi file to a .ps
2274              file.  If pdf is going to be generated from pdf, then the  value
2275              of  the  $dvips_pdf_switch  variable -- see below -- will be in‐
2276              cluded in the options substituted for "%O".
2277
2278       $dvips_landscape ["dvips -tlandscape %O -o %D %S"]
2279              The program to used as a filter to convert a .dvi file to a  .ps
2280              file in landscape mode.
2281
2282       $dvips_pdf_switch ["-P pdf"]
2283              Switch(es)  for  dvips  program when pdf file is to be generated
2284              from .ps file.
2285
2286       $dvips_silent_switch ["-q"]
2287              Switch(es) for dvips program when silent mode is on.
2288
2289       $dvi_update_command [""]
2290              When the dvi previewer is set to be updated by  running  a  com‐
2291              mand,  this is the command that is run.  See the information for
2292              the variable $dvi_update_method for further information, and see
2293              information  on  the  variable $pdf_update_method for an example
2294              for the analogous case of a pdf previewer.
2295
2296       $dvi_update_method [2 under UNIX, 1 under MS-Windows]
2297              How the dvi viewer updates its display when  the  dvi  file  has
2298              changed.    The  values  here  apply  equally  to  the  $pdf_up‐
2299              date_method and to the $ps_update_method variables.
2300                  0 => update is automatic,
2301                  1=> manual update by user, which may only mean a mouse click
2302              on the viewer's window or may mean a more serious action.
2303                  2  =>  Send  the  signal,  whose  number  is in the variable
2304              $dvi_update_signal.  The default value under  UNIX  is  suitable
2305              for xdvi.
2306                  3  => Viewer cannot do an update, because it locks the file.
2307              (As with acroread under MS-Windows.)
2308                  4 => run a command to do the update.  The command is  speci‐
2309              fied by the variable $dvi_update_command.
2310
2311              See  information on the variable $pdf_update_method for an exam‐
2312              ple of updating by command.
2313
2314       $dvi_update_signal [Under UNIX: SIGUSR1, which  is  a  system-dependent
2315       value]
2316              The  number of the signal that is sent to the dvi viewer when it
2317              is updated by sending a signal -- see  the  information  on  the
2318              variable  $dvi_update_method.   The default value is the one ap‐
2319              propriate for xdvi on a UNIX system.
2320
2321       $failure_cmd [undefined]
2322              See the documentation for $compiling_cmd.
2323
2324       $fdb_ext ["fdb_latexmk"]
2325              The extension of the file which latexmk generates to  contain  a
2326              database  of information on source files.  You will not normally
2327              need to change this.
2328
2329       $filetime_causality_threshold  [5];   $filetime_offset_report_threshold
2330       [30]. (Units of seconds.)
2331
2332              These variables control how latexmk deals with the following is‐
2333              sue, which can affect the use of files  that  are  on  a  remote
2334              filesystem (network share) instead of being on a file system lo‐
2335              cal to the computer running latexmk.  Almost users will not have
2336              to  worry about these settings, and can ignore the following ex‐
2337              planation.
2338
2339              In almost all situations, latexmk does not need to use the  time
2340              stamps  of the files it works with.  However, there are a couple
2341              of situations when it needs to know whether a certain  file  was
2342              created  in  the current run of a program (e.g., *latex) or is a
2343              leftover file from a previous run. It does this by comparing the
2344              modification  time  of the file with the system time just before
2345              the program was started. If the  modification  time  is  earlier
2346              than  when the program was started, the file is a leftover file,
2347              which latexmk treats as if it were not created.  If the filetime
2348              is  at least the program start time, then it can be assumed that
2349              the file was created in the current run.
2350
2351              Unfortunately, this test can fail if the file  is  on  a  remote
2352              system,  since  its  system time is not necessarily synchronized
2353              with that of the local system;  the  timestamps  on  the  remote
2354              files  are set by the remote system, not the local system.  Gen‐
2355              erally, modern operating  systems  regularly  synchronize  their
2356              time  with  a server, so the non-synchronization is mostly small
2357              (a second or so, or a few seconds).  But even a small difference
2358              can mess up latexmk's test.
2359
2360              Latexmk measures the time difference between the time on the two
2361              systems and compensates for this.  But  the  measurement  (in  a
2362              system-independent way) is only accurate to a second or two.  So
2363              latexmk allows for a threshold on the  difference  between  file
2364              and  system  time  before it concludes that a file is a leftover
2365              file from a previous  run.  The  configuration  variable  $file‐
2366              time_causality_theshhold,  which  in units of seconds, specifies
2367              this threshold.  Luckily high precision is not needed.  The pre‐
2368              vious  run  is normally the previous run in a human run-edit-run
2369              cycle, and is at least many seconds  back.   A  few  seconds  is
2370              therefore   appropriate  for  the  threshold,  $filetime_causal‐
2371              ity_theshhold; it should be non-negative always, and  should  be
2372              bigger than 2 if a remote filesystem or network share is used.
2373
2374              If  the  difference in system times on the two systems is large,
2375              it normally indicates that at least one of the systems  is  mis‐
2376              configured.    The   variable  $filetime_offset_report_threshold
2377              specifies the smallest size of the  difference  (or  offset)  in
2378              seconds  between the times of the local and remote system beyond
2379              which the offset is reported.  This is reported at the point  in
2380              the  latexmk's  progress that it measures the offset. The report
2381              is made if silent mode is used and diagnostic mode is not on.
2382
2383
2384       $force_mode [0]
2385              If nonzero, continue processing past minor latex errors  includ‐
2386              ing unrecognized cross references.  Equivalent to specifying the
2387              -f option.
2388
2389       @generated_exts [( aux , bbl , idx , ind , lof , lot  ,  out  ,  toc  ,
2390       $fdb_ext )]
2391              This  contains a list of extensions for files that are generated
2392              during a LaTeX run and that are read in by LaTeX in later  runs,
2393              either directly or indirectly.
2394
2395              This  list  specifies files known to be generated by *latex.  It
2396              is used in two ways: (a) The specified files are  deleted  in  a
2397              cleanup  operation  (with  the -c, -C, -CA, -g and -gg options),
2398              and (b) It affects the determination of whether a rerun of  *la‐
2399              tex is needed after a run that gives an error.
2400
2401              (Concerning item (b): Normally, a change of a source file during
2402              a run should provoke a rerun.  This includes a file generated by
2403              LaTeX,  e.g.,  an  aux file, that is read in on subsequent runs.
2404              But after a run that results in an error, a new run  should  not
2405              occur  until  the  user has made a change in the files.  But the
2406              user may have corrected an error in a source  .tex  file  during
2407              the run.  So latexmk needs to distinguish user-generated and au‐
2408              tomatically generated files;  it  determines  the  automatically
2409              generated  files as those with extensions in the list in @gener‐
2410              ated_exts.)
2411
2412              A convenient way to add an extra extension to the list,  without
2413              losing  the already defined ones is to use a push command in the
2414              line in an RC file.  E.g.,
2415
2416                              push @generated_exts, "end";
2417
2418              adds the extension "end" to the list of predefined generated ex‐
2419              tensions.   (This  extension  is used by the RevTeX package, for
2420              example.)
2421
2422       $go_mode [0]
2423              If nonzero, process files regardless of timestamps, and is  then
2424              equivalent to the -g option.
2425
2426       %hash_calc_ignore_pattern
2427              !!!This variable is for experts only!!!
2428
2429              The  general rule latexmk uses for determining when an extra run
2430              of some program is needed is that one of the  source  files  has
2431              changed.   But  consider for example a latex package that causes
2432              an encapsulated postscript file (an "eps" file) to be made  that
2433              is  to  be read in on the next run.  The file contains a comment
2434              line giving its creation date and time.  On  the  next  run  the
2435              time  changes,  latex  sees  that  the eps file has changed, and
2436              therefore reruns latex.  This causes an infinite loop,  that  is
2437              only  terminated  because  latexmk  has a limit on the number of
2438              runs to guard against pathological situations.
2439
2440              But the changing line has no real effect, since it is a comment.
2441              You can instruct latex to ignore the offending line as follows:
2442
2443                 $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate: ';
2444
2445              This creates a rule for files with extension .eps about lines to
2446              ignore.  The left-hand side is a Perl idiom for setting an  item
2447              in  a hash.  Note that the file extension is specified without a
2448              period.  The value, on the right-hand side, is a string contain‐
2449              ing  a  regular expresssion.  (See documentation on Perl for how
2450              they are to be specified in general.)  This  particular  regular
2451              expression  specifies that lines beginning with "%%CreationDate:
2452              " are to be ignored in deciding whether a file of the given  ex‐
2453              tension .eps has changed.
2454
2455              There  is  only one regular expression available for each exten‐
2456              sion.  If you need more one pattern to specify lines to  ignore,
2457              then  you need to combine the patterns into a single regular ex‐
2458              pression.  The simplest method is separate the different  simple
2459              patterns  by  a vertical bar character (indicating "alternation"
2460              in the jargon of regular expressions).  For example,
2461
2462                 $hash_calc_ignore_pattern{'eps'} = '^%%CreationDate:  |^%%Ti‐
2463              tle: ';
2464
2465              causes lines starting with either "^%%CreationDate: " or "^%%Ti‐
2466              tle: " to be ignored.
2467
2468              It may happen that a pattern to be ignored is specified in,  for
2469              example,  in  a system or user initialization file, and you wish
2470              to remove this in a file that is read later.  To  do  this,  you
2471              use Perl's delete function, e.g.,
2472
2473                  delete $hash_calc_ignore_pattern{'eps'};
2474
2475
2476       $jobname [""]
2477
2478              This  specifies the jobname, i.e., the basename that is used for
2479              generated files (.aux, .log, .dvi, .ps,  .pdf,  etc).   If  this
2480              variable  is a null string, then the basename is the basename of
2481              the main tex file.  (At present, the string in  $jobname  should
2482              not contain spaces.)
2483
2484              The  placeholder  '%A' is permitted. This will be substituted by
2485              the basename of the TeX file.  The primary purpose is when a va‐
2486              riety  of  tex  files are to be processed, and you want to use a
2487              different jobname for each but one that is  distinct  for  each.
2488              Thus  if you wanted to compare compilations of a set of files on
2489              different operating systems, with distinct filenames for all the
2490              cases, you could set
2491
2492                 $jobname = "%A-$^O";
2493
2494              in  an initialization file.  (Here $^O is a variable provided by
2495              perl that contains perl's name for the operating system.)
2496
2497              Suppose you had .tex files test1.tex and test2.tex.   Then  when
2498              you run
2499
2500                 latexmk -pdf *.tex
2501
2502              both  files  will  be  compiled.  The .aux, .log, and .pdf files
2503              will have basenames test1-MSWin32 ante test2-MSWin32  on  a  MS-
2504              Windows system, test1-darwin and test2-darwin on an OS-X system,
2505              and a variety of similar cases on linux systems.
2506
2507
2508       $kpsewhich ["kpsewhich %S"]
2509              The program called to locate a source file when the  name  alone
2510              is  not  sufficient.  Most filenames used by latexmk have suffi‐
2511              cient path information to be found directly.  But sometimes, no‐
2512              tably when a .bib or a .bst file is found from the log file of a
2513              bibtex or biber run, only the base name of the  file  is  known,
2514              but not its path. The program specified by $kpsewhich is used to
2515              find it.
2516
2517              (For advanced users: Because of the different way in  which  la‐
2518              texmk uses the command specified in $kpsewhich, some of the pos‐
2519              sibilities listed in the FORMAT OF COMMAND SPECIFICATIONS do not
2520              apply.   The  internal  and  start keywords are not available. A
2521              simple command specification with possible options and then "%S"
2522              is  all  that  is  guaranteed to work.  Note that for other com‐
2523              mands, "%S" is substituted by a single source file. In contrast,
2524              for $kpsewhich, "%S" may be substituted by a long list of space-
2525              separated filenames, each of which is  quoted.   The  result  on
2526              STDOUT of running the command is then piped to latexmk.)
2527
2528              See  also  the  @BIBINPUTS variable for another way that latexmk
2529              also uses to try to locate files; it applies only in the case of
2530              .bib files.
2531
2532       $kpsewhich_show [0]
2533              Whether  to show diagnostics about invocations of kpsewhich: the
2534              command line use to invoke it and the results.   These  diagnos‐
2535              tics  are shown if $kpsewhich_show is non-zero or if diagnostics
2536              mode is on.  (But in the second case, lots of other  diagnostics
2537              are  also  shown.)   Without  these diagnostics there is nothing
2538              visible in latexmk's screen output about  invocations  of  kpse‐
2539              which.
2540
2541       $landscape_mode [0]
2542              If nonzero, run in landscape mode, using the landscape mode pre‐
2543              viewers and dvi to postscript converters.  Equivalent to the  -l
2544              option.  Normally not needed with current previewers.
2545
2546       $latex ["latex %O %S"]
2547              Specifies  the  command  line  for the LaTeX processing program.
2548              Note that as with other programs, you can use this variable  not
2549              just  to  change  the name of the program used, but also specify
2550              options to the program.  E.g.,
2551
2552                                  $latex = "latex --src-specials %O %S";
2553
2554              To do a coordinated setting of all of $latex, $pdflatex, $luala‐
2555              tex, and $xelatex, see the section "Advanced Configuration".
2556
2557
2558       %latex_input_extensions
2559              This  variable specifies the extensions tried by latexmk when it
2560              finds that a LaTeX run resulted in an error that a file has  not
2561              been  found,  and  the file is given without an extension.  This
2562              typically happens when LaTeX commands of the  form  \input{file}
2563              or  \includegraphics{figure}, when the relevant source file does
2564              not exist.
2565
2566              In this situation, latexmk searches for custom  dependencies  to
2567              make  the  missing  file(s),  but restricts it to the extensions
2568              specified by the variable %latex_input_extensions.  The  default
2569              extensions are 'tex' and 'eps'.
2570
2571              (For  Perl experts: %latex_input_extensions is a hash whose keys
2572              are the extensions.  The values are  irrelevant.)   Two  subrou‐
2573              tines  are  provided for manipulating this and the related vari‐
2574              able %pdflatex_input_extensions,  add_input_ext  and  remove_in‐
2575              put_ext.   They are used as in the following examples are possi‐
2576              ble lines in an initialization file:
2577
2578                  remove_input_ext( 'latex', 'tex' );
2579
2580              removes the extension 'tex' from latex_input_extensions
2581
2582                  add_input_ext( 'latex', 'asdf' );
2583
2584              add the extension 'asdf to  latex_input_extensions.   (Naturally
2585              with such an extension, you should have made an appropriate cus‐
2586              tom dependency for latexmk, and should also have done the appro‐
2587              priate  programming  in the LaTeX source file to enable the file
2588              to be read.  The standard extensions are handled  by  LaTeX  and
2589              its graphics/graphicx packages.)
2590
2591       $latex_silent_switch ["-interaction=batchmode"]
2592              Switch(es)  for the LaTeX processing program when silent mode is
2593              on.
2594
2595              If you use MikTeX, you may prefer the results if  you  configure
2596              the  options  to include -c-style-errors, e.g., by the following
2597              line in an initialization file
2598
2599                $latex_silent_switch  =  "-interaction=batchmode  -c-style-er‐
2600              rors";
2601
2602
2603       $lpr ["lpr %O %S" under UNIX/Linux, "NONE lpr" under MS-Windows]
2604              The command to print postscript files.
2605
2606              Under  MS-Windows (unlike UNIX/Linux), there is no standard pro‐
2607              gram for printing files.  But there are ways you can do it.  For
2608              example, if you have gsview installed, you could use it with the
2609              option "/p":
2610
2611                  $lpr = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p';
2612
2613              If gsview is installed in a different directory, you  will  need
2614              to  make the appropriate change.  Note the combination of single
2615              and double quotes around the name.  The  single  quotes  specify
2616              that  this is a string to be assigned to the configuration vari‐
2617              able $lpr.  The double quotes are part of the string  passed  to
2618              the  operating  system to get the command obeyed; this is neces‐
2619              sary because one part of the command name ("Program Files") con‐
2620              tains a space which would otherwise be misinterpreted.
2621
2622       $lpr_dvi ["NONE lpr_dvi"]
2623              The printing program to print dvi files.
2624
2625       $lpr_pdf ["NONE lpr_pdf"]
2626              The printing program to print pdf files.
2627
2628              Under  MS-Windows you could set this to use gsview, if it is in‐
2629              stalled, e.g.,
2630
2631                  $lpr = '"c:/Program Files/Ghostgum/gsview/gsview32.exe" /p';
2632
2633              If gsview is installed in a different directory, you  will  need
2634              to  make  the appropriate change.  Note the double quotes around
2635              the name: this is necessary because one part of the command name
2636              ("Program Files") contains a space which would otherwise be mis‐
2637              interpreted.
2638
2639       $lualatex ["lualatex %O %S"]
2640              Specifies the command line for the LaTeX processing program that
2641              is  to be used when the lualatex program is called for (e.g., by
2642              the option -lualatex.
2643
2644              To do a coordinated setting of all of $latex, $pdflatex, $luala‐
2645              tex, and $xelatex, see the section "Advanced Configuration".
2646
2647
2648       %lualatex_input_extensions
2649              This  variable specifies the extensions tried by latexmk when it
2650              finds that a lualatex run resulted in an error that a  file  has
2651              not  been  found,  and  the  file is given without an extension.
2652              This typically happens when LaTeX  commands  of  the  form  \in‐
2653              put{file}  or \includegraphics{figure}, when the relevant source
2654              file does not exist.
2655
2656              In this situation, latexmk searches for custom  dependencies  to
2657              make  the  missing  file(s),  but restricts it to the extensions
2658              specified by the variable %pdflatex_input_extensions.   The  de‐
2659              fault extensions are 'tex', 'pdf', 'jpg, and 'png'.
2660
2661              See details of the %latex_input_extensions for other information
2662              that equally applies to %lualatex_input_extensions.
2663
2664       $lualatex_silent_switch ["-interaction=batchmode"]
2665              Switch(es) for the lualatex program (specified in  the  variable
2666              $lualatex) when silent mode is on.
2667
2668              See  details  of  the $latex_silent_switch for other information
2669              that equally applies to $lualatex_silent_switch.
2670
2671       $make ["make"]
2672              The make processing program.
2673
2674       $makeindex ["makeindex %O -o %D %S"]
2675              The index processing program.
2676
2677       $makeindex_fudge [0]
2678              When using makeindex, whether to change  directory  to  $aux_dir
2679              before  running  makeindex.   Set to 1 if $aux_dir is not an ex‐
2680              plicit subdirectory of current  directory,  otherwise  makeindex
2681              will refuse to write its output and log files, for security rea‐
2682              sons.
2683
2684       $makeindex_silent_switch ["-q"]
2685              Switch(es) for the index processing program when silent mode  is
2686              on.
2687
2688       $max_repeat [5]
2689              The  maximum  number of times latexmk will run *latex before de‐
2690              ciding that there may be an infinite loop and that it  needs  to
2691              bail  out,  rather than rerunning *latex again to resolve cross-
2692              references, etc.  The default value covers all normal cases.
2693
2694              (Note that the "etc" covers a lot of cases where one run of *la‐
2695              tex generates files to be read in on a later run.)
2696
2697       $MSWin_back_slash [1]
2698              This  configuration  variable only has an effect when latexmk is
2699              running under MS-Windows.  With the default value of 1 for  this
2700              variable,  when  a command is executed under MS-Windows, latexmk
2701              substitutes "\" for the separator character  between  components
2702              of  a  directory name.  Internally, latexmk uses "/" for the di‐
2703              rectory separator character, which  is  the  character  used  by
2704              Unix-like systems.
2705
2706              For  almost  all programs and for almost all filenames under MS-
2707              Windows, both "\" and "/" are acceptable as the directory  sepa‐
2708              rator  character,  provided at least that filenames are properly
2709              quoted.  But it is possible that programs exist that only accept
2710              "\"  on  the  command line, since that is the standard directory
2711              separator for MS-Windows.  So for safety latexmk makes the  sub‐
2712              stitution from "/" to "\", by default.
2713
2714              However  there  are also programs on MS-Windows for which a back
2715              slash "\" is interpreted differently than as a directory separa‐
2716              tor;  for these the directory separator should be "/".  Programs
2717              with this behavior  include  all  the  *latex  programs  in  the
2718              TeXLive  implementation  (but  not  the  MiKTeX implementation).
2719              Hence if you use TeXLive on MS-Windows,  then  $MSWin_back_slash
2720              should be set to zero.
2721
2722
2723       $new_viewer_always [0]
2724              This  variable  applies  to  latexmk  only in continuous-preview
2725              mode.  If $new_viewer_always is 0, latexmk will check for a pre‐
2726              viously  running  previewer on the same file, and if one is run‐
2727              ning will not start a new one.  If  $new_viewer_always  is  non-
2728              zero,  this check will be skipped, and latexmk will behave as if
2729              no viewer is running.
2730
2731       $out_dir [""]
2732              If non-blank, this variable specifies  the  directory  in  which
2733              output files are to be written by a run of *latex.  See also the
2734              variable $aux_dir.
2735
2736              The effect of this variable (when non-blank) is achieved by  us‐
2737              ing  the -output-directory option of *latex.  This exists in the
2738              usual current (Dec. 2011  and  later)  implementations  of  TeX,
2739              i.e.,  MiKTeX  and  TeXLive.  But it may not be present in other
2740              versions.
2741
2742              If you also use the -cd option, and $out_dir (or $aux_dir)  con‐
2743              tains  a relative path, then the path is interpreted relative to
2744              the document directory.
2745
2746              Commonly, the directory specified for output files is  a  subdi‐
2747              rectory of the current working directory.  However, if you spec‐
2748              ify some other directory, e.g., "/tmp/foo"  or  "../output",  be
2749              aware  that  this  could cause problems, e.g., with makeindex or
2750              bibtex.  This is because modern versions of these  programs,  by
2751              default,  will refuse to work when they find that they are asked
2752              to write to a file in a directory that appears  not  to  be  the
2753              current working directory or one of its subdirectories.  This is
2754              part of security measures by the whole TeX system  that  try  to
2755              prevent malicious or errant TeX documents from incorrectly mess‐
2756              ing with a user's files.  If for $out_dir or $aux_dir you really
2757              do  need to specify an absolute pathname (e.g., "/tmp/foo") or a
2758              path (e.g., "../output") that includes a higher-level directory,
2759              and  you  need to use makeindex or bibtex, then you need to dis‐
2760              able the security measures (and assume any risks).  One  way  of
2761              doing this is to temporarily set an operating system environment
2762              variable openout_any to "a" (as in "all"), to override  the  de‐
2763              fault "paranoid" setting.
2764
2765       $pdf_mode [0]
2766              If  zero,  do  NOT  generate  a pdf version of the document.  If
2767              equal to 1, generate a pdf version of the document using  pdfla‐
2768              tex,  using the command specified by the $pdflatex variable.  If
2769              equal to 2, generate a pdf version of the document from  the  ps
2770              file,  by  using  the command specified by the $ps2pdf variable.
2771              If equal to 3, generate a pdf version of the document  from  the
2772              dvi  file,  by  using the command specified by the $dvipdf vari‐
2773              able.  If equal to 4, generate a pdf version of the document us‐
2774              ing lualatex, using the command specified by the $lualatex vari‐
2775              able.  If equal to 5, generate a pdf version (and  an  xdv  ver‐
2776              sion)  of  the document using xelatex, using the commands speci‐
2777              fied by the $xelatex and xdvipdfmx variables.
2778
2779              In $pdf_mode=2, it is ensured that .dvi and .ps files  are  also
2780              made.   In  $pdf_mode=3,  it is ensured that a .dvi file is also
2781              made.  But this may be overridden by the document.
2782
2783       $pdflatex ["pdflatex %O %S"]
2784              Specifies the command line for the LaTeX processing program in a
2785              version that makes a pdf file instead of a dvi file.
2786
2787              An example use of this variable is to add certain options to the
2788              command line for the program, e.g.,
2789
2790                   $pdflatex = "pdflatex --shell-escape %O %S";
2791
2792              (In some earlier versions of latexmk, you needed to use  an  as‐
2793              signment  to  $pdflatex  to allow the use of lualatex or xelatex
2794              instead of pdflatex.  There are now separate configuration vari‐
2795              ables  for  the  use  of lualatex or xelatex.  See $lualatex and
2796              $xelatex.)
2797
2798              To do a coordinated setting of all of $latex, $pdflatex, $luala‐
2799              tex, and $xelatex, see the section "Advanced Configuration".
2800
2801       %pdflatex_input_extensions
2802              This  variable specifies the extensions tried by latexmk when it
2803              finds that a pdflatex run resulted in an error that a  file  has
2804              not  been  found,  and  the  file is given without an extension.
2805              This typically happens when LaTeX  commands  of  the  form  \in‐
2806              put{file}  or \includegraphics{figure}, when the relevant source
2807              file does not exist.
2808
2809              In this situation, latexmk searches for custom  dependencies  to
2810              make  the  missing  file(s),  but restricts it to the extensions
2811              specified by the variable %pdflatex_input_extensions.   The  de‐
2812              fault extensions are 'tex', 'pdf', 'jpg, and 'png'.
2813
2814              See details of the %latex_input_extensions for other information
2815              that equally applies to %pdflatex_input_extensions.
2816
2817       $pdflatex_silent_switch ["-interaction=batchmode"]
2818              Switch(es) for the pdflatex program (specified in  the  variable
2819              $pdflatex) when silent mode is on.
2820
2821              See  details  of  the $latex_silent_switch for other information
2822              that equally applies to $pdflatex_silent_switch.
2823
2824       $pdf_previewer ["start acroread %O %S"]
2825              The command to invoke a pdf-previewer.
2826
2827              On MS-Windows, the default is changed to "cmd /c start """;  un‐
2828              der  more  recent versions of Windows, this will cause to be run
2829              whatever command the system has associated with .pdf files.  But
2830              this  may  be  undesirable if this association is to acroread --
2831              see the notes in the explanation of the -pvc option.]
2832
2833              On OS-X the default is changed to "open %S",  which  results  in
2834              OS-X  starting up (and detaching) the viewer associated with the
2835              file.  By default, for pdf files this association is  to  OS-X's
2836              preview, which is quite satisfactory.
2837
2838              WARNING:   Problem  under MS-Windows: if acroread is used as the
2839              pdf previewer, and it is actually viewing a pdf  file,  the  pdf
2840              file  cannot  be  updated.   Thus makes acroread a bad choice of
2841              previewer if you use latexmk's previous-continuous mode  (option
2842              -pvc) under MS-windows.  This problem does not occur if, for ex‐
2843              ample, SumatraPDF or gsview is used to view pdf files.
2844
2845              Important note: Normally you will want to have a  previewer  run
2846              detached, so that latexmk doesn't wait for the previewer to ter‐
2847              minate before continuing its work.  So normally you should  pre‐
2848              fix  the  command  by  "start  ", which flags to latexmk that it
2849              should do the detaching of the  previewer  itself  (by  whatever
2850              method  is  appropriate to the operating system).  But sometimes
2851              letting latexmk do the detaching is not appropriate (for a vari‐
2852              ety  of non-trivial reasons), so you should put the "start " bit
2853              in yourself, whenever it is needed.
2854
2855       $pdf_update_command [""]
2856              When the pdf previewer is set to be updated by  running  a  com‐
2857              mand,  this is the command that is run.  See the information for
2858              the variable $pdf_update_method.
2859
2860       $pdf_update_method [1 under UNIX, 3 under MS-Windows]
2861              How the pdf viewer updates its display when  the  pdf  file  has
2862              changed.  See the information on the variable $dvi_update_method
2863              for the codes.  (Note that information needs be changed slightly
2864              so  that for the value 4, to run a command to do the update, the
2865              command is specified by the  variable  $pdf_update_command,  and
2866              for  the  value  2,  to  specify update by signal, the signal is
2867              specified by $pdf_update_signal.)
2868
2869              Note that acroread under MS-Windows (but not UNIX) locks the pdf
2870              file, so the default value is then 3.
2871
2872              Arranging to use a command to get a previewer explicitly updated
2873              requires three variables to be set.  For example:
2874
2875                  $pdf_previewer = "start xpdf -remote %R %O %S";
2876                  $pdf_update_method = 4;
2877                  $pdf_update_command = "xpdf -remote %R -reload";
2878
2879              The first setting arranges for the xpdf program to  be  used  in
2880              its  "remote server mode", with the server name specified as the
2881              rootname of the TeX file.  The second setting arranges  for  up‐
2882              dating  to  be done in response to a command, and the third set‐
2883              ting sets the update command.
2884
2885       $pdf_update_signal [Under UNIX: SIGHUP,  which  is  a  system-dependent
2886       value]
2887              The  number of the signal that is sent to the pdf viewer when it
2888              is updated by sending a signal -- see  the  information  on  the
2889              variable  $pdf_update_method.   The default value is the one ap‐
2890              propriate for gv on a UNIX system.
2891
2892       $pid_position[1 under UNIX, -1 under MS-Windows]
2893              The variable $pid_position is used  to  specify  which  word  in
2894              lines  of  the output from $pscmd corresponds to the process ID.
2895              The first word in the line is numbered 0.  The default value  of
2896              1 (2nd word in line) is correct for Solaris 2.6, Linux, and OS-X
2897              with their default settings of $pscmd.
2898
2899              Setting the variable to -1 is used to indicate  that  $pscmd  is
2900              not to be used.
2901
2902       $postscript_mode [0]
2903              If  nonzero,  generate  a  postscript  version  of the document.
2904              Equivalent to the -ps option.
2905
2906              If some other request is made for which  a  postscript  file  is
2907              needed, then $postscript_mode will be set to 1.
2908
2909       $pre_tex_code ['']
2910
2911              Sets  TeX  code to be executed before inputting the source file.
2912              This works if the relevant one of $latex, etc contains  a  suit‐
2913              able command line with a %P or %U substitution.  For example you
2914              could do
2915
2916                   $latex = 'latex %O %P';
2917                   $pre_tex_code = '\AtBeginDocument{An initial message\par}';
2918
2919              To set all of $latex, $pdflatex,  $lualatex,  and  $xelatex  you
2920              could use the subroutine alt_tex_cmds:
2921
2922                   &alt_tex_cmds;
2923                   $pre_tex_code = '\AtBeginDocument{An initial message\par}';
2924
2925
2926
2927       $preview_continuous_mode [0]
2928              If  nonzero,  run a previewer to view the document, and continue
2929              running latexmk to keep .dvi up-to-date.  Equivalent to the -pvc
2930              option.   Which  previewer is run depends on the other settings,
2931              see the command line options -view=, and the variable $view.
2932
2933       $preview_mode [0]
2934              If nonzero, run a previewer to preview the document.  Equivalent
2935              to  the -pv option.  Which previewer is run depends on the other
2936              settings, see the command line options -view=, and the  variable
2937              $view.
2938
2939       $printout_mode [0]
2940              If  nonzero,  print  the document using the command specified in
2941              the $lpr variable.  Equivalent to the -p option.  This is recom‐
2942              mended  not to be set from an RC file, otherwise you could waste
2943              lots of paper.
2944
2945       $print_type = ["auto"]
2946              Type of file  to  printout:  possibilities  are  "auto",  "dvi",
2947              "none", "pdf", or "ps".   See the option -print= for the meaning
2948              of the "auto" value.
2949
2950       $pscmd Command used to get all the processes currently run by the user.
2951              The  -pvc  option  uses  the  command  specified by the variable
2952              $pscmd to determine if there is an  already  running  previewer,
2953              and  to  find  the process ID (needed if latexmk needs to signal
2954              the previewer about file changes).
2955
2956              Each line of the output of this command is assumed to correspond
2957              to  one  process.   See  the  $pid_position variable for how the
2958              process number is determined.
2959
2960              The default for pscmd is  "NONE"  under  MS-Windows  and  cygwin
2961              (i.e.,  the  command  is not used), "ps -ww -u $ENV{USER}" under
2962              OS-X, and "ps -f -u $ENV{USER}" under  other  operating  systems
2963              (including Linux).  In these specifications "$ENV{USER}" is sub‐
2964              stituted by the username.
2965
2966       $ps2pdf ["ps2pdf -dALLOWPSTRANSPARENCY %O %S %D"]
2967              Command to convert .ps to .pdf file.
2968
2969       $ps_filter [empty]
2970              The postscript file filter to be run on the newly produced post‐
2971              script  file  before other processing.  Equivalent to specifying
2972              the -pF option.
2973
2974       $ps_previewer ["start gv %O %S", but start %O %S under MS-Windows]
2975              The command to invoke a ps-previewer.  (The  default  under  MS-
2976              Windows will cause to be run whatever command the system has as‐
2977              sociated with .ps files.)
2978
2979              Note that gv could be used with the -watch  option  updates  its
2980              display  whenever the postscript file changes, whereas ghostview
2981              does not.  However, different versions of gv have slightly  dif‐
2982              ferent  ways  of  writing  this  option.  You can configure this
2983              variable appropriately.
2984
2985              WARNING: Linux systems may have installed one (or more) versions
2986              of  gv  under  different  names, e.g., ggv, kghostview, etc, but
2987              perhaps not one actually called gv.
2988
2989              Important note: Normally you will want to have a  previewer  run
2990              detached, so that latexmk doesn't wait for the previewer to ter‐
2991              minate before continuing its work.  So normally you should  pre‐
2992              fix  the  command  by  "start  ", which flags to latexmk that it
2993              should do the detaching of the  previewer  itself  (by  whatever
2994              method  is  appropriate to the operating system).  But sometimes
2995              letting latexmk do the detaching is not appropriate (for a vari‐
2996              ety  of non-trivial reasons), so you should put the "start " bit
2997              in yourself, whenever it is needed.
2998
2999
3000       $ps_previewer_landscape ["start gv -swap %O %S", but start %O %S  under
3001       MS-Windows]
3002              The command to invoke a ps-previewer in landscape mode.
3003
3004       $ps_update_command [""]
3005              When  the postscript previewer is set to be updated by running a
3006              command, this is the command that is run.  See  the  information
3007              for the variable $ps_update_method.
3008
3009       $ps_update_method [0 under UNIX, 1 under MS-Windows]
3010              How  the postscript viewer updates its display when the .ps file
3011              has changed.  See  the  information  on  the  variable  $dvi_up‐
3012              date_method  for  the  codes.   (Note  that information needs be
3013              changed slightly so that for the value 4, to run a command to do
3014              the  update,  the  command  is specified by the variable $ps_up‐
3015              date_command, and for the value 2, to specify update by  signal,
3016              the signal is specified by $ps_update_signal.)
3017
3018       $ps_update_signal  [Under  UNIX:  SIGHUP,  which  is a system-dependent
3019       value]
3020              The number of the signal that is sent to the pdf viewer when  it
3021              is  updated  by  sending a signal -- see $ps_update_method.  The
3022              default value is the one appropriate for gv on a UNIX system.
3023
3024       $pvc_timeout [0]
3025              If this variable is nonzero, there will be  a   timeout  in  pvc
3026              mode  after  a  period of inactivity.  Inactivity means a period
3027              when latexmk has detected no file  changes  and  hence  has  not
3028              taken any actions like compiling the document. The period of in‐
3029              activity is in the variable $pvc_timeout_mins.
3030
3031
3032       $pvc_timeout_mins [30]
3033              The period of inactivity, in minutes, after which pvc mode times
3034              out.  This is used if $pvc_timeout is nonzero.
3035
3036       $pvc_view_file_via_temporary [1]
3037              The same as $always_view_file_via_temporary, except that it only
3038              applies in preview-continuous mode (-pvc option).
3039
3040       $quote_filenames [1]
3041              This specifies whether substitutions for placeholders in command
3042              specifications  (as  in  $pdflatex)  are  surrounded  by  double
3043              quotes.  If this variable is 1 (or any other value Perl  regards
3044              as true), then quoting is done.  Otherwise quoting is omitted.
3045
3046              The  quoting  method used by latexmk is tested to work correctly
3047              under UNIX systems (including Linux and Mac OS-X) and under  MS-
3048              Windows.   It  allows  the  use  of filenames containing special
3049              characters, notably spaces.  (But note  that  many  versions  of
3050              *latex  cannot correctly deal with TeX files whose names contain
3051              spaces.  Latexmk's quoting only ensures that such filenames  are
3052              correctly  treated  by the operating system in passing arguments
3053              to programs.)
3054
3055       $recorder [1]
3056              Whether to use the -recorder option to (latex Use of this option
3057              results  in  a  file  of extension .fls containing a list of the
3058              files that these programs have read and written.   Latexmk  will
3059              then  use this file to improve its detection of source files and
3060              generated files after a run of *latex.
3061
3062              It is generally recommended to use this option (or to  configure
3063              the  $recorder  variable to be on.)  But it only works if *latex
3064              supports the -recorder option, which is true  for  most  current
3065              implementations
3066
3067              Note  about  the  name of the .fls file: Most implementations of
3068              *latex produce an .fls file with the same basename as  the  main
3069              document's LaTeX, e.g., for Document.tex, the .fls file is Docu‐
3070              ment.fls.  However, some implementations instead  produce  files
3071              named for the program, i.e., latex.fls or pdflatex.fls.  In this
3072              second case, latexmk copies the latex.fls or pdflatex.fls  to  a
3073              file  with  the basename of the main LaTeX document, e.g., Docu‐
3074              ment.fls.
3075
3076       $search_path_separator [See below for default]
3077              The character separating paths in the environment variables TEX‐
3078              INPUTS,  BIBINPUTS, and BSTINPUTS.  This variable is mainly used
3079              by latexmk when the -outdir, -output-directory, -auxdir,  and/or
3080              -aux-directory  options are used.  In that case latexmk needs to
3081              communicate  appropriately  modified  search  paths  to  bibtex,
3082              dvipdf, dvips, and *latex.
3083
3084              [Comment  to  technically savvy readers: *latex doesn't actually
3085              need the modified search path.  But,  surprisingly,  dvipdf  and
3086              dvips  do, because sometimes graphics files get generated in the
3087              output or aux directories.]
3088
3089              The default under MSWin and Cygwin is ';'  and  under  UNIX-like
3090              operating  systems  (including Linux and OS-X) is ':'.  Normally
3091              the defaults give correct behavior.  But there can be  difficul‐
3092              ties  if  your operating system is of one kind, but some of your
3093              software is running under an emulator for the other kind of  op‐
3094              erating  system;  in  that  case you'll need to find out what is
3095              needed, and set $search_path_separator  explicitly.   (The  same
3096              goes,  of  course, for unusual operating systems that are not in
3097              the MSWin, Linux, OS-X, Unix collection.)
3098
3099       $show_time [0]
3100              Whether to show CPU time used.
3101
3102       $silence_logfile_warnings [0]
3103              Whether after a run of *latex to summarize warnings in  the  log
3104              file  about  undefined  citations  and references.  Setting $si‐
3105              lence_logfile_warnings=0 gives the summary of warnings (provided
3106              silent  mode isn't also set), and this is useful to locate unde‐
3107              fined citations and references  without  searching  through  the
3108              much  more verbose log file or the screen output of *latex.  But
3109              the summary can also be excessively annoying.   The  default  is
3110              not  to  give  these  warnings.   The  command line options -si‐
3111              lence_logfile_warning_list  and   -silence_logfile_warning_list-
3112              also set this variable.
3113
3114              Note  that multiple occurrences for the same undefined object on
3115              the same page and same line will be compressed to a single warn‐
3116              ing.
3117
3118       $silent [0]
3119              Whether  to run silently.  Setting $silent to 1 has the same ef‐
3120              fect as the -quiet of -silent options on the command line.
3121
3122       $sleep_time [2]
3123              The time to sleep (in seconds) between checking for source  file
3124              changes when running with the -pvc option.  This is subject to a
3125              minimum of one second delay, except that zero delay is also  al‐
3126              lowed.
3127
3128              A  value  of  exactly 0 gives no delay, and typically results in
3129              100% CPU usage, which may not be desirable.
3130
3131       $texfile_search [""]
3132              This is an obsolete variable,  replaced  by  the  @default_files
3133              variable.
3134
3135              For   backward   compatibility,  if  you  choose  to  set  $tex‐
3136              file_search, it is a string of  space-separated  filenames,  and
3137              then latexmk replaces @default_files with the filenames in $tex‐
3138              file_search to which is added "*.tex".
3139
3140       $success_cmd [undefined]
3141              See the documentation for $compiling_cmd.
3142
3143       $tmpdir [See below for default]
3144              Directory to store temporary files  that  latexmk  may  generate
3145              while running.
3146
3147              The  default  under MSWindows (including cygwin), is to set $tm‐
3148              pdir to the value of the first of whichever of the system  envi‐
3149              ronment  variables  TMPDIR or TEMP exists, otherwise to the cur‐
3150              rent directory.  Under other operating systems (expected  to  be
3151              UNIX/Linux,  including  OS-X),  the  default is the value of the
3152              system environment  variable  TMPDIR  if  it  exists,  otherwise
3153              "/tmp".
3154
3155       $use_make_for_missing_files [0]
3156              Whether to use make to try and make files that are missing after
3157              a run of *latex, and for which a custom dependency has not  been
3158              found.   This  is  generally useful only when latexmk is used as
3159              part of a bigger project which is built by using the  make  pro‐
3160              gram.
3161
3162              Note that once a missing file has been made, no further calls to
3163              make will be made on a subsequent run of latexmk to  update  the
3164              file.   Handling  this  problem is the job of a suitably defined
3165              Makefile.  See the section "USING latexmk WITH make" for how  to
3166              do  this.   The intent of calling make from latexmk is merely to
3167              detect dependencies.
3168
3169       $view ["default"]
3170              Which kind of file is to be previewed if a  previewer  is  used.
3171              The  possible  values  are  "default",  "dvi", "ps", "pdf".  The
3172              value of "default" means that the "highest" of the kinds of file
3173              generated is to be used (among .dvi, .ps and .pdf).
3174
3175
3176       $warnings_as_errors [0]
3177              Normally  latexmk copies the behavior of latex in treating unde‐
3178              fined references and citations and multiply  defined  references
3179              as  conditions  that give a warning but not an error.  The vari‐
3180              able $warnings_as_errors controls whether this behavior is modi‐
3181              fied.
3182
3183              When  the  variable  is  non-zero, latexmk at the end of its run
3184              will return a non-zero status code to the  operating  system  if
3185              any  of  the files processed gives a warning about problems with
3186              citations or references (i.e., undefined citations or references
3187              or multiply defined references).  This is after latexmk has com‐
3188              pleted all the runs it needs to try and resolve  references  and
3189              citations.   Thus  $warnings_as_errors  being nonzero causes la‐
3190              texmk to treat such warnings as errors, but only when they occur
3191              on the last run of *latex and only after processing is complete.
3192              A non-zero value $warnings_as_errors can be set by the  command-
3193              line option -Werror.
3194
3195              The default behavior is normally satisfactory in the usual edit-
3196              compile-edit cycle.  But, for example, latexmk can also be  used
3197              as  part  of  a build process for some bigger project, e.g., for
3198              creating documentation in the build of a  software  application.
3199              Then  it is often sensible to treat citation and reference warn‐
3200              ings as errors that require the  overall  build  process  to  be
3201              aborted.  Of course, since multiple runs of *latex are generally
3202              needed to resolve references and citations, what matters is  not
3203              the warnings on the first run, but the warnings on the last run;
3204              latexmk takes this into account appropriately.
3205
3206              In addition, when preview-continuous mode is  used,  a  non-zero
3207              value  for  $warnings_as_errors  changes the use of the commands
3208              $failure_cmd, $warning_cmd, and $success_cmd  after  a  complia‐
3209              tion.  If there are citation or reference warnings, but no other
3210              errors, the behavior is as follows. If $warning_cmd is  set,  it
3211              is  used.  If it is not set, then then if $warnings_as_errors is
3212              non-zero and $failure_cmd is set, then $failure_cmd.   Otherwise
3213              $success_cmd  is used, if it is set.  (The foregoing explanation
3214              is rather complicated, because latexmk has to deal with the case
3215              that one or more of the commands isn't set.)
3216
3217
3218       $xdvipdfmx ["xdvipdfmx -E -o %D %O %S"]
3219
3220              The  program  to  make a pdf file from an xdv file (used in con‐
3221              junction with xelatex when $pdf_mode=5).
3222
3223       $xdvipdfmx_silent_switch ["-q"]
3224              Switch(es) for the xdvipdfmx program when silent mode is on.
3225
3226       $xelatex ["xelatex %O %S"]
3227              Specifies the command line for the LaTeX processing  program  of
3228              when  the  xelatex program is called for.  See the documentation
3229              of the -xelatex option for some special properties of  latexmk's
3230              use of xelatex.
3231
3232              Note  about xelatex: latexmk uses xelatex to make an .xdv rather
3233              than .pdf file, with the .pdf file being created in  a  separate
3234              step.  This is enforced by the use of the -no-pdf option.  If %O
3235              is part of the command for invoking xelatex, then  latexmk  will
3236              insert the -no-pdf option automatically, otherwise you must pro‐
3237              vide the option yourself.  See the documentation for the  -pdfxe
3238              option for why latexmk makes a .xdv file rather than a .pdf file
3239              when xelatex is used.
3240
3241              To do a coordinated setting of all of $latex, $pdflatex, $luala‐
3242              tex, and $xelatex, see the section "Advanced Configuration".
3243
3244
3245       %xelatex_input_extensions
3246              This  variable specifies the extensions tried by latexmk when it
3247              finds that an xelatex run resulted in an error that a  file  has
3248              not  been  found,  and  the  file is given without an extension.
3249              This typically happens when LaTeX  commands  of  the  form  \in‐
3250              put{file}  or \includegraphics{figure}, when the relevant source
3251              file does not exist.
3252
3253              In this situation, latexmk searches for custom  dependencies  to
3254              make  the  missing  file(s),  but restricts it to the extensions
3255              specified by the variable  %xelatex_input_extensions.   The  de‐
3256              fault extensions are 'tex', 'pdf', 'jpg, and 'png'.
3257
3258              See details of the %latex_input_extensions for other information
3259              that equally applies to %xelatex_input_extensions.
3260
3261       $xelatex_silent_switch ["-interaction=batchmode"]
3262              Switch(es) for the xelatex program (specified  in  the  variable
3263              $xelatex) when silent mode is on.
3264
3265              See  details  of  the $latex_silent_switch for other information
3266              that equally applies to $xelatex_silent_switch.
3267
3268
3269
3270

CUSTOM DEPENDENCIES

3272       In any RC file a set of custom dependencies can be set up to convert  a
3273       file with one extension to a file with another.  An example use of this
3274       would be to allow latexmk to convert a .fig file to .eps to be included
3275       in the .tex file.
3276
3277
3278   Defining a custom dependency:
3279       The old method of configuring latexmk to use a custom dependency was to
3280       directly manipulate the @cus_dep_list array that  contains  information
3281       defining  the  custom  dependencies.   (See  the section "Old Method of
3282       Defining Custom Dependencies" for details.) This  method  still  works,
3283       but is no longer preferred.
3284
3285       A better method is to use the subroutines that allow convenient manipu‐
3286       lations of the custom dependency list.  These are
3287
3288           add_cus_dep( fromextension, toextension, must, subroutine )
3289           remove_cus_dep( fromextension, toextension )
3290           show_cus_dep()
3291
3292       The arguments are as follows:
3293
3294       from extension:
3295              The extension of the file we are converting from  (e.g.  "fig").
3296              It is specified without a period.
3297
3298       to extension:
3299              The extension of the file we are converting to (e.g. "eps").  It
3300              is specified without a period.
3301
3302       must:  If non-zero, the file from which we are converting  must  exist,
3303              if  it doesn't exist latexmk will give an error message and exit
3304              unless the -f option is specified.  If must is zero and the file
3305              we  are  converting from doesn't exist, then no action is taken.
3306              Generally, the appropriate value of must is zero.
3307
3308       function:
3309              The name of the subroutine that latexmk should call  to  perform
3310              the  file  conversion.   The first argument to the subroutine is
3311              the base name of the file to be converted without any extension.
3312              The  subroutines  are declared in the syntax of Perl.  The func‐
3313              tion should return 0 if it was successful and a  nonzero  number
3314              if it failed.
3315
3316
3317       Naturally  add_cus_dep adds a custom dependency with the specified from
3318       and to extensions.  If a custom dependency has been previously  defined
3319       (e.g.,  in an rcfile that was read earlier), then it is replaced by the
3320       new one.
3321
3322       The subroutine remove_cus_dep removes the specified custom  dependency.
3323       The subroutine show_cus_dep causes a list of the currently defined cus‐
3324       tom dependencies to be sent to the screen output.
3325
3326
3327   How custom dependencies are used:
3328       An instance of a custom dependency rule is created whenever latexmk de‐
3329       tects  that a run of *latex needs to read a file, like a graphics file,
3330       whose extension is the to-extension of a custom dependency.   Then  la‐
3331       texmk  examines  whether a file exists with the same name, but with the
3332       corresponding from-extension, as specified  in  the  custom-dependency.
3333       If  it  does, then a corresponding instance of the custom dependency is
3334       created, after which the rule is invoked whenever the destination  file
3335       (the one with the to-extension) is out-of-date with respect to the cor‐
3336       responding source file.
3337
3338       To make the new destination file, the Perl subroutine specified in  the
3339       rule is invoked, with an argument that is the base name of the files in
3340       question.  Simple cases just involve a subroutine invoking an  external
3341       program;  this  can  be  done by following the templates below, even by
3342       those without knowledge of the Perl programming language.   Of  course,
3343       experts could do something much more elaborate.
3344
3345       One  item  in the specification of each custom-dependency rule, labeled
3346       "must" above, specifies how the rule should be applied when the  source
3347       file fails to exist.
3348
3349       When  latex reports that an input file (e.g., a graphics file) does not
3350       exist, latexmk tries to find a source file and a custom dependency that
3351       can be used to make it.  If it succeeds, then it creates an instance of
3352       the custom dependency and invokes it to make the  missing  file,  after
3353       which the next pass of latex etc will be able to read the newly created
3354       file.
3355
3356       Note for advanced usage: The operating  system's  environment  variable
3357       TEXINPUTS can be used to specify a search path for finding files by la‐
3358       tex etc.  Correspondingly, when a missing  file  is  reported,  latexmk
3359       looks  in the directories specified in TEXINPUTS as well as in the cur‐
3360       rent directory, to find a source file from which an instance of a  cus‐
3361       tom dependency can be used to make the missing file.
3362
3363
3364   Function to implement custom dependency, traditional method:
3365       The  function  that implements a custom dependency gets the information
3366       on the files to be processed in two ways.  The first is through its one
3367       argument;  the argument contains the base name of the source and desti‐
3368       nation files.  The second way is described later.
3369
3370       A simple and typical example of code in an initialization rcfile  using
3371       the first method is:
3372
3373           add_cus_dep( 'fig', 'eps', 0, 'fig2eps' );
3374           sub fig2eps {
3375               system( "fig2dev -Leps \"$_[0].fig\" \"$_[0].eps\"" );
3376           }
3377
3378       The  first  line adds a custom dependency that converts a file with ex‐
3379       tension "fig", as created by the xfig program, to an encapsulated post‐
3380       script  file,  with extension "eps".  The remaining lines define a sub‐
3381       routine that carries out the conversion.   If  a  rule  for  converting
3382       "fig"  to  "eps"  files already exists (e.g., from a previously read-in
3383       initialization file), the latexmk will delete this rule  before  making
3384       the new one.
3385
3386       Suppose  latexmk  is  using this rule to convert a file "figure.fig" to
3387       "figure.eps".  Then it will invoke the fig2eps  subroutine  defined  in
3388       the  above  code with a single argument "figure", which is the basename
3389       of each of the files (possibly with a path component).   This  argument
3390       is  referred to by Perl as $_[0].  In the example above, the subroutine
3391       uses the Perl command system to invoke the program fig2dev.  The double
3392       quotes around the string are a Perl idiom that signify that each string
3393       of the form of a variable name, $_[0] in this case, is  to  be  substi‐
3394       tuted by its value.
3395
3396       If  the  return  value of the subroutine is non-zero, then latexmk will
3397       assume an error occurred during the execution of  the  subroutine.   In
3398       the  above  example, no explicit return value is given, and instead the
3399       return value is the value returned by the last  (and  only)  statement,
3400       i.e., the invocation of system, which returns the value 0 on success.
3401
3402       If  you  use  pdflatex,  lualatex or xelatex instead of latex, then you
3403       will probably prefer to convert your graphics files to pdf  format,  in
3404       which  case  you would replace the above code in an initialization file
3405       by
3406
3407           add_cus_dep( 'fig', 'pdf, 0, 'fig2pdf' );
3408           sub fig2pdf {
3409               system( "fig2dev -Lpdf \"$_[0].fig\" \"$_[0].pdf\"" );
3410           }
3411
3412       Note 1: In the command lines given in the system commands in the  above
3413       examples,  double  quotes have been inserted around the file names (im‐
3414       plemented by '\"' in the Perl language).  They immunize the running  of
3415       the  program against special characters in filenames.  Very often these
3416       quotes are not necessary, i.e., they can be omitted.  But  it  is  nor‐
3417       mally  safer  to  keep them in.  Even though the rules for quoting vary
3418       between operating systems, command  shells  and  individual  pieces  of
3419       software, the quotes in the above examples do not cause problems in the
3420       cases I have tested.
3421
3422       Note 2: One case in which the quotes are important is  when  the  files
3423       are  in  a subdirectory and your operating system is Microsoft Windows.
3424       Then the separator character for directory components can be  either  a
3425       forward  slash  '/' or Microsoft's more usual backward slash ´\'.  For‐
3426       ward slashes are generated by latexmk,  to  maintain  its  sanity  from
3427       software  like  MiKTeX  that mixes both directory separators; but their
3428       correct use normally requires quoted filenames.  (See a log file from a
3429       run  of  MiKTeX  (at least in v. 2.9) for an example of the use of both
3430       directory separators.)
3431
3432       Note 3: The subroutines implementing custom dependencies in  the  exam‐
3433       ples  given  just  have  a  single  line  invoking an external program.
3434       That's the usual situation.  But since the subroutines are in the  Perl
3435       language,  you  can  implement  much more complicated processing if you
3436       need it.
3437
3438
3439   Removing custom dependencies, and when you might need to do this:
3440       If you have some general custom dependencies defined in the  system  or
3441       user  initialization  file,  you may find that for a particular project
3442       they are undesirable.  So you might want to delete the  unneeded  ones.
3443       A  situation  where this would be desirable is where there are multiple
3444       custom dependencies with the same from-extension or the same  to-exten‐
3445       sion.  In  that case, latexmk might choose a different one from the one
3446       you want for a specific project.  As an example, to remove any "fig" to
3447       "eps" rule you would use:
3448
3449           remove_cus_dep( 'fig', 'eps' );
3450
3451       If  you  have  complicated sets of custom dependencies, you may want to
3452       get a listing of the custom dependencies.  This is done  by  using  the
3453       line
3454
3455           show_cus_dep();
3456
3457       in an initialization file.
3458
3459
3460   Function implementing custom dependency, alternative methods:
3461       So far the examples for functions to implement custom dependencies have
3462       used the argument of the function to specify the base name of converted
3463       file.   This  method  has been available since very old versions of la‐
3464       texmk, and many examples can be found, e.g., on the web.
3465
3466       However in later versions of latexmk the internal structure of the  im‐
3467       plementation of its "rules" for the steps of processing, including cus‐
3468       tom dependencies, became much more powerful.  The function implementing
3469       a custom dependency is executed within a special context where a number
3470       of extra variables and subroutines are  defined.   Publicly  documented
3471       ones,  intended  to  be  long-term  stable, are listed below, under the
3472       heading "Variables and subroutines for processing a rule".
3473
3474       Examples of their use is given in the  following  examples,  concerning
3475       multiple index files and glossaries.
3476
3477       The  only  index-file  conversion built-in to latexmk is from an ".idx"
3478       file written on one run of *latex to an ".ind" file to be read in on  a
3479       subsequent  run.   But with the index.sty package, for example, you can
3480       create extra indexes with extensions that you configure.  Latexmk  does
3481       not know how to deduce the extensions from the information it has.  But
3482       you can easily write a custom dependency.  For example  if  your  latex
3483       file uses the command "\newindex{special}{ndx}{nnd}{Special index}" you
3484       will need to get latexmk to convert files with the  extension  .ndx  to
3485       .nnd.   The  most elementary method is to define a custom dependency as
3486       follows:
3487
3488           add_cus_dep( 'ndx', 'nnd', 0, 'ndx2nnd' );
3489           sub ndx2nnd {
3490               return system( "makeindex -o \"$_[0].nnd\" \"$_[0].ndx\"" );
3491           }
3492           push @generated_exts, 'ndx', 'nnd';
3493
3494       Notice the added line compared with earlier examples.  The  extra  line
3495       gets the extensions "ndx" and "nnd" added to the list of extensions for
3496       generated files; then the extra index files will be deleted by clean-up
3497       operations
3498
3499       But  if  you have yet more indexes with yet different extensions, e.g.,
3500       "adx" and "and", then you will need a separate function for  each  pair
3501       of  extensions.   This  is  quite  annoying.  You can use the Run_subst
3502       function to simplify the definitions to use a single function:
3503
3504           add_cus_dep( 'ndx', 'nnd', 0, 'dx2nd' );
3505           add_cus_dep( 'adx', 'and', 0, 'dx2nd' );
3506           sub dx2nd {
3507               return Run_subst( "makeindex -o %D %S" );
3508           }
3509           push @generated_exts, 'ndx', 'nnd', 'adx', 'and';
3510
3511       You could also instead use
3512
3513           add_cus_dep( 'ndx', 'nnd', 0, 'dx2nd' );
3514           add_cus_dep( 'adx', 'and', 0, 'dx2nd' );
3515           sub dx2nd {
3516               return Run_subst( $makeindex );
3517           }
3518           push @generated_exts, 'ndx', 'nnd', 'adx', 'and';
3519
3520       This last example uses the command specification in $makeindex, and  so
3521       any  customization you have made for the standard index also applies to
3522       your extra indexes.
3523
3524       Similar techniques can be applied for glossaries.
3525
3526       Those of you with experience with Makefiles, may get concerned that the
3527       .ndx  file  is  written during a run of *latex and is always later than
3528       the .nnd last read in.  Thus the .nnd appears to be perpetually out-of-
3529       date.   This  situation, of circular dependencies, is endemic to latex,
3530       and is one of the issues that latexmk is programmed  to  overcome.   It
3531       examines  the  contents  of  the files (by use of a checksum), and only
3532       does a remake when the file contents have actually changed.
3533
3534       Of course if you choose to write random data to the .nnd (or  the  .aux
3535       file,  etc) that changes on each new run, then you will have a problem.
3536       For real experts: See the %hash_calc_ignore_pattern if you have to deal
3537       with such problems.
3538
3539
3540   Old Method of Defining Custom Dependencies:
3541       In  much  older versions of latexmk, the only method of defining custom
3542       dependencies was to directly manipulate the table of  custom  dependen‐
3543       cies.  This is contained in the @cus_dep_list array.  It is an array of
3544       strings, and each string in the array has four items in it, each  sepa‐
3545       rated  by  a  space,  the  from-extension, the to-extension, the "must"
3546       item, and the name of the subroutine for the custom dependency.   These
3547       were all defined above.
3548
3549       An example of the old method of defining custom dependencies is as fol‐
3550       lows. It is the code in an RC file to ensure  automatic  conversion  of
3551       .fig files to .eps files:
3552
3553           push @cus_dep_list, "fig eps 0 fig2eps";
3554           sub fig2eps {
3555               return system( "fig2dev -Lps \"$_[0].fig\" \"$_[0].eps\"" );
3556           }
3557
3558       This  method  still  works,  and is almost equivalent to the code given
3559       earlier that used the add_cus_dep subroutine.  However, the old  method
3560       doesn't  delete any previous custom-dependency for the same conversion.
3561       So the new method is preferable.
3562
3563
3564

ADVANCED CONFIGURATION: Some extra resources and advanced tricks

3566       For most purposes, simple configuration for latexmk along the lines  of
3567       the  examples  given  is  sufficient.  But sometimes you need something
3568       harder.  In this section, I indicate some extra possibilities.   Gener‐
3569       ally  to  use  these, you need to be fluent in the Perl language, since
3570       this is what is used in the rc files.
3571
3572       See also the section DEALING WITH ERRORS, PROBLEMS, ETC.  See also  the
3573       examples in the directory example_rcfiles in the latexmk distributions.
3574       Even if none of the examples apply to your case, they may give you use‐
3575       ful ideas
3576
3577
3578   Utility subroutines
3579       ensure_path( var, values ...)
3580
3581              The  first parameter is the name of one of the system's environ‐
3582              ment variables for search paths.  The remaining  parameters  are
3583              values  that  should  be in the variable.  For each of the value
3584              parameters, if it isn't already in  the  variable,  then  it  is
3585              prepended to the variable; in that case the environment variable
3586              is created if it doesn't already exist. For  separating  values,
3587              the  character  appropriate  the the operating system is used --
3588              see the configuration variable $search_path_separator.
3589
3590              Example:
3591
3592                ensure_path( 'TEXINPUTS', './custom_cls_sty_files//' );
3593
3594              (In this example, the trailing '//' is documented by TeX systems
3595              to  mean that *latex search for files in the specified directory
3596              and in all subdirectories.)
3597
3598              Technically  ensure_path  works  by  setting   Perl's   variable
3599              $ENV{var},  where  var  is the name of the target variable.  The
3600              changed value is then passed as an environment variable  to  any
3601              invoked programs.
3602
3603
3604   Variables and subroutines for processing a rule
3605       A step in the processing is called a rule. One possibility to implement
3606       the processing of a rule is by a Perl subroutine.  This is  always  the
3607       case  for  custom dependencies. Also, for any other rule, you can use a
3608       subroutine by prefixing the command specification by the  word  "inter‐
3609       nal" -- see the section FORMAT OF COMMAND SPECIFICATIONS.
3610
3611       When  you use a subroutine for processing a rule, all the possibilities
3612       of Perl programming are available, of course.  In addition, some of la‐
3613       texmk's  internal  variables  and  subroutines are available.  The ones
3614       listed below are intended to be  available  to  (advanced)  users,  and
3615       their specifications will generally have stability under upgrades. Gen‐
3616       erally, the variables should be treated as  read-only:  Changing  their
3617       values  can  have  bad  consequences, since it is liable to mess up the
3618       consistency of what latexmk is doing.
3619
3620       $rule  This variable has the name of the rule,  as  known  to  latexmk.
3621              Note  that  the exact contents of this variable for a given rule
3622              may be dependent on the version of latexmk
3623
3624       $$Psource
3625              This gives the name of the primary source file.  Note the double
3626              dollar signs.
3627
3628       $$Pdest
3629              This  gives  the  name of the main output file if any.  Note the
3630              double dollar signs.
3631
3632       rdb_ensure_file( $rule, file )
3633              This a subroutine that ensures that the given file is among  the
3634              source files for the specified rule.  It is typically used when,
3635              during the processing of a rule, it is known that  a  particular
3636              extra  file  is among the dependencies that latexmk should know,
3637              but its default methods don't find the dependency. Almost always
3638              the  first argument is the name of the rule currently being pro‐
3639              cessed, so it is then appropriate to specify it by $rule.
3640
3641              For examples of its use, see some of the files in the  directory
3642              example_rcfiles  of latexmk's distribution.  Currently the cases
3643              that use this  subroutine  are  bib2gls-latexmkrc,  exceltex_la‐
3644              texmkrc  and  texinfo-latexmkrc.  These illustrate typical cases
3645              where latexmk's normal processing fails to detect certain  extra
3646              source files.
3647
3648       rdb_remove_files( $rule, file, ... )
3649              This  subroutine  removes  one or more files from the dependency
3650              list for the given rule.
3651
3652       rdb_list_source( $rule )
3653              This subroutine returns the list of source files (i.e., the  de‐
3654              pendency list) for the given rule.
3655
3656       rdb_set_source( $rule, file, ... )
3657
3658       rdb_set_source( $rule, @files )
3659              This  subroutine  sets the dependency list for the given rule to
3660              be the specified files.  Files that are already in the list have
3661              unchanged  information.   Files  that  were  not in the list are
3662              added to it.  Files in the previous dependency list that are not
3663              in the newly specified list of files are removed from the depen‐
3664              dency list.
3665
3666       Run_subst( command_spec )
3667              This subroutine runs the command specified by command_spec.  The
3668              specification  is  a  string in the format listed in the section
3669              "Format of Command Specifications".  An important action of  the
3670              Run_subst is to make substitutions of placeholders, e.g., %S and
3671              %D for source and destination files; these get  substituted  be‐
3672              fore the command is run.  In addition, the command after substi‐
3673              tution is printed to the screen unless  latexmk  is  running  in
3674              silent mode.
3675
3676
3677   Coordinated Setting of Commands for *latex
3678       To  set  all  of $latex, $pdflatex, $lualatex, and $xelatex to a common
3679       pattern, you can use one of the  following  subroutines,  std_tex_cmds,
3680       alt_tex_cmds, and set_tex_cmds.
3681
3682       They work as follows
3683
3684          &std_tex_cmds;
3685
3686       This  results  in  $latex = 'latex %O %S', and similarly for $pdflatex,
3687       $lualatex, and $xelatex.  Note the ampersand in  the  invocation;  this
3688       indicates to Perl that a subroutine is being called.
3689
3690          &alt_tex_cmds;
3691
3692       This  results  in  $latex = 'latex %O %P', and similarly for $pdflatex,
3693       $lualatex, and $xelatex.  Note the ampersand in  the  invocation;  this
3694       indicates to Perl that a subroutine is being called.
3695
3696         set_tex_cmds( CMD_SPEC );
3697
3698       Here  CMD_SPEC  is  the command line without the program name. This re‐
3699       sults in $latex = 'CMD_SPEC', and similarly for  $pdflatex,  $lualatex,
3700       and $xelatex. An example would be
3701
3702         set_tex_cmds( '--interaction=batchmode %O %S' );
3703
3704
3705   Advanced configuration: Using latexmk with make
3706       This  section  is targeted only at advanced users who use the make pro‐
3707       gram for complex projects, as for software development, with the depen‐
3708       dencies specified by a Makefile.
3709
3710       Now  the  basic  task  of latexmk is to run the appropriate programs to
3711       make a viewable version of a LaTeX document.  However, the  usual  make
3712       program  is not suited to this purpose for at least two reasons.  First
3713       is that the use of LaTeX involves circular dependencies (e.g., via .aux
3714       files), and these cannot be handled by the standard make program.  Sec‐
3715       ond is that in a large document the set  of  source  files  can  change
3716       quite  frequently,  particularly  with included graphics files; in this
3717       situation keeping a Makefile manually updated is inappropriate and  er‐
3718       ror-prone, especially when the dependencies can be determined automati‐
3719       cally.  Latexmk solves both of these problems robustly.
3720
3721       Thus for many standard LaTeX documents latexmk can be  used  by  itself
3722       without  the  make program.  In a complex project it simply needs to be
3723       suitably configured.  A standard configuration would be to define  cus‐
3724       tom  dependencies to make graphics files from their source files (e.g.,
3725       as created by the xfig program).   Custom  dependencies  are  latexmk's
3726       equivalent of pattern rules in Makefiles.
3727
3728       Nevertheless  there  are  projects for which a Makefile is appropriate,
3729       and it is useful to know how to use latexmk from a Makefile.  A typical
3730       example would be to generate documentation for a software project.  Po‐
3731       tentially the interaction with the rest of the rules  in  the  Makefile
3732       could be quite complicated, for example if some of the source files for
3733       a LaTeX document are generated by the project's software.
3734
3735       In this section, I give a couple of examples of how latexmk can be use‐
3736       fully  invoked  from a Makefile.  The examples use specific features of
3737       current versions of GNU make, which is the default on  both  linux  and
3738       OS-X systems.  They may need modifications for other versions of make.
3739
3740       The simplest method is simply to delegate all the relevant tasks to la‐
3741       texmk, as is suitable for a straightforward LaTeX document.  For this a
3742       suitable Makefile is like
3743
3744           .PHONY : FORCE_MAKE
3745           all : try.pdf
3746           %.pdf : %.tex FORCE_MAKE
3747               latexmk -pdf -dvi- -ps- $<
3748
3749       (Note:  the  last  line must be introduced by a tab for the Makefile to
3750       function correctly!)  Naturally, if making try.pdf from its  associated
3751       LaTeX  file try.tex were the only task to be performed, a direct use of
3752       latexmk without a Makefile would normally be better.   The  benefit  of
3753       using  a  Makefile  for  a LaTeX document would be in a larger project,
3754       where lines such as the above would be only be a small part of a larger
3755       Makefile.
3756
3757       The above example has a pattern rule for making a .pdf file from a .tex
3758       file, and it is defined to use latexmk in the obvious way.  There is  a
3759       conventional  default  target  named  "all",  with  a  prerequisite  of
3760       try.pdf.  So when make is invoked, by default it  makes  try.pdf.   The
3761       only  complication  is  that  there  may  be  many  source files beyond
3762       try.tex, but these aren't specified in the Makefile, so changes in them
3763       will  not by themselves cause latexmk to be invoked.  Instead, the pat‐
3764       tern rule is equipped with a "phony" prerequisite FORCE_MAKE; this  has
3765       the  effect  of  causing the rule to be always out-of-date, so that la‐
3766       texmk is always run.  It is latexmk that decides whether any action  is
3767       needed,  e.g., a rerun of pdflatex.  Effectively the Makefile delegates
3768       all decisions to latexmk, while make has no knowledge of  the  list  of
3769       source files except for primary LaTeX file for the  document.  If there
3770       are, for example, graphics files to be made, these must be made by cus‐
3771       tom dependencies configured in latexmk.
3772
3773       But  something better is needed in more complicated situations, for ex‐
3774       ample, when the making of graphics files needs to be specified by rules
3775       in  the  Makefile.  To do this, one can use a Makefile like the follow‐
3776       ing:
3777
3778            TARGETS = document1.pdf document2.pdf
3779            DEPS_DIR = .deps
3780            LATEXMK = latexmk -recorder -use-make -deps \
3781                  -e 'warn qq(In Makefile, turn off custom dependencies\n);' \
3782                  -e '@cus_dep_list = ();' \
3783                  -e 'show_cus_dep();'
3784            all : $(TARGETS)
3785            $(foreach file,$(TARGETS),$(eval -include $(DEPS_DIR)/$(file)P))
3786            $(DEPS_DIR) :
3787                   mkdir $@
3788            %.pdf : %.tex
3789                   if [ ! -e $(DEPS_DIR) ]; then mkdir $(DEPS_DIR); fi
3790                   $(LATEXMK) -pdf -dvi- -ps- -deps-out=$(DEPS_DIR)/$@P $<
3791            %.pdf : %.fig
3792                   fig2dev -Lpdf $< $@
3793
3794       (Again, the lines containing the  commands  for  the  rules  should  be
3795       started with tabs.)  This example was inspired by how GNU automake han‐
3796       dles automatic dependency tracking of C source files.
3797
3798       After each run of latexmk, dependency information is put in a  file  in
3799       the  .deps subdirectory.  The Makefile causes these dependency files to
3800       be read by make, which now has the full dependency information for each
3801       target  .pdf  file.   To make things less trivial it is specificed that
3802       two files document1.pdf and document2.pdf are the targets.  The  depen‐
3803       dency files are .deps/document1.pdfP and .deps/document2.pdfP.
3804
3805       There  is  now  no need for the phony prerequisite for the rule to make
3806       .pdf files from .tex files.  But I have added a rule to make .pdf files
3807       from  .fig  files produced by the xfig program; these are commonly used
3808       for graphics insertions in LaTeX documents.   Latexmk  is  arranged  to
3809       output a dependency file after each run.  It is given the -recorder op‐
3810       tion, which improves its detection of files generated during a  run  of
3811       pdflatex;  such files should not be in the dependency list.  The -e op‐
3812       tions are used to turn off all custom  dependencies,  and  to  document
3813       this.   Instead the -use-make is used to delegate the making of missing
3814       files to make itself.
3815
3816       Suppose in the LaTeX file there is a  command  \includegraphics{graph},
3817       and  an xfig file "graph.fig" exists.  On a first run, pdflatex reports
3818       a missing file, named "graph". Latexmk succeeds in  making  "graph.pdf"
3819       by calling "make graph.pdf", and after completion of its work, it lists
3820       "fig.pdf" among the dependents of the file latexmk is making.  Then let
3821       "fig.fig"  be  updated,  and  then let make be run.  Make first remakes
3822       "fig.pdf", and only then reruns latexmk.
3823
3824       Thus we now have a method by which all  the  subsidiary  processing  is
3825       delegated to make.
3826
3827

SEE ALSO

3829       latex(1), bibtex(1), lualatex(1), pdflatex(1), xelatex(1).
3830

BUGS

3832       Sometimes a viewer (gv) tries to read an updated .ps or .pdf file after
3833       its creation is started but before the file is complete.  Work  around:
3834       manually refresh (or reopen) display.  Or use one of the other preview‐
3835       ers and update methods.
3836
3837       (The following isn't really a bug, but concerns  features  of  preview‐
3838       ers.)   Preview  continuous mode only works perfectly with certain pre‐
3839       viewers: Xdvi on UNIX/Linux works for  dvi  files.   Gv  on  UNIX/Linux
3840       works  for  both  postscript  and pdf.  Ghostview on UNIX/Linux needs a
3841       manual update (reopen); it views postscript and pdf.  Gsview under  MS-
3842       Windows  works  for both postscript and pdf, but only reads the updated
3843       file when its screen is refreshed.   Acroread  under  UNIX/Linux  views
3844       pdf,  but  the  file needs to be closed and reopened to view an updated
3845       version.  Under MS-Windows, acroread locks its input file  and  so  the
3846       pdf  file  cannot  be updated.  (Remedy: configure latexmk to use suma‐
3847       trapdf instead.)
3848

THANKS TO

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

AUTHOR

3857       Current version, by John Collins (Version 4.74).  Report  bugs  etc  to
3858       his e-mail (jcc8 at psu.edu).
3859
3860       Released      version      can      be      obtained     from     CTAN:
3861       <http://www.ctan.org/pkg/latexmk/>,  and  from  the  author's   website
3862       <http://www.personal.psu.edu/jcc8/latexmk/>.
3863       Modifications and enhancements by Evan McLean (Version 2.0)
3864       Original script called "go" by David J. Musliner (RCS Version 3.2)
3865
3866
3867
3868
3869
3870
3871
3872
3873
3874
3875
3876
3877                                  16 May 2021                       LATEXMK(1)
Impressum