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

EXAMPLES

1245       % latexmk thesis    # run latex enough times to resolve
1246                           cross-references
1247
1248       % latexmk -pvc -ps thesis# run latex enough times to resolve
1249                           cross-references, make a postscript
1250                           file, start a previewer.  Then
1251                           watch for changes in the source
1252                           file thesis.tex and any files it
1253                           uses.  After any changes rerun latex
1254                           the appropriate number of times and
1255                           remake the postscript file.  If latex
1256                           encounters an error, latexmk will
1257                           keep running, watching for
1258                           source file changes.
1259
1260       % latexmk -c        # remove .aux, .log, .bbl, .blg, .dvi,
1261                           .pdf, .ps & .bbl files
1262
1263
1264

DEALING WITH ERRORS, PROBLEMS, ETC

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

ALLOWING FOR CHANGE OF OUTPUT FILE TYPE

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

CONFIGURATION/INITIALIZATION (RC) FILES

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

HOW TO SET VARIABLES IN INITIALIZATION FILES

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

FORMAT OF COMMAND SPECIFICATIONS

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

CUSTOM DEPENDENCIES

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

ADVANCED CONFIGURATION: Some extra resources and advanced tricks

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

SEE ALSO

3785       latex(1), bibtex(1), lualatex(1), pdflatex(1), xelatex(1).
3786

BUGS

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

THANKS TO

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

AUTHOR

3813       Current version, by John Collins (Version 4.70b).  Report bugs  etc  to
3814       his e-mail (jcc8 at psu.edu).
3815
3816       Released      version      can      be      obtained     from     CTAN:
3817       <http://www.ctan.org/pkg/latexmk/>,  and  from  the  author's   website
3818       <http://www.personal.psu.edu/jcc8/latexmk/>.
3819       Modifications and enhancements by Evan McLean (Version 2.0)
3820       Original script called "go" by David J. Musliner (RCS Version 3.2)
3821
3822
3823
3824
3825
3826
3827
3828
3829
3830
3831
3832
3833                               29 September 2020                    LATEXMK(1)
Impressum