.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 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 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 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= 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 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 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 \fI$pdflatex\fR configuration variable. (The option \fB-pdflatex\fR in fact sets the variable \fI$pdflatex\fR.) 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 pdflatex; it does not turn on the use of pdflatex. That is done by other options or in an initialization file.\fR To set the command for running \fIlatex\fR (rather than the command for \fIpdflatex\fR) see the \fB-latex\fR option. .TP .B -pdflualatex="COMMAND" Equivalent to \fB-lualatex="COMMAND"\fR. .TP .B -pdfxelatex="COMMAND" Equivalent to \fB-xelatex="COMMAND"\fR. .TP .B -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 \fI*latex\fR is suitably configured. See the documentation of the variable \fI$pre_tex_code\fR, and the substitution strings %P and %U for more details. This option works by setting the variable \fI$pre_tex_code\fR. See also the \fB-usepretex\fR 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 latexmk -pretex='\\AtBeginDocument{Message\\par}' foo.tex .TP .B -print=dvi\fR,\fB -print=ps\fR,\fB -print=pdf\fR,\fB -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 \fB-print=auto\fR 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. .TP .B -ps Generate postscript version of document. (And turn off any incompatible requests.) .TP .B -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.) .TP .B -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. .TP .B -pv Run file previewer. If the \fB-view\fR option is used, that will select the kind of file to be previewed (.pdf, .ps or .dvi). Otherwise the viewer views the "highest" kind of output file that is made, with the ordering being .pdf, .ps, .dvi (high to low). This option is incompatible with the \fB-p\fR and \fB-pvc\fR options, so it turns them off. .TP .B -pv- Turn off \fB-pv\fR. .TP .B -pvc Run a file previewer and continually update the .dvi, .ps, and/or .pdf files whenever changes are made to source files (see 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 \fB-pv\fR option. The preview-continuous option \fB-pvc\fR can only work with one file. So in this case you will normally only specify one filename on the command line. It is also incompatible with the \fB-p\fR and \fB-pv\fR options, so it turns these options off. The \fB-pvc\fR option also turns off force mode (\fB-f\fR), as is normally best for continuous preview mode. If you really want force mode, use the options in the order \fB-pvc -f\fR. With a good previewer the display will be automatically updated. (Under \fIsome but not all\fR 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 apparent bug in gv that causes an error when the newly updated pdf file is read.) Many other previewers will need a manual update. \fBImportant note\fR: 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: \fISumatraPDF\fR and \fIgsview\fR are good possibilities. There are some other methods for arranging an update, notably useful for many versions of \fIxdvi\fR and \fIxpdf\fR. These are best set in \fIlatexmk\fR's configuration; see below. Note that if \fIlatexmk\fR dies or is stopped by the user, the "forked" previewer will continue to run. Successive invocations with the \fB-pvc\fR option will not fork new previewers, but \fIlatexmk\fR will normally use the existing previewer. (At least this will happen when \fIlatexmk\fR is running under an operating system where it knows how to determine whether an existing previewer is running.) .TP .B -pvc- Turn off \fB-pvc\fR. .TP .B -pvctimeout Do timeout in pvc mode after period of inactivity, which is 30 min. by default. Inactivity means a period when \fIlatexmk\fR has detected no file changes and hence has not taken any actions like compiling the document. .TP .B -pvctimeout- Don't do timeout in pvc mode after inactivity. .TP .B -pvctimeoutmins=