-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlatexmk.1
4772 lines (3977 loc) · 203 KB
/
latexmk.1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.TH LATEXMK 1 "11 December 2024" ""
.SH NAME
latexmk \- generate LaTeX document
.SH SYNOPSIS
.B latexmk [options] [file ...]
.SH DESCRIPTION
.I Latexmk
completely automates the process of compiling a LaTeX document.
Essentially, it is like a specialized relative of the general
\fImake\fR utility, but one which determines dependencies
automatically and has some other very useful features. In its basic
mode of operation \fIlatexmk\fR is given the name of the primary
source file for a document, and it issues the appropriate sequence of
commands to generate a .dvi, .ps, .pdf and/or hardcopy version of the
document.
.PP
By default \fIlatexmk\fR will run the commands necessary to generate
a .dvi file, which copies the behavior of earlier versions when only
\fIlatex\fR was available.
.PP
\fILatexmk\fR can also be set to run continuously with a suitable
previewer. In that case the \fIlatex\fR program (or one of its
relatives), etc, are rerun whenever
one of the source files is modified, and the previewer automatically
updates the on-screen view of the compiled document.
.PP
\fILatexmk\fR determines which are the source files by examining the
log file. (Optionally, it also examines the list of input and output
files generated by the \fB-recorder\fR option of modern versions of
\fIlatex\fR (and \fIpdflatex\fR, \fIxelatex\fR, \fIlualatex\fR).
See the documentation for the \fB-recorder\fR option of \fIlatexmk\fR
below.) When \fIlatexmk\fR is run, it examines properties of the
source files, and if any have been changed since the last document
generation, \fIlatexmk\fR will run the various LaTeX processing
programs as necessary. In particular, it will repeat the run of
\fIlatex\fR (or a related program)) often enough to resolve all cross
references; depending on the macro packages used. With some macro
packages and document classes, four, or even more, runs may be
needed. If necessary, \fIlatexmk\fR will also run \fIbibtex\fR,
\fIbiber\fR, and/or \fImakeindex\fR. In addition, \fIlatexmk\fR can
be configured to generate other necessary files. For example, from an
updated figure file it can automatically generate a file in
encapsulated postscript or another suitable format for reading by
LaTeX.
.PP
\fILatexmk\fR has two different previewing options. With the simple
\fB-pv\fR option, a dvi, postscript or pdf previewer is automatically
run after generating the dvi, postscript or pdf version of the
document. The type of file to view is selected according to
configuration settings and command line options.
.PP
The second previewing option is the powerful \fB-pvc\fR option
(mnemonic: "preview continuously"). In this case, \fIlatexmk\fR runs
continuously, regularly monitoring all the source files to see if any
have changed. Every time a change is detected, \fIlatexmk\fR runs all
the programs necessary to generate a new version of the document. A
good previewer will then automatically update its
display. Thus the user can simply edit a file and, when the changes
are written to disk, \fIlatexmk\fR completely automates the cycle of
updating the .dvi (and/or the .ps and .pdf) file, and refreshing
the previewer's display. It's not quite WYSIWYG, but usefully close.
.PP
For other previewers, the user may have to manually make the previewer
update its display, which can be (e.g., with some versions of \fIxdvi\fR and
\fIgsview\fR) as simple as forcing a redraw of its display.
.PP
\fILatexmk\fR has the ability to print a banner in gray diagonally
across each page when making the postscript file. It can also, if
needed, call an external program to do other postprocessing on
generated dvi and postscript files. (See the options \fB-dF\fR and
\fB-pF\fR, and the documentation for the \fI$dvi_filter\fR and
\fI$ps_filter\fR configuration variables.) These capabilities are
leftover from older versions of \fIlatexmk\fR, but \fBare currently
non-functional\fR.
More flexibility can
be obtained in current versions, since the command strings for running
\fI*latex\fR can now be configured to run multiple
commands.
This also extends the possibility of postprocessing generated files.
.PP
\fILatexmk\fR is highly configurable, both from the command line and
in configuration files, so that it can accommodate a wide variety of
user needs and system configurations. Default values are set
according to the operating system, so \fIlatexmk\fR often works
without special configuration on MS-Windows, cygwin, Linux, OS-X, and
other UNIX systems. See the section "Configuration/Initialization
(rc) Files", and then the later sections "How to Set Variables in
Initialization Files", "Format of Command Specifications", "List of
Configuration Variables Usable in Initialization Files", "Custom
Dependencies", and "Advanced Configuration"
.PP
A very annoying complication handled very reliably by \fIlatexmk\fR,
is that LaTeX is a multiple pass system. On each run, LaTeX reads in
information generated on a previous run, for things like cross
referencing and indexing. In the simplest cases, a second run of
LaTeX suffices, and often the log file contains a message about the
need for another pass. However, there is a wide variety of add-on
macro packages to LaTeX, with a variety of behaviors. The result is
to break simple-minded determinations of how many runs are needed and
of which programs. \fILatexmk\fR has a highly
general and efficient solution to these issues. The solution involves
retaining between runs information on the source files, and a symptom
is that \fIlatexmk\fR generates an extra file (with extension
\fI.fdb_latexmk\fR, by default) that contains the source file
information.
.SH LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE
In general the command line to invoke \fIlatexmk\fR has the form
latexmk [options] [file]
All options can be introduced by single or double "-" characters,
e.g., "latexmk -help" or "latexmk --help".
\fBNote 1\fR: In the documentation, '\fI*latex\fR' means any of the
supported engines, i.e., currently \fIlatex\fR, \fIlualatex\fR,
\fIpdflatex\fR, \fIxelatex\fR. Mention of a specific one of these normally
refers that specific engines. Earlier versions of this documentation
weren't so consistent. Which of these is used to compile a document,
depends on the configuration and the command line arguments.
\fBNote 2\fR: \fBIn addition to the options in the list below,
\fIlatexmk\fR recognizes almost all the options recognized by the
\fI*latex\fR programs in their
current TeXLive and MiKTeX implementations. Some of the options for
these programs trigger special action or behavior by
\fIlatexmk\fR, in which case they have specific explanations in this
document; in this case they may or may not be passed to *latex as well.
Run \fIlatexmk\fR with the \fB-showextraoptions\fR to get a
list of the options that \fIlatexmk\fR accepts and that are simply
passed through to \fI*latex\fR. See also the
explanation of the \fB-showextraoptions\fR option for more
information.
\fBDefinitions of options and arguments\fR
.TP
.B file
One or more files can be specified. If no files are specified,
\fIlatexmk\fR will, by default, run on all files in the current working directory
with a ".tex" extension. This behavior can be changed: see the
description concerning the \fI@default_files\fR variable in the
section "List of configuration variables usable in initialization
files".
If a file is specified without an extension, then the ".tex" extension
is automatically added, just as LaTeX does. Thus, if you specify:
latexmk foo
then \fIlatexmk\fR will operate on the file "foo.tex".
There are certain restrictions on what characters can be in a
filename; certain characters are either prohibited or problematic for
the \fIlatex\fR etc programs. These characters are: "$", "%", "\\",
"~", the double quote character, and the control characters null, tab,
form feed, carriage return, line feed, and delete. In addition "&" is
prohibited when it is the first character of a filename.
\fILatexmk\fR gives a fatal error when it detects any of the above
characters in the TeX filename(s) specified on the command line.
\fIHowever\fR before testing for illegal characters, \fIlatexmk\fR
removes matching pairs of double quotes from a filename. This matches
the behavior of \fIlatex\fR etc, and deals with problems that occasionally
result from filenames that have been incorrectly quoted on the command
line. \fIIn addition\fR, under Microsoft Windows, the forward slash
character "\\" is a directory separator, so \fIlatexmk\fR replaces it
by a forward slash "/", which is also a legal directory separator in
Windows, and is accepted by \fIlatex\fR etc.
.TP
.B -auxdir=FOO \fRor\fB -aux-directory=FOO
Sets the directory for auxiliary output files of *latex (.aux, .log etc).
These are all the generated files, with the exception of final output files
(.dvi, .ps, .pdf, .synctex.gz, .synctex). See the
\fB-outdir\fR/\fB-output-directory\fR option for directories for the main
output files, and the \fB-out2dir\fR option for the final output files.
If the directory specified for the \fB-aux\fR/\fB-aux-directory\fR option
is blank, then the default is used, which is to be the same as the output
directory.
If you also use the \fB-cd\fR option, and the specified auxiliary output
directory is a relative path, then the path is interpreted relative to
the document directory.
See the section AUXILIARY AND OUTPUT DIRECTORIES for more details.
.TP
.B -bibtex
When the source file uses bbl files for bibliography, run bibtex or
biber as needed to regenerate the bbl files.
This property can also be configured by setting the \fI$bibtex_use\fR
variable to 2 in a configuration file.
.TP
.B -bibtex-
Never run bibtex or biber. Also, always treat .bbl files as precious,
i.e., do not delete them in a cleanup operation.
A common use for this option is when a document comes from an external
source, complete with its bbl file(s), and the user does not have the
corresponding bib files available. In this situation use of the
\fB-bibtex-\fR option will prevent \fIlatexmk\fR from trying to run
\fIbibtex\fR or \fIbiber\fR, which would result in overwriting of the
bbl files.
This property can also be configured by setting the \fI$bibtex_use\fR
variable to 0 in a configuration file.
.TP
.B -bibtex-cond
When the source file uses a bbl file for the bibliography and \fIbibtex\fR
is used to generate the bibliography, run \fIbibtex\fR as needed to
regenerate the bbl files only if the relevant bib file(s) exist. Thus when
the bib file(s) are not available, \fIbibtex\fR is not run, thereby avoiding
overwriting of the bbl file. Also, always treat .bbl files as precious,
i.e., do not delete them in a cleanup operation.
This is the default setting. It can also be configured by setting the
\fI$bibtex_use\fR variable to 1 in a configuration file.
The reason for using this setting is first to allow automatic switching
between the use and non-use of \fIbibtex\fR depending on the existence or
not of a bib file. In addition, when submitting articles to a scientific
journal, it is common to submit only .tex and .bbl files (plus graphics
files), but not a .bib file. Hence it is often useful to treat .bbl files
as true source files, that should be preserved under a clean up operation.
This property can also be configured by setting the \fI$bibtex_use\fR
variable to 1 in a configuration file.
\fBNote\fR that when \fBbiber\fR is used, and a bib file doesn't exist, this
option does not prevent \fIbiber\fR from being run, with the bbl file then
being incorrect.
See the
documentation on \fI$bibtex_use\fR for more details. However, a bbl file
is treated as precious in a clean up operation.
.TP
.B -bibtex-cond1
The same as \fB-bibtex-cond\fR except that .bbl files are only
treated as precious if one or more bibfiles fails to exist.
Thus if all the bib files exist, \fIbibtex\fR is run to generate .bbl files
as needed, and then it is appropriate to delete the bbl files in a cleanup
operation since they can be re-generated.
This property can also be configured by setting the \fI$bibtex_use\fR
variable to 1.5 in a configuration file.
\fBNote\fR that when \fBbiber\fR is used, and a bib file doesn't exist, this
option does not prevent \fIbiber\fR from being run, with the bbl file then
being incorrect.
See the
documentation on \fI$bibtex_use\fR for more details. However, a bbl file
is treated as precious in a clean up operation.
.TP
.B -bibtexfudge\fR or\fB -bibfudge
Turn on the change-directory fudge for bibtex. See documentation of
\fI$bibtex_fudge\fR for details.
.TP
.B -bibtexfudge-\fR or\fB -bibfudge-
Turn off the change-directory fudge for
bibtex. See documentation of \fI$bibtex_fudge\fR for details.
.TP
.B -bm <message>
A banner message to print diagonally across each page when converting
the dvi file to postscript. The message must be a single argument on
the command line so be careful with quoting spaces and such.
Note that if the \fB-bm\fR option is specified, the \fB-ps\fR option is
assumed.
.TP
.B -bi <intensity>
How dark to print the banner message. A decimal number between 0 and 1.
0 is black and 1 is white. The default is 0.95, which is OK unless your
toner cartridge is getting low.
.TP
.B -bs <scale>
A decimal number that specifies how large the banner message will be
printed. Experimentation is necessary to get the right scale for your
message, as a rule of thumb the scale should be about equal to 1100
divided by the number of characters in the message. The default is 220.0
which is just right for 5 character messages.
.TP
.B -commands
List the commands used by \fIlatexmk\fR for processing files, and then
exit.
.TP
.B -c
Clean up (remove) all regeneratable files generated by \fIlatex\fR and
\fIbibtex\fR or \fIbiber\fR except dvi, postscript and pdf. These files are a
combination of log files, aux files, \fIlatexmk\fR's database file of
source file information,
and those with extensions
specified in the \fI@generated_exts\fR configuration variable. In addition,
files specified by the \fI$clean_ext\fR and \fI@generated_exts\fR
configuration variables are removed.
This cleanup is instead of a regular make. See the \fB-gg\fR option
if you want to do a cleanup followed by a make.
\fITreatment of .bbl files: \fR If \fI$bibtex_use\fR is set to 0 or 1,
bbl files are always treated as non-regeneratable. If
\fI$bibtex_use\fR is set to 1.5, bbl files are counted as
non-regeneratable conditionally: If the bib file exists, then bbl
files are regeneratable, and are deleted in a clean up. But if
\fI$bibtex_use\fR is 1.5 and a bib file doesn't exist, then the bbl
files are treated as non-regeneratable and hence are not deleted.
In contrast, if \fI$bibtex_use\fR is set to 2, bbl files are always
treated as regeneratable, and are deleted in a cleanup.
\fITreatment of files generated by custom dependencies:\fR If
\fI$cleanup_includes_cusdep_generated\fR is nonzero, regeneratable
files are considered as including those generated by custom
dependencies and are also deleted. Otherwise these files are not
deleted.
.TP
.B -C
Clean up (remove) all regeneratable files generated by \fIlatex\fR and
\fIbibtex\fR or \fIbiber\fR. This is the same as the \fB-c\fR option with the
addition of dvi, postscript and pdf files, and those specified
in the \fI$clean_full_ext\fR configuration variable.
This cleanup is instead of a regular make. See the \fB-gg\fR option
if you want to do a cleanup followed by a make.
See the \fB-c\fR option for the specification of whether or not .bbl
files are treated as non-regeneratable or regeneratable.
If \fI$cleanup_includes_cusdep_generated\fR is nonzero, regeneratable
files are considered as including those generated by custom
dependencies and are also deleted. Otherwise these files are not deleted.
.TP
.B -CA
(Obsolete). Now equivalent to the \fB-C\fR option. See that option
for details.
.TP
.B -cd
Change to the directory containing the main source file before processing
it. Then all the generated files (.aux, .log, .dvi, .pdf, etc) will be
relative to the source file.
This option is particularly useful when \fIlatexmk\fR is invoked from
a GUI configured to invoke \fIlatexmk\fR with a full pathname for the
source file.
This option works by setting the \fB$do_cd\fR configuration variable
to one; you can set that variable if you want to configure
\fIlatexmk\fR to have the effect of the \fB-cd\fR option without
specifying it on the command line. See the documentation for that
variable.
.TP
.B -cd-
Do NOT change to the directory containing the main source file before processing
it. Then all the generated files (.aux, .log, .dvi, .pdf, etc) will be
relative to the current directory rather than the source file.
This is the default behavior and corresponds to the behavior of the
\fI*latex\fR programs. However, it is not desirable
behavior when \fIlatexmk\fR is invoked by a GUI configured to invoke
\fIlatexmk\fR with a full pathname for the source file. See the
\fB-cd\fR option.
This option works by setting the \fB$do_cd\fR configuration variable
to zero. See the documentation for that variable for more
information.
.TP
.B -CF
Remove the file containing the database of source file information,
before doing the other actions requested.
.TP
.B -d
Set draft mode. This prints the banner message "DRAFT" across your
page when converting the dvi file to postscript. Size and intensity
can be modified with the \fB-bs\fR and \fB-bi\fR options. The \fB-bm\fR
option will override this option as this is really just a short way of
specifying:
latexmk -bm DRAFT
Note that if the \fB-d\fR option is specified, the \fB-ps\fR option is
assumed.
.TP
.B -deps
Show a list of dependent files after processing. This is in the form
of a dependency list of the form used by the \fImake\fR program, and
it is therefore suitable for use in a Makefile. It gives an overall
view of the files without listing intermediate files, as well as
\fIlatexmk\fR can determine them.
By default the list of dependent files is sent to stdout (i.e.,
normally to the screen unless you've redirected \fIlatexmk\fR's
output). But you can set the filename where the list is sent by the
\fB-deps-out=\fR option.
See the section "USING \fIlatexmk\fR WITH \fImake\fR" for
an example of how to use a dependency list with \fImake\fR.
Users familiar with GNU \fIautomake\fR and \fIgcc\fR will find that
the \fB-deps\fR option is very similar in its purpose and results to
the \fB-M\fR option to \fIgcc\fR. (In fact, \fIlatexmk\fR also has
options \fB-M\fR, \fB-MF\fR, and \fB-MP\fR options that behave like
those of \fIgcc\fR.)
.TP
.B -dependents
Equivalent to \fB-deps\fR.
.TP
.B -deps-
Do not show a list of dependent files after processing. (This is the
default.)
.TP
.B -dependents-
Equivalent to \fB-deps-\fR.
.TP
.B -deps-escape=<string>
Set the kind of escaping used for spaces in the dependency list. The
possible values are "none", "unix", "nmake", corresponding respectively to
no escaping, escaping with a "\\" suitable for standard Unix make, and
escaping with "^", suitable for Microsoft's nmake.
.TP
.B -deps-out=FILENAME
Set the filename to which the list of dependent files is written. If
the FILENAME argument is omitted or set to "-", then the output is
sent to stdout.
Use of this option also turns on the output of the list of dependent
files after processing.
.TP
.B -dF
Dvi file filtering. The argument to this option is a filter which will
generate a filtered dvi file with the extension ".dviF". All extra
processing (e.g. conversion to postscript, preview, printing) will then
be performed on this filtered dvi file.
Example usage: To use dviselect to select only the even pages of the dvi file:
latexmk -dF "dviselect even" foo.tex
.TP
.B -diagnostics
Print detailed diagnostics during a run. This may help for debugging
problems or to understand \fIlatexmk\fR's behavior in difficult
situations.
.TP
.B -dir-report
For each .tex file processed, list the settings for aux and out
directories, after they have been normalized from the settings specified
during initialization. See the description of the variable
\fB$aux_out_dir_report\fR for more details.
.TP
.B -dir-report-
Do not report the settings for aux and out directories. (Default)
.TP
.B -dir-report-only
After all initialization is complete, give the settings for the aux and out
directories, and then halt. This option is primarily used for debugging
configuration issues.
.TP
.B -dvi
Generate dvi version of document using latex.
(And turn off any incompatible requests.)
.TP
.B -dvilua
Generate dvi version of document using lualatex instead of latex.
(And turn off any incompatible requests.)
.TP
.B -dvi-
Turn off generation of dvi version of document. (This may get
overridden, if some other file is made (e.g., a .ps file) that is
generated from the dvi file, or if no generated file at all is
requested.)
.TP
.B -dvilualatex="COMMAND"
This sets the string specifying the command to run \fIdvi lualatex\fR. It
behaves like the \fB-pdflatex\fR option, but sets the variable
\fI$dvilualatex\fR.
\fINote: This option when provided with the COMMAND argument only sets the
command for invoking dvilualatex; it does not turn on the use of
dvilualatex. That is done by other options or in an initialization file.\fR
.TP
.B -e <code>
Execute the specified initialization code before processing. The code
is \fIPerl\fR code of the same form as is used in \fIlatexmk\fR's
initialization files. For more details,
see the information on the
\fB-r\fR option, and the section about "Configuration/initialization
(RC) files". The code is typically a sequence of assignment
statements separated by semicolons.
The code is executed when the \fB-e\fR option is encountered during
\fIlatexmk\fR's parsing of its command line. See the \fB-r\fR option
for a way of executing initialization code from a file. An error
results in \fIlatexmk\fR stopping. Multiple instances of the \fB-r\fR
and \fB-e\fR options can be used, and they are executed in the order
they appear on the command line.
Some care is needed to deal with proper quoting of special characters
in the code on the command line. For example, suppose you want
to set the latex command to use its -shell-escape option, then under
UNIX/Linux you could use the line
latexmk -e '$latex=q/latex %O -shell-escape %S/' file.tex
Note that the single quotes block normal UNIX/Linux command shells
from treating the characters inside the quotes as special.
(In this example, the q/.../ construct is a
\fIPerl\fR idiom equivalent to using
single quotes. This avoids the complications of getting a quote
character inside an already quoted string in a way that is independent
of both the shell and the operating-system.)
The above command line will NOT work under MS-Windows with cmd.exe or
command.com or 4nt.exe. For MS-Windows with these command shells you
could use
latexmk -e "$latex=q/latex %O -shell-escape %S/" file.tex
or
latexmk -e "$latex='latex %O -shell-escape %S'" file.tex
The last two examples will NOT work with UNIX/Linux command shells.
(\fINote\fR: the above examples show are to show how to use the
\fB-e\fR to specify initialization code to be executed. But the
particular effect can be achieved also by the use of the \fB-latex\fR
option with less problems in dealing with quoting.)
.TP
.B -emulate-aux-dir
Emulate the use of an aux directory instead of leaving it to the *latex
programs to do it. (MiKTeX supports -aux-directory, but TeXLive doesn't.)
See the section AUXILIARY AND OUTPUT DIRECTORIES for more details.
.TP
.B -emulate-aux-dir-
Turn off emulation to implement an aux directory and leave it to the *latex
program to handle the case that the aux directory is different from the
output directory. Note that if you use TeXLive, which doesn't support
-aux-directory, latexmk will automatically switch aux_dir emulation on
after the first run of *latex, because it will find the .log file in the
wrong place.
.TP
.B -f
Force \fIlatexmk\fR to continue document processing despite errors.
Normally, when \fIlatexmk\fR detects that LaTeX or another program has
found an error which will not be resolved by further processing, no
further processing is carried out.
Note: "Further processing" means the running of other programs or the
rerunning of \fIlatex\fR (etc) that would be done if no errors had
occurred. If instead, or additionally, you want the \fIlatex\fR (etc)
program not to pause for user input after an error, you should arrange
this by an option that is passed to the program, e.g., by
\fIlatexmk\fR's option \fB-interaction=nonstopmode\fR (which \fIlatexmk\fR
passes to \fI*latex\fR).
.TP
.B -f-
Turn off the forced processing-past-errors such as is set by the
\fB-f\fR option. This could be used to override a setting in a
configuration file.
.TP
.B -g
Force \fIlatexmk\fR to process document fully, even under situations
where \fIlatexmk\fR would normally decide that no changes in the
source files have occurred since the previous run.
This option is useful, for example, if you change some options and
wish to reprocess the files.
.TP
.B -g-
Turn off \fB-g\fR.
.TP
.B -gg
"Super go mode" or "clean make": clean out generated files as if
\fB-C\fR had been given, and then do a regular make.
.TP
.B -h \fRor\fB-non-help
Print help information.
.TP
.B -hnt
Generate hnt (HINT) version of document using hilatex.
(And turn off any incompatible requests.)
.TP
.B -jobname=STRING
Set the basename of output files(s) to STRING, instead of the default,
which is the basename of the specified TeX file. (At present, STRING
should not contain spaces.)
This is like the same option for current implementations of the
\fI*latex\fR, and the passing of this option to
these programs is part of \fIlatexmk\fR's implementation of
\fB-jobname\fR.
There is one enhancement, that the STRING may contain the
placeholder '%A'. This will be substituted by the basename of the TeX
file. The primary purpose is when multiple files are specified on the
command line to \fIlatexmk\fR, and you wish to use a jobname with a
different file-dependent value for each file. For example, suppose
you had .tex files test1.tex and test2.tex, and you wished to compare
the results of compilation by \fI*latex\fR and those with
\fIxelatex\fR. Then under a unix-type operating system you could use
the command line
latexmk -pdf -jobname=%A-pdflatex *.tex
latexmk -pdfxe -jobname=%A-xelatex *.tex
Then the .aux, .log, and .pdf files from the use of \fIpdflatex\fR
would have basenames test1-pdflatex and test2-pdflatex, while from
\fIxelatex\fR, the basenames would be test1-xelatex and test2-xelatex.
Under MS-Windows with cmd.exe, you would need to double the percent
sign, so that the percent character is passed to latexmk rather than
being used to substitute an environment variable:
latexmk -pdf -jobname=%%A-pdflatex *.tex
latexmk -pdfxe -jobname=%%A-xelatex *.tex
.TP
.B -l
Run in landscape mode, using the landscape mode for the previewers and
the dvi to postscript converters. This option is not normally needed
nowadays, since current previewers normally determine this information
automatically.
.TP
.B -l-
Turn off \fB-l\fR.
.TP
.B -latex
This sets the generation of dvi files by \fIlatex\fR, and turns off the
generation of pdf and ps files.
\fINote: to set the \fRcommand\fI used when latex is specified, see the
\fB-latex="COMMAND"\fI option.\fR
.TP
.B -latex="COMMAND"
This sets the string specifying the command to run latex, and is
typically used to add desired options. Since the string normally
contains spaces, it should be quoted, e.g.,
latexmk -latex="latex --shell-escape %O %S" foo.tex
The specification of the contents of the string are the same as for
the \fI$latex\fR configuration variable. Depending on your
operating system and the command-line shell you are using, you may
need to change the single quotes to double quotes (or something
else).
\fINote: This option when provided with the COMMAND argument only sets the
command for invoking latex; it does not turn on the use of
latex. That is done by other options or in an initialization file.\fR
To set the command for running \fIpdflatex\fR (rather than the command for
\fIlatex\fR) see the \fB-pdflatex\fR option.
.TP
.B -logfilewarninglist
.B -logfilewarnings
After a run of \fI*latex\fR, give a list of warnings about
undefined citations and references (unless silent mode is on).
See also the \fI$silence_logfile_warnings\fR configuration variable.
.TP
.B -logfilewarninglist-
.B -logfilewarnings-
After a run of \fI*latex\fR, do not give a list of warnings about
undefined citations and references. (Default)
See also the \fI$silence_logfile_warnings\fR configuration variable.
.TP
.B -lualatex
Use \fIlualatex\fR. That is, use \fIlualatex\fR to process the source file(s) to
pdf. The generation of dvi, hnt, postscript and xdv files is turned off.
This option is equivalent to using the following set of options
-pdflua -dvi- -ps-
(\fINote\fR: Note that the method of implementation of this option,
but not its intended effect, differ from some earlier versions of
\fIlatexmk\fR.)
.TP
.B -lualatex="COMMAND"
This sets the string specifying the command to run \fIlualatex\fR. It
behaves like the \fB-pdflatex\fR option, but sets the variable
\fI$lualatex\fR.
\fINote: This option when provided with the COMMAND argument only sets the
command for invoking lualatex; it does not turn on the use of
lualatex. That is done by other options or in an initialization file.\fR
.TP
.B -M
Show list of dependent files after processing. This is equivalent to
the \fB-deps\fR option.
.TP
.B -MF file
If a list of dependents is made, the \fB-MF\fR specifies the file to
write it to.
.TP
.B -MP
If a list of dependents is made, include a phony target for each source
file. If you use the dependents list in a Makefile, the dummy rules
work around errors the program \fImake\fR gives if you remove header
files without updating the Makefile to match.
.TP
.B -makeindexfudge
Turn on the change-directory fudge for makeindex. See documentation of
\fI$makeindex_fudge\fR for details.
.TP
.B -makeindexfudge-
Turn off the change-directory fudge for makeindex. See documentation of
\fI$makeindex_fudge\fR for details.
.TP
.B $min_sleep_time [0.01]
This is the minimum nonzero value allowed for \fI$sleep_time\fR.
.TP
.B -MSWinBackSlash
This option only has an effect when \fIlatexmk\fR is running under
MS-Windows. This is that when \fIlatexmk\fR runs a command under
MS-Windows, the Windows standard directory separator "\\" is used to
separate directory components in a file name. Internally, \fIlatexmk\fR
uses "/" for the directory separator character, which is the character used
by Unix-like systems.
This is the default behavior. However the default may have been overridden
by a configuration file (latexmkrc file) which sets
\fI$MSWin_back_slash=0\fR.
.TP
.B -MSWinBackSlash-
This option only has an effect when \fIlatexmk\fR is running under
MS-Windows. This is that when \fIlatexmk\fR runs a command under
MS-Windows, the substitution of "\\" for the separator character between
directory components of a file name is \fInot\fR done. Instead the forward
slash "/" is used, the same as on Unix-like systems. This is acceptable in
most situations under MS-Windows, provided that filenames are properly
quoted, as \fIlatexmk\fR does by default.
See the documentation for the configuration variable
\fI$MSWin_back_slash\fR for more details.
.TP
.B -new-viewer
When in continuous-preview mode, always start a new viewer to view the
generated file. By default, \fIlatexmk\fR will, in continuous-preview
mode, test for a previously running previewer for the same file and
not start a new one if a previous previewer is running. However, its
test sometimes fails (notably if there is an already-running previewer
that is viewing a file of the same name as the current file, but in a
different directory). This option turns off the default behavior.
.TP
.B -new-viewer-
The inverse of the \fB-new-viewer\fR option. It puts \fIlatexmk\fR
in its normal behavior that in preview-continuous mode it checks for
an already-running previewer.
.TP
.B -nobibtex
Never run bibtex or biber. Equivalent to the \fB-bibtex-\fR option.
.TP
.B -nobibtexfudge \fRor\fB -nobibfudge
Turn off the change-directory fudge for
bibtex. See documentation of \fI$bibtex_fudge\fR for details.
.TP
.B -noemulate-aux-dir
Turn aux_dir emulation off. Same as \fI-emulate-aux-dir-\fR.
.TP
.B -nomakeindexfudge
Turn off the change-directory fudge for makeindex. See documentation of
\fI$makeindex_fudge\fR for details.
.TP
.B -norc
Turn off the automatic reading of initialization (rc) files.
N.B. Normally the initialization files are read and obeyed, and then
command line options are obeyed in the order they are encountered.
But \fB-norc\fR is an exception to this rule: it is acted on first,
no matter where it occurs on the command line.
.TP
.B -outdir=FOO \fRor\fB -output-directory=FOO
Sets the directory for the output files of *latex.
If the aux directory is not set or is the same as the output directory,
then all output files of *latex are sent to the output directory.
If the aux directory is set, e.g., by the option \fB-auxdir\fR, and is not
equal to the output directory, then only the primary output files
(.dvi, .ps, .pdf, .synctex, .synctex.gz) are sent to the output
directory. Other generated files are sent to the aux directory.
See the section AUXILIARY AND OUTPUT DIRECTORIES for more details.
.TP
.B -out2dir=FOO
(\fIExperimental new feature.\fR)
Sets the directory for the final output files of a whole round of
compilations.
The use of this directory solves, among other things, the problem that when
multiple runs of *latex and other programs are needed, files like the main
pdf file from pdflatex, etc will be changed multiple times. A viewer like
SumatraPDF that reloads the file whenever it detects changes will show a
distracting sequence of intermediate states of the pdf file, rather than
just the final version after all the repeated runs of *latex etc have been
done. Instead, when a distinct final-output directory is set, by the
\fB-out2dir\fR option or the equivalent \fI$out2_dir\fR variable is set,
the viewer will only see a changed pdf (etc) file after full sequence of
repeated runs of *latex etc has finished.
By default the final output directory is the same as the output directory
(as specified by the \fB-outdir\fR option or the setting of the variable
\fI$out_dir\fR configuration variable).
.TP
.B -output-format=FORMAT
This option is one that is allowed for \fIlatex\fR, \fIlualatex\fR, and
\fIpdflatex\fR. But it is not passed to these programs. Instead
\fIlatexmk\fR emulates it in a way suitable for the context of
\fIlatexmk\fR and its workflows.
-If FORMAT is dvi, then dvi output is turned on, and postscript, pdf and xdv
output are turned off. This is equivalent to using the options \fB-dvi -ps-
-pdf- -xdv-\fR.
If FORMAT is pdf, then pdf output is turned on, and dvi, postscript and xdv
output are turned off. This is equivalent to using the options \fB-pdf -ps-
-dvi- -xdv-\fR.
If FORMAT is anything else, \fIlatexmk\fR gives an error.
.TP
.B -p
Print out the document. By default the file to be printed is
the first in the list postscript, pdf, dvi that is being made.
But you can use the
\fB-print=...\fR option to change the type of file to be printed, and you
can configure this in a start up file (by setting the
\fI$print_type\fR variable).
However, printing is enabled by default only under UNIX/Linux systems,
where the default is to use the lpr command and only on postscript
files. In general, the correct
behavior for printing very much depends on your system's software. In
particular, under MS-Windows you must have suitable program(s)
available, and you must have configured the print commands used by
\fIlatexmk\fR. This can be non-trivial. See the documentation on the
\fI$lpr\fR, \fI$lpr_dvi\fR, and \fI$lpr_pdf\fR configuration variables
to see how to set the commands for printing.
This option is incompatible with the \fB-pv\fR and \fB-pvc\fR options,
so it turns them off.
.TP
.B -pdf
Generate pdf version of document using \fIpdflatex\fR.
(And turn off any incompatible requests.)
(If you wish
to use \fIlualatex\fR or \fIxelatex\fR, you can use whichever of the
options \fB-pdflua\fR, \fB-pdfxe\fR, \fB-lualatex\fR or \fB-xelatex\fR
applies.) To configure
\fIlatexmk\fR to have such behavior by default, see the section on
"Configuration/initialization (rc) files".
.TP
.B -pdfdvi
Generate dvi file and then pdf version of document from the dvi file, by
default using dvipdf.
(And turn off any incompatible requests.)
The program used to compile the document to dvi is \fIlatex\fR by default,
but this can be changed to \fIdvilulatex\fR by the use of the \fB-dvilua\fR
option or by setting \fI$dvi_mode\fR to 2.
.TP
.B -pdflua
Generate pdf version of document using \fIlualatex\fR.
(And turn off any incompatible requests.)
.TP
.B -pdfps
Generate dvi file, ps file from the dvi file, and then pdf file from the
ps file.
(And turn off any incompatible requests.)
The program used to compile the document to dvi is \fIlatex\fR by default,
but this can be changed to \fIdvilulatex\fR by the use of the \fB-dvilua\fR
option or by setting \fI$dvi_mode\fR to 2.
.TP
.B -pdfxe
Generate pdf version of document using \fIxelatex\fR.
(And turn off any incompatible requests.)
Note that to
optimize processing time, \fIlatexmk\fR uses \fIxelatex\fR to generate
an .xdv file rather than a pdf file directly. Only after possibly
multiple runs to generate a fully up-to-date .xdv file does \fIlatexmk\fR
then call \fIxdvipdfmx\fR to generate the final .pdf file.
(\fINote:\fR The reason why \fIlatexmk\fR arranges for \fIxelatex\fR to
make an .xdv file instead of the \fIxelatex\fR's default of a .pdf file is
as follows: When the document includes large graphics files,
especially .png files, the production of a .pdf file can be quite time
consuming, even when the creation of the .xdv file by \fIxelatex\fR is
fast. So the use of the intermediate .xdv file can result in substantial
gains in procesing time, since the .pdf file is produced once rather than
on every run of \fIxelatex\fR.)
.TP
.B -pdf-
Turn off generation of pdf version of document.
(This can be used to override a setting in a configuration file.
It may get overridden if some other option requires the generation of
a pdf file.)
If after all options have been processed, pdf generation is still
turned off, then generation of a dvi file will be turned on, and then
the program used to compiled a document will be \fIlatex\fR (or, more
precisely, whatever program is configured to be used in the
\fI$latex\fR configuration variable).
.TP
.B -pdflatex
Set the generation of pdf files by \fIpdflatex\fR.
(And turn off any incompatible requests.)
\fINote: to set the \fRcommand\fI used when pdflatex is specified, see the
\fB-pdflatex="COMMAND"\fI option.\fR
.TP
.B -pdflatex="COMMAND"
This sets the string specifying the command to run \fIpdflatex\fR, and is
typically used to add desired options. Since the string normally