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
|
.TH LATEXMK 1L "27 Jan 1995" ""
.SH NAME
latexmk \- generate LaTeX document
.SH SYNOPSIS
.B latexmk
[-bm message] [-bs scale] [-bi intensity] [-c] [-C] [-d] [-dF filter] [-f] [-F] [-g] [-h] [-i] [-I] [-l] [-p] [-ps] [-pF filter] [-pv] [-pvc] [-r rcfile] [-s] [file ...]
.SH DESCRIPTION
.I LatexMk
completely automates the process of generating a LaTeX document.
Essentially, it is a highly specialized relative of the general
\fImake\fR utility. Given the source files for a document,
\fIlatexmk\fR issues the appropriate sequence of commands to generate
a .dvi, .ps or hardcopy version of the document.
.PP
\fILatexmk\fR recognizes the commands that are unique to SliTeX
documents; slide mode is automatically turn on when it finds a
\\colorslides or \\blackandwhite include command.
.PP
\fILatexmk\fR will scan source files for all included files, placing
the resulting dependency information into a dependency file with the
same name as the root file with the extension \fB.dep\fR. This option
allows the user to essentially leave all the work to \fIlatexmk\fR.
The program will find all LaTeX \\include, \\input, \\psfig, \\epsfbox,
\\blackandwhite, and \\colorslides commands which input other source
files. When \fIlatexmk\fR is run, it will examine the timestamps on
those files and run the various LaTeX processing programs as necessary,
if any of the source files have been changed since the last document
generation. If the dependencies of the document are changed (e.g., by
adding or removing a \\include command), an additional pass of
\fIlatexmk -i\fR or \fIlatexmk -I\fR will update the dependency file.
.PP
By default, if no dependency exists, the source files are scanned and the
dependency file generated. If the dependency file exists, it is read
instead (even if the root file is newer than the dependency file (see
-\fBi\fR option))
.PP
\fILatexMk\fR has two different previewing options. In the simple
\fB-pv\fR option, a postscript or dvi previewer is automatically run
after generating the postscript or dvi version of the document. The
type of viewer is selected automatically depending on the \fB-ps\fR
option. When a document is reaching the final stages of editing, the
user frequently wants to make small changes to the source files and
examine the effects in a previewer; for this phase, \fIlatexmk\fR
provides the powerful \fB-pvc\fR option (mnemonic: "preview
continuously"). With this option, \fIlatexmk\fR forks a child process
to run an \fIxtex\fR (or other specified) previewer on the document,
and then \fIlatexmk\fR repeatedly monitors the source files of the
document to see if any changes have been made since the last .dvi file
was produced. When changes are detected, \fIlatexmk\fR runs the
appropriate LaTeX commands to regenerate the .dvi file, and then sends
a signal to \fIxtex\fR job, indicating that the previewer should 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 refreshing the previewer's display.
It's not quite WYSIWYG, but LaTeX has never been closer.
.PP
\fILatexMk\fR has the ability to print a banner in gray diagonally across
each page when making the postscript file.
.SH LATEXMK OPTIONS
.TP
.B file
One or more files can be specified. If no files are specified,
\fIlatexmk\fR will run on all files in the current working directory
with a ".tex" extention and any files that match any file masks
specified in the \fI$texfile_search\fR variable.
If a file specified does exist, and does not have an ".tex" extention, then
the ".tex" extention is automatically added. (e.g. If you specify:
latexmk foo
and the file "foo" does not exist, then \fIlatexmk\fR will try to operate
on the file "foo.tex".
.TP
.B -bm <message>
A banner message to print diagonally accross 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 and the postscript file is always generated, even if it is newer
than the dvi file.
.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, 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. Default is 220.0
which is just right for 5 character messages.
.TP
.B -c
Clean up (remove) all unnecessary files generated by \fIlatex\fR and
\fIbibtex\fR except dvi and postscript.
.TP
.B -C
Clean up (remove) all unnecessary files generated by \fIlatex\fR and
\fIbibtex\fR including dvi and postscript.
.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 \fI-bs\fR and \fI-bi\fR options. The \fI-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 and the postscript file is always generated, even if it is newer
than the dvi file.
.TP
.B -dF
Dvi file filtering. The argument to this option is a filter which will
generate a filtered dvi file with the extention ".dviF". All extra
processing (e.g. conversion to postscript, preview, printing) will then
be performed on this filtered dvi file.
Exampe usage: Use dviselect to select only the even pages of the dvi file:
latexmk -dF 'dviselect even' foo.tex
.TP
.B -f
Force \fIlatexmk\fR to continue document processing despite errors.
Normally, when \fIlatexmk\fR detects that \fIlatex\fR has found an error
which will not be resolved by further processing, the program terminates.
.TP
.B -F
Force \fIlatexmk\fR to include files that don't exist when generating
dependency files. A warning is produced instead of an error message and
the program terminating. If the file name is not an absolute path, it
is assumed to be relative to the current working directory.
.TP
.B -g
Force \fIlatexmk\fR to process document, disregarding the timestamps of the
source files.
This option is particularly useful when updating style files, which are not
included in the file dependency information.
.TP
.B -h
Print help information.
.TP
.B -i
Scan source files and generate new dependency file if root file is newer
than dependency file or dependency file does not exist.
.TP
.B -I
Always scan source files and generate new dependency file, even if newer
dependency file exists. This forces a scan.
.TP
.B -l
Run in landscape mode, using the landscape mode previewers and dvi to
postscript converters.
.TP
.B -p
Print out the file using lpr after generating the postscript version.
.TP
.B -ps
Generate postscript version of document.
.TP
.B -pF
Postscript file filtering. The argument to this option is a filter
which will generate a filtered postscript file with the extention
".psF". All extra processing (e.g. preview, printing) will then be
performed on this filtered postscript file.
Exampe usage: Use psnup to print two pages on the one page:
latexmk -ps -pF 'psnup -2' foo.tex
.TP
.B -pv
Run file previewer if \fB-ps\fR specified, will run postscript previewer,
otherwise runs dvi previewer.
.TP
.B -pvc
Run a dvi-previewer and continually update the .dvi file whenever changes
are made to source files (see the Description above).
Note that if \fIlatexmk\fR dies because it encounters an error,
the forked previewer will continue to run. Successive invocations with
the \fB-pvc\fR option will not fork new previewers, but will find
the existing previewer and send it the signals indicating the .dvi has
been updated.
.TP
.B -r <rcfile>
Read specified RC file before processing. The contents of the RC file my
override options specified before the \fB-r\fR option, therefore it is
a good idea have the habit of specifying the -r option first.
.TP
.B -s
Set slide mode.
.TP
.B -v
Print version number of \fILatexMk\fR.
.PP
If \fI-ps\fR or \fI-s\fR are specified when the dependency file is created
or updated, then these options are stored in the dependency file. This
means that these options will automatically be activated without having
to be explicitly specified on the command line in future runs. Of coarse,
if the dependency file is updated or deleted, these automatic settings will
be lost.
.PP
Options \fI-pv\fR and \fI-pvc\fR require one and only one filename specified
on the command line.
.PP
Options \fI-p\fR, \fI-pv\fR and \fI-pvc\fR are mutually exclusive.
.SH EXAMPLES
.nf
.ta 2i
% \fBlatexmk thesis\fR \fI# scan for includes, setup thesis.dep
if thesis.tex is does not exist\fR
% \fBlatexmk -i thesis\fR \fI# scan for includes, setup thesis.dep
if thesis.tex is newer\fR
% \fBlatexmk -I thesis\fR \fI# scan for includes, setup thesis.dep\fR
% \fBlatexmk -c\fR \fI# remove .aux, .log, .bbl, .blg, .dep,
.dvi, .ps & .bbe files\fR
.SH RC FILE
.PP
There are four RC files that latexmk can read at startup:
.PP
1) The system RC file "/usr/local/lib/latexmk/LatexMk".
.PP
2) The user's RC file in "$HOME/.latexmkrc".
.PP
3) The RC file in the current working directory called "latexmkrc".
.PP
4) The RC file specified on the command line with the \fB-r\fR option.
.PP
The available variables that can be set are shown below. Syntax is of the
form:
.PP
$bibtex='bibtex';
.SH RC VARIABLES
.PP
Default values are indicated in brackets.
.TP
.B $banner [0]
If nonzero, the banner message is printed across each page when converting
the dvi file to postscript. Without modifying $banner_message, this is
equivalent to specifing the \fB-d\fR option.
Note that if \fB$banner\fR is nonzero, the \fB$postscript_mode\fR is
assumed and the postscript file is always generated, even if it is newer
than the dvi file.
.TP
.B $banner_intensity [0.95]
Equivalent to the \fB-bi\fR option, this is a decimal number between 0
and 1 that specifies how dark to print the banner message. 0 is black,
1 is white. The default is just right if your toner cartridge isn't
running too low.
.TP
.B $banner_message ['DRAFT']
The banner message to print across each page when converting the dvi
file to postscript. This is equivalent to the \fB-bm\fR option.
.TP
.B $banner_scale [220.0]
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
just right for 5 character messages. This is equivalent to the
\fB-bs\fR option.
.TP
.B $bibtex ['bibtex']
The BibTeX processing program.
.TP
.B $bibtex_mode [0]
If nonzero, the document has a bibtex bibliography. Set by the \fB-i\fR
and \fB-I\fR options and saved in the dependency file. Should not need
to set this in an RC file.
.TP
.B $cleanup_mode [0]
If nonzero, specifies cleanup mode. All other options ignored.
Equivalent to specifying the \fB-c\fR option. Recommend that this is
not set from an RC file.
.TP
.B $clean_ext ['']
Extra extensions of files for latexmk to remove when the \fB-c\fR option
is selected.
.TP
.B $clean_full_ext ['']
Extra extensions of files for latexmk to remove when the \fB-C\fR option
is selected.
.TP
.B $cus_dep_list [empty]
Custom dependency list (see below).
.TP
.B $dvi_cont_previewer ['xtex']
The dvi-previewer to run with the \fB-pvc\fR option.
.TP
.B $dvi_cont_previewer_landscape ['xtex']
The dvi-previewer to run with the \fB-pvc\fR option in landscape mode.
.TP
.B $dvi_filter [empty]
The dvi file filter to be run on the newly produced dvi file before
other processing. Equivalent to specifying the \fB-dF\fR option.
.TP
.B $dvi_previewer ['xdvi -s 4']
The dvi-previewer to run with the \fB-pv\fR option.
.TP
.B $dvi_previewer_landscape ['xdvi -s 4 -paper a4r']
The dvi-previewer to run with the \fB-pv\fR option in landscape mode.
.TP
.B $dvips ['dvips']
The program to used as a filter to convert a .dvi file to a .ps file.
.TP
.B $dvips_landscape ['dvips -tlandscape']
The program to used as a filter to convert a .dvi file to a .ps file
in landscape mode.
.TP
.B $force_generate_and_save_includes [0]
If nonzero, specifies that the dependency file should always be
generated. Equivalent to specifying the \fB-I\fR option.
.TP
.B $force_mode [0]
If nonzero, continue processing past minor \fIlatex\fR errors
including unrecognized cross references. Equivalent to specifying the
\fB-f\fR option.
.TP
.B $force_include_mode [0]
If nonzero, force \fIlatexmk\fR to include files that don't exist when
generating dependency files. A warning is produced instead of an error
message and the program terminating. If the file name is not an
absolute path, it is assumed to be relative to the current working
directory. Equivalent to specifying the \fB-F\fR option.
.TP
.B $gererate_and_save_includes [0]
If nonzero, generates dependency file if it does not exist or is older
than the root file (the base .tex file). Equivalent to specifying
the \fB-i\fR option.
.TP
.B $go_mode [0]
If nonzero, process files regardless of timestamps. Equivalent to the
\fB-g\fR option.
.TP
.B $index_mode [0]
If nonzero, run \fImakeindex\fR to produce index of document. Set by
the \fB-i\fR and \fB-I\fR options and saved in the dependency file.
Should not need to set this in an RC file.
.TP
.B $landscape_mode [0]
If nonzero, run in landscape mode, using the landscape mode previewers and
dvi to postscript converters. Equivalent to the \fB-l\fR option.
.TP
.B $latex ['latex']
The LaTeX processing program.
.TP
.B $lpr ['lpr']
The printing program.
.TP
.B $makeindex ['makeindex']
The index processing program.
.TP
.B $postscript_mode [0]
If nonzero, generate a postscript version of the document.
Set by the \fB-i\fR and \fB-I\fR options if $slide_mode is set.
Equivalent to the \fB-ps\fR option and is stored in the dependency file
if generated.
.TP
.B $preview_continuous_mode [0]
If nonzero, run the \fB$dvi_previewer\fR to preview the document, and
continue running \fIlatexmk\fR to keep .dvi up-to-date. Equivalent to
the \fB-pvc\fR option.
.TP
.B $preview_mode [0]
If nonzero, run the \fB$ps_previewer\fR to preview the document.
Equivalent to the \fB-pv\fR option.
.TP
.B $printout_mode [0]
If nonzero, print the document using \fIlpr\fR. Equivalent to the
\fB-p\fR option. Recommend that this is not set from an RC file or
you could waste lots of paper.
.TP
.B $pscmd ['ps -x']
Command used to get all the processes currently run by the user. This
is used by the -pvc option to try and reattach itself to the already
existing previewer from a previous run with -pvc on the same file.
The default works for SunOS (BSD UNIX?). For Solaris (System V?) try 'ps'
in the LatexMk RC file.
.TP
.B $ps_filter [empty]
The postscript file filter to be run on the newly produced postscript
file before other processing. Equivalent to specifying the \fB-pF\fR
option.
.TP
.B $ps_previewer ['gs']
The postscript previewer to run with the \fB-pv\fR option.
.TP
.B $ps_previewer_landscape ['gs -swap']
The postscript previewer to run with the \fB-pv\fR option in landscape mode.
.TP
.B $sleep_time [2]
The time to sleep (in seconds) between checking for source file
changes when running the \fB-pvc\fR option.
.TP
.B $slide_mode [0]
If nonzero, document is a Slitex document. Set by the \fB-i\fR
and \fB-I\fR options or the \fB-s\fR option. Saved in the
dependency file if generated.
.TP
.B $slitex ['slitex']
The SLiTeX processing program for slides.
.TP
.B $texfile_search ['']
If no files were specified on the command line, then \fIlatexmk\fR will
search for and files in the current working directory that end with a
".tex" extention or match the file mask specifed in this variable.
e.g.: $texfile_search = "$texfile_search *.ftex *.c.tex";
.TP
.B $tmpdir ['/usr/tmp']
Directory to store very small temporary files that \fIlatexmk\fR generates
while running.
.SH CUSTOM DEPENDENCIES
.PP
In any RC file a set of custom dependencies can be set up to convert a
file with one extension to a file with another. An example use of this
would be to allow \fIlatexmk\fR to convert a \fI.fig\fR file to
\fI.eps\fR to be included in the \fI.tex\fR file. A table of custom
dependencies are set up by using the \fB@cus_dep_list\fR array. Each
string in the array has four arguments, separated by a space:
.TP
.B from extention:
The extension of the file we are converting from (e.g. "fig").
.TP
.B to extention:
The extension of the file we are converting to (e.g. "eps").
.TP
.B must:
If non-zero, the file we are converting from \fBmust\fR exist, if it
doesn't exist \fIlatexmk\fR will give an error message and exit unless
the \fB-f\fR option is specified. If \fImust\fR is zero and the file
we are converting from doesn't exist, then no action is taken.
.TP
.B function:
The name of the subroutine that \fIlatexmk\fR should call to perform the
file conversion. The first argument to the subroutine is the base name
of the file to be converted without any extension. The subroutines are
declared in the syntax of \fIperl\fR.
.PP
Example in an RC file to convert a \fI.fig\fR file to a \fI.eps\fR file:
@cus_dep_list = (@cus_dep_list, "fig eps 0 fig2eps");
sub fig2eps
{
system("fig2dev -Lps $_[0].fig $_[0].eps");
}
The subroutine \fIfig2eps\fR will only be called if the \fI.fig\fR file
was modified more recently then the \fI.eps\fR file, or the \fI.eps\fR
file does not exist.
If the return value of the subroutine is non-zero, then \fIlatexmk\fR
will assume an error occurred during the execution of the subroutine.
.SH SEE ALSO
latex(1), bibtex(1).
.SH BUGS
If you use macros for generating input file names in your document,
latexmk will not be able to figure out what the name should be when
trying to generate a dependency file. Using the \fI-F\fR option will
make latexmk ignore these, but latexmk will also obviously not have
a complete dependency list.
.SH IDENTIFICATION
Modifications and enhancements by Evan McLean (Version 2.0)
.br
Original script called "go" by David J. Musliner (RCS Version 3.2)
|