[edit] Overleaf guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files

Overleaf uses the latexmk build tool to automatically build your project. latexmk ensures that we run LaTeX and BibTeX (or other similar programs) the right number of times. latexmk reads a configuration file called latexmkrc that contains custom rules for building your project. By default, Overleaf automatically adds an invisible latexmkrc file to your project in order to build it. That latexmkrc file contains rules for glossaries, nomenclature, and other commonly used packages. In full, it currently reads:

<code># support for the glossaries package:
add_cus_dep('glo', 'gls', 0, 'makeglossaries');
add_cus_dep('acn', 'acr', 0, 'makeglossaries');
sub makeglossaries {
  system("makeglossaries \"$_[0]\"");

# support for the nomencl package:
add_cus_dep('nlo', 'nls', 0, 'makenlo2nls');
sub makenlo2nls {
  system("makeindex -s nomencl.ist -o \"$_[0].nls\" \"$_[0].nlo\"");

# from the documentation for V. 2.03 of asymptote:
sub asy {return system("asy \"$_[0]\"");}

# metapost rule from http://tex.stackexchange.com/questions/37134
add_cus_dep('mp', '1', 0, 'mpost');
sub mpost {
  my $file = $_[0];
  my ($name, $path) = fileparse($file);
  my $return = system "mpost $name";
  return $return;

You can customise the build process by adding a custom latexmkrc file to your project. If you have a file called latexmkrc in your project, Overleaf will not add the default latexmkrc file, so you may want to copy the default latexmkrc above into your latexmkrc file, to make sure that the rules above are still included.

Note that some latexmk options are not compatible with Overleaf. In particular, if you set the $preview_continuous_mode or $output_dir options, that may break the preview on Overleaf.

If you want to build your Overleaf project offline, for example via the Overleaf-git bridge, using latexmk, you may want to copy the latexmkrc file to your project locally, to make sure it builds in the same way as we build it on Overleaf.

For more information about latexmkrc files, check out our blog post with tips and tricks from our friendly Overleaf TeXperts.