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

EXAMPLES

1232       % latexmk thesis    # run latex enough times to resolve
1233                           cross-references
1234
1235       % latexmk -pvc -ps thesis# run latex enough times to resolve
1236                           cross-references, make a postscript
1237                           file, start a previewer.  Then
1238                           watch for changes in the source
1239                           file thesis.tex and any files it
1240                           uses.  After any changes rerun latex
1241                           the appropriate number of times and
1242                           remake the postscript file.  If latex
1243                           encounters an error, latexmk will
1244                           keep running, watching for
1245                           source file changes.
1246
1247       % latexmk -c        # remove .aux, .log, .bbl, .blg, .dvi,
1248                           .pdf, .ps & .bbl files
1249
1250
1251

DEALING WITH ERRORS, PROBLEMS, ETC

1253       Some possibilities:
1254
1255       a.  If you get a strange error, do look carefully at the output that is
1256       on the screen and in log files.  While there is much  that  is  notori‐
1257       ously verbose in the output of latex (and that is added to by latexmk),
1258       the verbosity is there for a reason: to enable  the  user  to  diagnose
1259       problems.   Latexmk  does repeat some messages at the end of a run that
1260       it thinks would otherwise be easy to miss in the middle of  other  out‐
1261       put.
1262
1263       b. Generally, remember that latexmk does its work by running other pro‐
1264       grams.  Your first priority in dealing with errors should be to examine
1265       what went wrong with the individual programs.  Then you need to correct
1266       the causes of errors in the runs of these programs.  (Often these  come
1267       from  errors in the source document, but they could also be about miss‐
1268       ing LaTeX packages, etc.)
1269
1270       c. If latexmk doesn't run the programs the way you would like, then you
1271       need  to look in this documentation at the list of command line options
1272       and then at the sections on configuration/initialization files.  A  lot
1273       of  latexmk's  behavior  is configurable to deal with particular situa‐
1274       tions.  (But there is a lot of reading!)
1275
1276       The remainder of these notes consists of ideas for  dealing  with  more
1277       difficult situations.
1278
1279       d.  Further  tricks  can  involve  replacing the standard commands that
1280       latexmk runs by other commands or scripts.
1281
1282       e. For possible examples of code for use in an RC file, see the  direc‐
1283       tory   example_rcfiles   in  the  distribution  of  latexmk  (e.g.,  at
1284       http://mirror.ctan.org/support/latexmk/example_rcfiles).  Even if these
1285       examples don't do what you want, they may provide suitable inspiration.
1286
1287       f.  There's  a  useful  trick  that  can  be used when you use lualatex
1288       instead of pdflatex (and in some related situations).  The  problem  is
1289       that  latexmk won't notice a dependency on a file, bar.baz say, that is
1290       input by the lua code in your document instead of by  the  LaTeX  part.
1291       (Thus  if you change bar.baz and rerun latexmk, then latexmk will think
1292       no files have changed and  not  rerun  lualatex,  whereas  if  you  had
1293       '\input{bar.baz}'  in  the  LaTeX  part  of the document, latexmk would
1294       notice the change.)  One solution is just to put  the  following  some‐
1295       where in the LaTeX part of the document:
1296
1297                     \typeout{(bar.baz)}
1298
1299       This  puts  a  line in the log file that latexmk will treat as implying
1300       that the file bar.baz was read.  (At present I  don't  know  a  way  of
1301       doing  this  automatically.)   Of  course,  if the file has a different
1302       name, change bar.baz to the name of your file.
1303
1304       g. See also the section "Advanced Configuration: Some extra resources".
1305
1306       h.   Look   on   tex.stackexchange,   i.e.,   at    http://tex.stackex
1307       change.com/questions/tagged/latexmk   Someone  may  have already solved
1308       your problem.
1309
1310       i. Ask a question at tex.stackexchange.com.
1311
1312       j. Or ask me (the author of latexmk).  My e-mail is at the end of  this
1313       documentation.
1314
1315
1316

ALLOWING FOR CHANGE OF OUTPUT FILE TYPE

1318       When one of the latex engines is run, the usual situation is that latex
1319       produces a .dvi file, while pdflatex and lualatex produce a .pdf  file.
1320       For xelatex the default is to produce a .pdf file, but to optimize pro‐
1321       cessing time latexmk runs xelatex its -no-pdf option so  that  it  pro‐
1322       duces  an  .xdv  file.   Further  processing by latexmk takes this as a
1323       starting point.
1324
1325       However, the actual output file may differ from the normal expectation;
1326       and  then  latexmk can adjust its processing to accommodate this situa‐
1327       tion.  The difference in output file type can happen for  two  reasons:
1328       One  is  that  for latex, pdflatex and lualatex the document itself can
1329       override the defaults. The other is that there may be a  configuration,
1330       or misconfiguration, such that the program that latexmk invokes to com‐
1331       pile the document is not the expected one, or is given  options  incom‐
1332       patible  with  what latexmk initially expects.  (E.g., the -output-for‐
1333       mat=...  option could be used with lualatex, or  xelatex  gets  invoked
1334       without the -no-pdf option.)
1335
1336       Under  latex and pdflatex, control of the output format by the document
1337       is done by setting the \pdfoutput macro.  Under lualatex, the  \output‐
1338       mode macro is used instead.
1339
1340       One example of an important use-case for document control of the output
1341       format is a document that uses the psfrag package to  insert  graphical
1342       elements in the output file. The psfrag package achieves its effects by
1343       inserting postscript code in the output of the compilation of the docu‐
1344       ment.   This entails the use of compilation to a .dvi file, followed by
1345       the use of conversion to a postscript  file  (either  directly,  as  by
1346       dvips  or  implicitly,  as an intermediate step by dvipdf).  Then it is
1347       useful to force output to be of the .dvi format by  inserting  \pdfout‐
1348       put=0 in the preamble of the document.
1349
1350       Another  example  is where the document uses graphics file of the .pdf,
1351       .jpg, and png types.  With the default setting for the  graphicx  pack‐
1352       age,  these can be processed in compilation to .pdf but not with compi‐
1353       lation to .dvi.  In this case, it is useful to insert  \pdfoutput=1  in
1354       the  preamble  of the document to force compilation to .pdf output for‐
1355       mat.
1356
1357       In all of these cases, it is needed that latexmk has to adjust its pro‐
1358       cessing  to  deal with a mismatch between the actual output format (out
1359       of .pdf, .dvi, .xdv) and the initially expected  output,  if  possible.
1360       Latexmk does this provided the following conditions are met.
1361
1362       The first is that latexmk's $allow_switch configuration variable is set
1363       to a non-zero value as it is by default.  If this variable is  zero,  a
1364       mismatch of filetypes in the compilation results in an erro.
1365
1366       The  second condition for latexmk to be able to handle a change of out‐
1367       put type is that no explicit requests for .dvi or .ps output files  are
1368       made.    Explicit  requests  are  by  the  -dvi  and  -ps,  -print=dvi,
1369       -print=ps, -view=dvi, and -view=ps options, and by  corresponding  set‐
1370       tings  of  the $dvi_mode, $postscript_mode, $print_type, and $view con‐
1371       figuration variables.  The print-type and view-type  restrictions  only
1372       apply when printing and viewing are explicitly requested, respectively.
1373       For this purpose, the use of the -pdfdvi and -pdfps  options  (and  the
1374       corresponding  setting  of the $pdf_mode variable) does not count as an
1375       explicit request for the .dvi and .ps files; they are  merely  regarded
1376       as  a  request for making a .pdf file together with an initial proposal
1377       for the processing route to make it.
1378
1379       Note that when accommodating a change in output  file  type,  there  is
1380       involved a substantial change in the network of rules that latexmk uses
1381       in its actions.  The second condition applied to accommodate  a  change
1382       is to avoid situations where the change in the rule network is too rad‐
1383       ical to be readily handled automatically.
1384
1385
1386

CONFIGURATION/INITIALIZATION (RC) FILES

1388       In this section is explained which  configuration  files  are  read  by
1389       latexmk.  Subsequent  sections  "How to Set Variables in Initialization
1390       Files", "Format of  Command  Specifications",  "List  of  Configuration
1391       Variables  Usable  in Initialization Files", "Custom Dependencies", and
1392       "Advanced Configuration" give details on what  can  be  configured  and
1393       how.
1394
1395       Latexmk can be customized using initialization files, which are read at
1396       startup in the following order:
1397
1398       1) The system RC file, if it exists.
1399          On a UNIX system, latexmk searches for following places for its sys‐
1400       tem RC file, in the following order, and reads the first it finds:
1401          "/opt/local/share/latexmk/LatexMk",
1402          "/usr/local/share/latexmk/LatexMk",
1403          "/usr/local/lib/latexmk/LatexMk".
1404          On a Fedora system, it only looks for "/etc/latexmk.conf".
1405          On a MS-Windows system it looks for "C:\latexmk\LatexMk".
1406          On  a cygwin system (i.e., a MS-Windows system in which Perl is that
1407       of cygwin), latexmk reads the first it finds of
1408          "/cygdrive/c/latexmk/LatexMk",
1409          "/opt/local/share/latexmk/LatexMk",
1410          "/usr/local/share/latexmk/LatexMk",
1411          "/usr/local/lib/latexmk/LatexMk".
1412
1413       In addition, it then tries the same set of locations, but with the file
1414       name replaced "LatexMk" replaced by "latexmkrc".
1415
1416       If  the  environment variable LATEXMKRCSYS is set, its value is used as
1417       the name of the system RC file, instead of any of the above.
1418
1419       2) The user's RC file, if it exists.  This can be in one of two places.
1420       The  traditional one is ".latexmkrc" in the user's home directory.  The
1421       other possibility is "latexmk/latexmkrc" in the user's  XDG  configura‐
1422       tion  home  directory.  The actual file read is the first of "$XDG_CON‐
1423       FIG_HOME/latexmk/latexmkrc" or "$HOME/.latexmkrc" which  exists.   (See
1424       https://specifications.freedesktop.org/basedir-spec/basedir-spec-lat
1425       est.html for details on the XDG Base Directory Specification.)
1426
1427       Here $HOME is the  user's  home  directory.   [Latexmk  determines  the
1428       user's  home  directory as follows:  It is the value of the environment
1429       variable HOME, if this variable exists, which normally is the  case  on
1430       UNIX-like  systems  (including Linux and OS-X).  Otherwise the environ‐
1431       ment variable USERPROFILE is used, if it exists, which normally is  the
1432       case on MS-Windows systems. Otherwise a blank string is used instead of
1433       $HOME, in which case latexmk does not look for an RC file in it.]
1434
1435       $XDG_CONFIG_HOME is the value  of  the  environment  variable  XDG_CON‐
1436       FIG_HOME  if  it  exists.  If this environment variable does not exist,
1437       but $HOME is non-blank, then $XDG_CONFIG_HOME is  set  to  the  default
1438       value  of  $HOME/.config.   Otherwise  $XDG_CONFIG_HOME  is  blank, and
1439       latexmk does not look for an RC file under it.
1440
1441
1442       3) The RC file in the current working  directory.   This  file  can  be
1443       named  either "latexmkrc" or ".latexmkrc", and the first of these to be
1444       found is used, if any.
1445
1446       4) Any RC file(s) specified on the command line with the -r option.
1447
1448       Each RC file is a sequence of Perl commands.  Naturally, a user can use
1449       this  in  creative  ways.   But  for  most  purposes, one simply uses a
1450       sequence of assignment statements that override some  of  the  built-in
1451       settings  of  Latexmk.   Straightforward  cases  can be handled without
1452       knowledge of the Perl language by using the examples in  this  document
1453       as templates.  Comment lines are introduced by the "#" character.
1454
1455       Note  that  command  line options are obeyed in the order in which they
1456       are written; thus any RC file specified on the command line with the -r
1457       option  can  override  previous options but can be itself overridden by
1458       later options on the command line.  There is also the -e option,  which
1459       allows initialization code to be specified in latexmk's command line.
1460
1461         For  possible  examples  of code for in an RC file, see the directory
1462       example_rcfiles in the distribution of latexmk  (e.g.,  at  http://mir
1463       ror.ctan.org/support/latexmk/example_rcfiles).
1464
1465

HOW TO SET VARIABLES IN INITIALIZATION FILES

1467       The  important  variables  that  can be configured are described in the
1468       section "List  of  configuration  variables  usable  in  initialization
1469       files".   (See  the  earlier section "Configuration/Initialization (rc)
1470       Files" for the files where the configurations are  done.)   Syntax  for
1471       setting these variables is of the following forms:
1472
1473                           $bibtex = 'bibtex %O %B';
1474
1475       for the setting of a string variable,
1476
1477                           $preview_mode = 1;
1478
1479       for the setting of a numeric variable, and
1480
1481                           @default_files = ('paper', 'paper1');
1482
1483       for  the  setting  of an array of strings.  It is possible to append an
1484       item to an array variable as follows:
1485
1486                           push @default_files, 'paper2';
1487
1488       Note that simple "scalar" variables have names  that  begin  with  a  $
1489       character and array variables have names that begin with a @ character.
1490       Each statement ends with a semicolon.
1491
1492       Strings should be enclosed in single quotes.   (You  could  use  double
1493       quotes,  as  in many programming languages.  But then the Perl program‐
1494       ming language brings into play some  special  rules  for  interpolating
1495       variables  into  strings.  People not fluent in Perl will want to avoid
1496       these complications.)
1497
1498       You can do much more complicated things, but for this you will need  to
1499       consult a manual for the Perl programming language.
1500
1501
1502
1503

FORMAT OF COMMAND SPECIFICATIONS

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

LIST OF CONFIGURATION VARIABLES USABLE IN INITIALIZATION FILES

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

CUSTOM DEPENDENCIES

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

ADVANCED CONFIGURATION: Some extra resources and advanced tricks

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

SEE ALSO

3787       latex(1), bibtex(1), lualatex(1), pdflatex(1), xelatex(1).
3788

BUGS

3790       Sometimes a viewer (gv) tries to read an updated .ps or .pdf file after
3791       its creation is started but before the file is complete.  Work  around:
3792       manually refresh (or reopen) display.  Or use one of the other preview‐
3793       ers and update methods.
3794
3795       (The following isn't really a bug, but concerns  features  of  preview‐
3796       ers.)   Preview  continuous mode only works perfectly with certain pre‐
3797       viewers: Xdvi on UNIX/Linux works for  dvi  files.   Gv  on  UNIX/Linux
3798       works  for  both  postscript  and pdf.  Ghostview on UNIX/Linux needs a
3799       manual update (reopen); it views postscript and pdf.  Gsview under  MS-
3800       Windows  works  for both postscript and pdf, but only reads the updated
3801       file when its screen is refreshed.   Acroread  under  UNIX/Linux  views
3802       pdf,  but  the  file needs to be closed and reopened to view an updated
3803       version.  Under MS-Windows, acroread locks its input file  and  so  the
3804       pdf  file  cannot  be updated.  (Remedy: configure latexmk to use suma‐
3805       trapdf instead.)
3806

THANKS TO

3808       Authors of previous versions.  Many  users  with  their  feedback,  and
3809       especially  David  Coppit  (username david at node coppit.org) who made
3810       many useful suggestions that contributed  to  version  3,  and  Herbert
3811       Schulz.   (Please  note  that  the  e-mail addresses are not written in
3812       their standard form to avoid being harvested too easily.)
3813

AUTHOR

3815       Current version, by John  Collins  (username  jcc8  at  node  psu.edu).
3816       (Version 4.69a).
3817
3818       Released      version      can      be      obtained     from     CTAN:
3819       <http://www.ctan.org/pkg/latexmk/>,  and  from  the  author's   website
3820       <http://www.personal.psu.edu/jcc8/latexmk/>.
3821       Modifications and enhancements by Evan McLean (Version 2.0)
3822       Original script called "go" by David J. Musliner (RCS Version 3.2)
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833
3834
3835                                 17 April 2020                      LATEXMK(1)
Impressum