Forrest logo
back to the latexmk tool

latexmk:tldr:9c538

latexmk: Compile a DVI (Device Independent file) document from every source.
$ latexmk
try on your machine

The latexmk command is a powerful utility that streamlines the process of compiling LaTeX documents. It automates the necessary steps to compile a LaTeX file, such as running the appropriate LaTeX compiler multiple times (if necessary) to resolve dependencies between references, cross-references, bibliographies, and other components.

When you run latexmk, it analyzes the document's dependencies by looking for files that the LaTeX compiler might need to rebuild the document. latexmk then determines which commands to run in the correct sequence to produce the final output.

Some key features and options of latexmk include:

  • Automatic incremental compilation: latexmk tracks changes in files and only recompiles what is necessary to produce an up-to-date output. This helps save compilation time.

  • Support for multiple LaTeX engines: latexmk can work with popular LaTeX engines such as pdfLaTeX, XeLaTeX, and LuaLaTeX. It automatically detects the appropriate engine based on the document configuration or file extension.

  • Continuous preview mode: With the -pvc (preview continuously) option, latexmk can continuously monitor the source LaTeX document for changes and automatically rebuild the output whenever a change is detected. This is particularly useful during document editing, as it provides an immediate preview of the changes.

  • Clean-up operations: latexmk can remove temporary files generated during the compilation process, keeping your project directory tidy.

  • Customization: There are several configuration options available to tailor the behavior of latexmk to your specific requirements. These options can be specified in a configuration file or in the command line.

Overall, latexmk simplifies the LaTeX compilation process by automating the repetitive tasks, ensuring that your LaTeX documents are always up to date and error-free with minimal effort from your side.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the latexmk tool