LATEXMK(1) General Commands Manual LATEXMK(1) NAME latexmk - generate LaTeX document SYNOPSIS latexmk [options] [file ...] DESCRIPTION Latexmk completely automates the process of compiling a LaTeX document. Essentially, it is like a specialized relative of the general make utility, but one which determines dependencies automatically and has some other very useful features. In its basic mode of operation la- texmk 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. By default latexmk will run the commands necessary to generate a .dvi file. Latexmk can also be set to run continuously with a suitable previewer. In that case the latex program (or one of its relatives), etc, are re- run whenever one of the source files is modified, and the previewer au- tomatically updates the on-screen view of the compiled document. Latexmk 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 -recorder option of modern versions of latex (and pdflatex, xelatex, lualatex, etc). See the documentation for the -recorder option of latexmk below.) When latexmk is run, it examines properties of the source files, and if any have been changed since the last document generation, latexmk will run the various LaTeX processing programs as necessary. In particular, it will repeat the run of latex (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, latexmk will also run bibtex, biber, and/or makeindex. In addition, latexmk can be configured to generate other necessary files. For exam- ple, from an updated figure file it can automatically generate a file in encapsulated postscript or another suitable format for reading by LaTeX. Latexmk has two different previewing options. With the simple -pv op- tion, 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. The second previewing option is the powerful -pvc option (mnemonic: "preview continuously"). In this case, latexmk runs continuously, reg- ularly monitoring all the source files to see if any have changed. Ev- ery time a change is detected, latexmk 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, latexmk completely automates the cycle of updating the .dvi (and/or the .ps and .pdf) file, and 17 April 2020 1 LATEXMK(1) General Commands Manual LATEXMK(1) refreshing the previewer's display. It's not quite WYSIWYG, but use- fully close. For other previewers, the user may have to manually make the previewer update its display, which can be (e.g., with some versions of xdvi and gsview) as simple as forcing a redraw of its display. Latexmk 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 -dF and -pF, and the documenta- tion for the $dvi_filter and $ps_filter configuration variables.) These capabilities are leftover from older versions of latexmk, but are currently non-functional. More flexibility can be obtained in current versions, since the command strings for running latex, pdflatex, etc can now be configured to run multiple commands. This also extends the possibility of postprocessing generated files. Latexmk is highly configurable, both from the command line and in con- figuration 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 latexmk often works without special configura- tion 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 Configura- tion" A very annoying complication handled very reliably by latexmk, is that LaTeX is a multiple pass system. On each run, LaTeX reads in informa- tion 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 de- terminations of how many runs are needed and of which programs. La- texmk 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 latexmk generates an extra file (with ex- tension .fdb_latexmk, by default) that contains the source file infor- mation. LATEXMK OPTIONS AND ARGUMENTS ON COMMAND LINE In general the command line to invoke latexmk has the form latexmk [options] [file] All options can be introduced by single or double "-" characters, e.g., "latexmk -help" or "latexmk --help". Note 1: In addition to the options in the list below, latexmk recog- nizes almost all the options recognized by the latex, pdflatex programs 17 April 2020 2 LATEXMK(1) General Commands Manual LATEXMK(1) (and their relatives) in their current TeXLive and MiKTeX implementa- tions. Some of the options for these programs also trigger special ac- tion or behavior by latexmk, in which case they have specific explana- tions in this document. Otherwise, they are just passed through to a called latex or pdflatex program. Run latexmk with the -showextraop- tions to get a list of the options that latexmk accepts and that are simply passed through to latex or pdflatex (etc). See also the expla- nation of the -showextraoptions option for more information. Note 2: In this documentation, the program pdflatex is often referred to. Users of programs like lualatex and xelatex should know that from latexmk's point of view, these other programs behave very like pdfla- tex, i.e., they make a pdf file from a tex file, etc. So whenever pdflatex is mentioned without mention of the other programs, the state- ments apply equally to lualatex, xelatex, and any other similar pro- grams. Latexmk can be easily configured to use whichever of these pro- grams is needed. See the documentation for the following options: -pdflua, -pdfxe, -lualatex, and -xelatex, and also see the documenta- tion for the $pdflatex, $lualatex, and $xelatex configuration vari- ables. At present latexmk does not do automatic detection of which program is to be used. Definitions of options and arguments file One or more files can be specified. If no files are specified, latexmk will, by default, run on all files in the current work- ing directory with a ".tex" extension. This behavior can be changed: see the description concerning the @default_files vari- able in the section "List of configuration variables usable in initialization files". If a file is specified without an extension, then the ".tex" ex- tension is automatically added, just as LaTeX does. Thus, if you specify: latexmk foo then latexmk 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 problem- atic for the latex etc programs. These characters are: "$", "%", "\", "~", the double quote character, and the control char- acters null, tab, form feed, carriage return, line feed, and delete. In addition "&" is prohibited when it is the first character of a filename. Latexmk gives a fatal error when it detects any of the above characters in the TeX filename(s) specified on the command line. However before testing for illegal characters, latexmk removes matching pairs of double quotes from a filename. This matches the behavior of latex etc, and deals with problems that 17 April 2020 3 LATEXMK(1) General Commands Manual LATEXMK(1) occasionally result from filenames that have been incorrectly quoted on the command line. In addition, under Microsoft Win- dows, the forward slash character "\" is a directory separator, so latexmk replaces it by a backward slash "/", which is also a legal directory separator in Windows, and is accepted by latex etc. -auxdir=FOO or -aux-directory=FOO Sets the directory for auxiliary output files of (pdf)latex (.aux, .log etc). This achieves its effect by the -aux-direc- tory option of (pdf)latex, which currently is only implemented on the MiKTeX version of (pdf)latex. See also the -outdir/-output-directory options, and the $aux_dir, $out_dir, and $search_path_separator configuration variables of latexmk. In particular, see the documentation of $out_dir for some complications on what directory names are suitable. If you also use the -cd option, and the specified auxiliary out- put directory is a relative path, then the path is interpreted relative to the document directory. -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 $bibtex_use variable to 2 in a configuration file. -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 -bibtex- option will prevent latexmk from trying to run bibtex or biber, which would result in overwriting of the bbl files. This property can also be configured by setting the $bibtex_use variable to 0 in a configuration file. -bibtex-cond When the source file uses bbl file(s) for the bibliography, run bibtex or biber as needed to regenerate the bbl files, but only if the relevant bib file(s) exist. Thus when the bib files are not available, bibtex or biber is not run, thereby avoiding overwriting of the bbl file(s). Also, always treat .bbl files 17 April 2020 4 LATEXMK(1) General Commands Manual LATEXMK(1) as precious, i.e., do not delete them in a cleanup operation. This is the default setting. It can also be configured by set- ting the $bibtex_use variable to 1 in a configuration file. The reason for using this setting is that sometimes a .bbl file is available containing the bibliography for a document, but the .bib file is not available. An example would be for a scien- tific journal where authors submit .tex and .bbl files, but not the original .bib file. In that case, running bibtex or biber would not work, and the .bbl file should be treated as a user source file, and not as a file that can be regenerated on de- mand. (Note that it is possible for latexmk to decide that the bib file does not exist, even though the bib file does exist and bibtex or biber finds it. The problem is that the bib file may not be in the current directory but in some search path; the places latexmk and bibtex or biber cause to be searched need not be identical. On modern installations of TeX and related pro- grams this problem should not arise, since latexmk uses the kpsewhich program to do the search, and kpsewhich should use the same search path as bibtex and biber. If this problem arises, use the -bibtex option when invoking latexmk.) Note that this value does not work properly if the document uses biber instead of bibtex. (There's a long story why not.) -bibtex-cond1 The same as -bibtex-cond1 except that .bbl files are only treated as precious if one or more bibfiles fails to exist. Thus if all the bib files exist, bibtex or biber is run to gen- erate .bbl files as needed, and then it is appropriate to delete the bbl files in a cleanup operation since they can be re-gener- ated. This property can also be configured by setting the $bibtex_use variable to 1.5 in a configuration file. -bm A banner message to print diagonally across each page when con- verting the dvi file to postscript. The message must be a sin- gle argument on the command line so be careful with quoting spa- ces and such. Note that if the -bm option is specified, the -ps option is as- sumed. -bi How dark to print the banner message. A decimal number between 17 April 2020 5 LATEXMK(1) General Commands Manual LATEXMK(1) 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. -bs 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 charac- ter messages. -commands List the commands used by latexmk for processing files, and then exit. -c Clean up (remove) all regeneratable files generated by latex and bibtex or biber except dvi, postscript and pdf. These files are a combination of log files, aux files, latexmk's database file of source file information, and those with extensions specified in the @generated_exts configuration variable. In addition, files specified by the $clean_ext and @generated_exts configura- tion variables are removed. This cleanup is instead of a regular make. See the -gg option if you want to do a cleanup then a make. Treatment of .bbl files: If $bibtex_use is set to 0 or 1, bbl files are always treated as non-regeneratable. If $bibtex_use is set to 1.5, bbl files are counted as non-regeneratable condi- tionally: If the bib file exists, then bbl files are regenerat- able, and are deleted in a clean up. But if $bibtex_use 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 $bibtex_use is set to 2, bbl files are always treated as regeneratable, and are deleted in a cleanup. Treatment of files generated by custom dependencies: If $cleanup_includes_cusdep_generated is nonzero, regeneratable files are considered as including those generated by custom de- pendencies and are also deleted. Otherwise these files are not deleted. -C Clean up (remove) all regeneratable files generated by latex and bibtex or biber. This is the same as the -c option with the ad- dition of dvi, postscript and pdf files, and those specified in the $clean_full_ext configuration variable. This cleanup is instead of a regular make. See the -gg option if you want to do a cleanup than a make. 17 April 2020 6 LATEXMK(1) General Commands Manual LATEXMK(1) See the -c option for the specification of whether or not .bbl files are treated as non-regeneratable or regeneratable. If $cleanup_includes_cusdep_generated is nonzero, regeneratable files are considered as including those generated by custom de- pendencies and are also deleted. Otherwise these files are not deleted. -CA (Obsolete). Now equivalent to the -C option. See that option for details. -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 latexmk is invoked from a GUI configured to invoke latexmk with a full pathname for the source file. This option works by setting the $do_cd configuration variable to one; you can set that variable if you want to configure la- texmk to have the effect of the -cd option without specifying it on the command line. See the documentation for that variable. -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 latex and pdflatex programs. However, it is not desirable behavior when latexmk is invoked by a GUI configured to invoke latexmk with a full pathname for the source file. See the -cd option. This option works by setting the $do_cd configuration variable to zero. See the documentation for that variable for more in- formation. -CF Remove the file containing the database of source file informa- tion, before doing the other actions requested. -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 -bs and -bi options. The -bm option will override this option as this is really just a short way of specifying: latexmk -bm DRAFT 17 April 2020 7 LATEXMK(1) General Commands Manual LATEXMK(1) Note that if the -d option is specified, the -ps option is as- sumed. -deps Show a list of dependent files after processing. This is in the form of a dependency list of the form used by the make 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 latexmk can determine them. By default the list of dependent files is sent to stdout (i.e., normally to the screen unless you've redirected latexmk's out- put). But you can set the filename where the list is sent by the -deps-out= option. See the section "USING latexmk WITH make" for an example of how to use a dependency list with make. Users familiar with GNU automake and gcc will find that the -deps option is very similar in its purpose and results to the -M option to gcc. (In fact, latexmk also has options -M, -MF, and -MP options that behave like those of gcc.) -dependents Equivalent to -deps. -deps- Do not show a list of dependent files after processing. (This is the default.) -dependents- Equivalent to -deps-. -deps-out=FILENAME Set the filename to which the list of dependent files is writ- ten. 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 de- pendent files after processing. -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: 17 April 2020 8 LATEXMK(1) General Commands Manual LATEXMK(1) latexmk -dF "dviselect even" foo.tex -diagnostics Print detailed diagnostics during a run. This may help for de- bugging problems or to understand latexmk's behavior in diffi- cult situations. -dvi Generate dvi version of document. -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.) -e Execute the specified initialization code before processing. The code is Perl code of the same form as is used in latexmk's initialization files. For more details, see the information on the -r option, and the section about "Configuration/initializa- tion (RC) files". The code is typically a sequence of assign- ment statements separated by semicolons. The code is executed when the -e option is encountered during latexmk's parsing of its command line. See the -r option for a way of executing initialization code from a file. An error re- sults in latexmk stopping. Multiple instances of the -r and -e options can be used, and they are executed in the order they ap- pear on the command line. Some care is needed to deal with proper quoting of special char- acters in the code on the command line. For example, suppose you want to set the latex command to use its -shell-escape op- tion, 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 spe- cial. (In this example, the q/.../ construct is a Perl idiom equivalent to using single quotes. This avoids the complica- tions 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 17 April 2020 9 LATEXMK(1) General Commands Manual LATEXMK(1) or latexmk -e "$latex='latex %O -shell-escape %S'" file.tex The last two examples will NOT work with UNIX/Linux command shells. (Note: the above examples show are to show how to use the -e to specify initialization code to be executed. But the particular effect can be achieved also by the use of the -latex option with less problems in dealing with quoting.) -f Force latexmk to continue document processing despite errors. Normally, when latexmk 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 latex (etc) that would be done if no errors had occurred. If instead, or additionally, you want the latex (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 latexmk's option -interaction=nonstopmode. -f- Turn off the forced processing-past-errors such as is set by the -f option. This could be used to override a setting in a con- figuration file. -g Force latexmk to process document fully, even under situations where latexmk 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. -g- Turn off -g. -gg "Super go mode" or "clean make": clean out generated files as if -C had been given, and then do a regular make. -h, -help Print help information. -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.) 17 April 2020 10 LATEXMK(1) General Commands Manual LATEXMK(1) This is like the same option for current implementations of the latex, pdflatex, etc, and the passing of this option to these programs is part of latexmk's implementation of -jobname. There is one enhancement, that the STRING may contain the place- holder '%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 latexmk, and you wish to use a jobname with a different file-dependent value for each file. For exam- ple, suppose you had .tex files test1.tex and test2.tex, and you wished to compare the results of compilation by pdflatex and those with xelatex. 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 pdflatex would have basenames test1-pdflatex and test2-pdflatex, while from xelatex, the basenames would be test1-xelatex and test2-xe- latex. Under MS-Windows with cmd.exe, you would need to double the per- cent 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 -l Run in landscape mode, using the landscape mode for the preview- ers and the dvi to postscript converters. This option is not normally needed nowadays, since current previewers normally de- termine this information automatically. -l- Turn off -l. -latex This sets the generation of dvi files by latex, and turns off the generation of pdf and ps files. Note: to set the command used when latex is specified, see the -latex="COMMAND" option. -latex="COMMAND" This sets the string specifying the command to run latex, and is typically used to add desired options. Since the string nor- mally 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 17 April 2020 11 LATEXMK(1) General Commands Manual LATEXMK(1) for the $latex configuration variable. Depending on your oper- ating system and the command-line shell you are using, you may need to change the single quotes to double quotes (or something else). Note: 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. To set the command for running pdflatex (rather than the command for latex) see the -pdflatex option. -logfilewarninglist -logfilewarnings After a run of (pdf)latex, give a list of warn- ings about undefined citations and references (unless silent mode is on). See also the $silence_logfile_warnings configuration variable. -logfilewarninglist- -logfilewarnings- After a run of (pdf)latex, do not give a list of warnings about undefined citations and references. (Default) See also the $silence_logfile_warnings configuration variable. -lualatex Use lualatex. That is, use lualatex to process the source file(s) to pdf. The generation of dvi and postscript files is turned off. This option is equivalent to using the following set of options -pdflua -dvi- -ps- (Note: Note that the method of implementation of this option, but not its intended effect, differ from some earlier versions of latexmk.) -lualatex="COMMAND" This sets the string specifying the command to run lualatex. It behaves like the -pdflatex option, but sets the variable $luala- tex. Note: 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 initial- ization file. 17 April 2020 12 LATEXMK(1) General Commands Manual LATEXMK(1) -M Show list of dependent files after processing. This is equiva- lent to the -deps option. -MF file If a list of dependents is made, the -MF specifies the file to write it to. -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 make gives if you re- move header files without updating the Makefile to match. -MSWinBackSlash This option only has an effect when latexmk is running under MS- Windows. This is that when latexmk runs a command under MS-Win- dows, the Windows standard directory separator "\" is used to separate directory components in a file name. Internally, la- texmk 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 $MSWin_back_slash=0. -MSWinBackSlash- This option only has an effect when latexmk is running under MS- Windows. This is that when latexmk runs a command under MS-Win- dows, the substitution of "\" for the separator character be- tween directory components of a file name is not 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 latexmk does by default. See the documentation for the configuration variable $MSWin_back_slash for more details. -new-viewer When in continuous-preview mode, always start a new viewer to view the generated file. By default, latexmk will, in continu- ous-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. -new-viewer- The inverse of the -new-viewer option. It puts latexmk in its 17 April 2020 13 LATEXMK(1) General Commands Manual LATEXMK(1) normal behavior that in preview-continuous mode it checks for an already-running previewer. -nobibtex Never run bibtex or biber. Equivalent to the -bibtex- option. -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 en- countered. But -norc is an exception to this rule: it is acted on first, no matter where it occurs on the command line. -outdir=FOO or -output-directory=FOO Sets the directory for the output files of (pdf)latex. This achieves its effect by the -output-directory option of (pdf)la- tex, which currently (Dec. 2011 and later) is implemented on the common versions of (pdf)latex, i.e., MiKTeX and TeXLive. It may not be present in other versions. See also the -auxdir/-aux-directory options, and the $aux_dir, $out_dir, and $search_path_separator configuration variables of latexmk. In particular, see the documentation of $out_dir for some complications on what directory names are suitable. If you also use the -cd option, and the specified output direc- tory is a relative path, then the path is interpreted relative to the document directory. -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 -print=... option to change the type of file to be printed, and you can configure this in a start up file (by setting the $print_type 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, un- der MS-Windows you must have suitable program(s) available, and you must have configured the print commands used by latexmk. This can be non-trivial. See the documentation on the $lpr, $lpr_dvi, and $lpr_pdf configuration variables to see how to set the commands for printing. This option is incompatible with the -pv and -pvc options, so it turns them off. 17 April 2020 14 LATEXMK(1) General Commands Manual LATEXMK(1) -pdf Generate pdf version of document using pdflatex. (If you wish to use lualatex or xelatex, you can use whichever of the options -pdflua, -pdfxe, -lualatex or -xelatex applies.) To configure latexmk to have such behavior by default, see the section on "Configuration/initialization (rc) files". -pdfdvi Generate pdf version of document from the dvi file, by default using dvipdf. -pdflua Generate pdf version of document using lualatex. -pdfps Generate pdf version of document from the .ps file, by default using ps2pdf. -pdfxe Generate pdf version of document using xelatex. Note that to optimize processing time, latexmk uses xelatex 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 la- texmk then call xdvipdfmx to generate the final .pdf file. (Note: The reason why latexmk arranges for xelatex to make an .xdv file instead of the xelatex's default of a .pdf file is as follows: When the document includes large graphics files, espe- cially .png files, the production of a .pdf file can be quite time consuming, even when the creation of the .xdv file by xela- tex is fast. So the use of the intermediate .xdv file can re- sult in substantial gains in procesing time, since the .pdf file is produced once rather than on every run of xelatex.) -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 la- tex (or, more precisely, whatever program is configured to be used in the $latex configuration variable). -pdflatex This sets the generation of pdf files by pdflatex, and turns off the generation of dvi and ps files. Note: to set the command used when pdflatex is specified, see the -pdflatex="COMMAND" option. 17 April 2020 15 LATEXMK(1) General Commands Manual LATEXMK(1) -pdflatex="COMMAND" This sets the string specifying the command to run pdflatex, and is typically used to add desired options. Since the string nor- mally contains spaces, it should be quoted, e.g., latexmk -pdf -pdflatex="pdflatex --shell-escape %O %S" foo.tex The specification of the contents of the string are the same as for the $pdflatex configuration variable. (The option -pdflatex in fact sets the variable $pdflatex.) Depending on your operat- ing system and the command-line shell you are using, you may need to change the single quotes to double quotes (or something else). Note: This option when provided with the COMMAND argument only sets the command for invoking pdflatex; it does not turn on the use of pdflatex. That is done by other options or in an initial- ization file. To set the command for running latex (rather than the command for pdflatex) see the -latex option. -pdflualatex="COMMAND" Equivalent to -lualatex="COMMAND". -pdfxelatex="COMMAND" Equivalent to -xelatex="COMMAND". -pretex=CODE Given that CODE is some TeX code, this options sets that code to be executed before inputting source file. This only works if the command for invoking the relevant *latex is suitably config- ured. See the documentation of the variable $pre_tex_code, and the substitution strings %P and %U for more details. This op- tion works by setting the variable $pre_tex_code. See also the -usepretex option. An example: latexmk -pretex='\AtBeginDocument{Message\par}' -usepretex foo.tex But this is better written latexmk -usepretex='\AtBeginDocument{Message\par}' foo.tex If you already have a suitable command configured, you only need 17 April 2020 16 LATEXMK(1) General Commands Manual LATEXMK(1) latexmk -pretex='\AtBeginDocument{Message\par}' foo.tex -print=dvi, -print=ps, -print=pdf, -print=auto, Define which kind of file is printed. This option also ensures that the requisite file is made, and turns on printing. The (default) case -print=auto determines the kind of print file automatically from the set of files that is being made. The first in the list postscript, pdf, dvi that is among the files to be made is the one used for print out. -ps Generate postscript version of document. -ps- Turn off generation of postscript version of document. This can be used to override a setting in a configuration file. (It may get overridden by some other option that requires a postscript file, for example a request for printing.) -pF Postscript file filtering. The argument to this option is a filter which will generate a filtered postscript file with the extension ".psF". All extra processing (e.g. preview, printing) will then be performed on this filtered postscript file. Example of usage: Use psnup to print two pages on the one page: latexmk -ps -pF 'psnup -2' foo.tex or latexmk -ps -pF "psnup -2" foo.tex Whether to use single or double quotes round the "psnup -2" will depend on your command interpreter, as used by the particular version of perl and the operating system on your computer. -pv Run file previewer. If the -view option is used, this will se- lect the kind of file to be previewed (.dvi, .ps or .pdf). Oth- erwise the viewer views the "highest" kind of file selected, by the -dvi, -ps, -pdf, -pdfps options, in the order .dvi, .ps, .pdf (low to high). If no file type has been selected, the dvi previewer will be used. This option is incompatible with the -p and -pvc options, so it turns them off. -pv- Turn off -pv. -pvc Run a file previewer and continually update the .dvi, .ps, and/or .pdf files whenever changes are made to source files (see 17 April 2020 17 LATEXMK(1) General Commands Manual LATEXMK(1) the Description above). Which of these files is generated and which is viewed is governed by the other options, and is the same as for the -pv option. The preview-continuous option -pvc can only work with one file. So in this case you will normally only specify one filename on the command line. It is also in- compatible with the -p and -pv options, so it turns these op- tions off. The -pvc option also turns off force mode (-f), as is normally best for continuous preview mode. If you really want force mode, use the options in the order -pvc -f. With a good previewer the display will be automatically updated. (Under some but not all versions of UNIX/Linux "gv -watch" does this for postscript files; this can be set by a configuration variable. This would also work for pdf files except for an ap- parent bug in gv that causes an error when the newly updated pdf file is read.) Many other previewers will need a manual update. Important note: the acroread program on MS-Windows locks the pdf file, and prevents new versions being written, so it is a bad idea to use acroread to view pdf files in preview-continuous mode. It is better to use a different viewer: SumatraPDF and gsview are good possibilities. There are some other methods for arranging an update, notably useful for many versions of xdvi and xpdf. These are best set in latexmk's configuration; see below. Note that if latexmk dies or is stopped by the user, the "forked" previewer will continue to run. Successive invocations with the -pvc option will not fork new previewers, but latexmk will normally use the existing previewer. (At least this will happen when latexmk is running under an operating system where it knows how to determine whether an existing previewer is run- ning.) -pvc- Turn off -pvc. -pvctimeout Do timeout in pvc mode after period of inactivity, which is 30 min. by default. Inactivity means a period when latexmk has de- tected no file changes and hence has not taken any actions like compiling the document. -pvctimeout- Don't do timeout in pvc mode after inactivity. -pvctimeoutmins=