Skip to content

A ‘compile timeout’ means that it took too long to make the PDF for your document. This page explains why this can happen and how to fix it.

Large, High-resolution images

If you have several high-resolution PNG or JPEG images in your document, LaTeX has to resize them every time we compile the PDF, and this can take a long time. Here are some ways to get around this:

  • Use PDF files instead of PNG files for diagrams and plots. If your drawing or plotting software exports to PDF, that will be much faster (and the output will look better). Also converting PNG files to PDF and using those instead of the PNGs will speed things up.
  • Use draft mode when working online, by clicking on the downward-pointing arrow next to the "Recompile" button, and then choose the "Fast (draft)" option. This replaces all of your graphics with boxes and makes the PDF compile much faster.

  • Use lower resolution images for the online version of the document.

See this article for detailed suggestions on handling large images.

Complicated TikZ or pgfplots drawings

TikZ and pgfplots produce great graphics, but they can take a long time to compile. There are several ways you can externalize the TikZ pictures so that LaTeX doesn't have to redraw them from scratch every time it makes a new PDF.


Recent versions of the mhchem package can take longer to compile. Depending on your usage scenario, the chemformula package may compile faster. If you've already been using mhchem, you can try to drop-in chemformula as a replacement:

% \usepackage{mhchem}

Though note that there are syntax and feature differences between mhchem and chemformula, so this may not always work well. For example, \ce{2H2O} will render fine with mhchem, but you'll have to write this as \ch{2 H2O} with a space after the initial 2 with chemformula.


If your project was created some time ago and therefore uses the TeX Live 2017 compiler image, your project would then be using biblatex v3.7. This version of biblatex very slow especially if you're using styles that need to track occurrences of citations, e.g. authoryear-comp, authoryear-icomp, APA etc. You can switch the TeX Live version of your project to a more recent one that is compatible with your project to use a newer and faster version of biblatex.

If you need to keep using TeX Live 2017 for your project and would like to try get around biblatex v3.7's slowness, it may help to try switching to a non-tracking style while compiling online, e.g. authoryear, or (where possible) use BibTeX instead.

Tracing/debugging calls

If you happen to have a \tracingall in your document (perhaps leftover from a template or a project from a local machine), it'll be recording lots and lots of lines in the .log file (which can quickly grow to hundreds of MBs) and showing no sign of stopping. Remove the \tracingall call from your Overleaf project; or use the trace package instead, if you need to debug online.

Infinite loops

LaTeX can fall into an infinite loop when it tries to make the PDF—no matter how long you wait, it will never finish. Infinite loops are most commonly caused by bugs in packages or in user-defined commands, e.g. when a command expands to itself (a process called recursion). So check if you accidentally added a definition like \newcommand{\foo}{\foo} somewhere.

Fatal compile errors blocking the compilation

Unfortunately, some LaTeX compile errors can block the latexmk build process completely and therefore lead to a timeout. In order to debug such errors, you may enable the Using the Stop on First Error compilation mode, from the Recompile drop-down menu:

Screenshot showing how to enable the Stop on first error compilation mode

The Stop on first error compilation mode causes Overleaf to terminate compilation immediately upon detection of the first error, albeit without generating a PDF preview. You can then debug and correct each error you come across until the project is error-free. A PDF preview will then be shown. You can then switch back to the Try to compile despite errors mode, if you wish:

Screenshot showing how to disable the Stop on first error compilation mode

If you still get a timeout even in Stop on first error mode, it is likely that the main cause is one of the issues discussed in previous sections.

Common errors that may block the compilation process include (but are not limited) to the following:

  • \caption{} should always be placed outside tabular; otherwise it may cause fatal errors if the caption package is loaded. (But longtable does require \caption{...} within it)
  • \caption{...} should not contain \\, \newline, \centering, \raggedright etc.
  • With some templates or packages, \ref{...} or \cite{...} within a \caption may need to be preceded by \protect to avoid fatal errors.
  • Similarly if you're using the soul or changes package to highlight text or strike text out, \cite and \ref may require \protect before them.
  • Check for incomplete \cmidrule{...} within tabulars; it requires a range of columns so you'll need to write \cmidrule{3-3} instead of just \cmidrule{3} if you want a horizontal rule that spans only one column.
  • Avoid nested tabulars. Have a look at the makecell if you'd like to add manual line breaks in a table cell, or the p{...} column type and/or tabularx package if you're looking for ways to create columns that auto-wrap long lines. (In general be very careful with tables...)
  • If you have tabular rows that start with [..., you may need to add \relax after the \\ on the previous row.
  • \author{...}, \date{...} and \title{...} should not contain blank lines.
  • Missing ; at the end of path/node commands, and ] at the end of parameter lists, in tikzpictures
  • The breqn package's dmath environment may run into infinite loops; replace with align and manually break lines if necessary.
  • The flushend package can cause infinite loops. This typically happens when there is too few text on the last page for flushend's algorithm to operate on. The flushend package was removed from the ACM template for this reason.
  • You may want to temporarily remove flushend while you're still actively writing the manuscript. Once you've finalised your contents, you can re-add flushend, and see if it then works better. If not, you may want to use the balance package instead:
    %% don't load flushend
    .... (somewhere in the left column of the last page) 
  • If you have too many tables or figures using the [H] placement identifier, it may cause \(\LaTeX\) to run into an infinite loop trying to find suitable places for all of them. Consider replacing all [H] with [hbt!], and if necessary an occasional \clearpage to flush out all tables and figures in the queue before inserting a page break.
  • Some babel language options may change the meanings of some characters, which may further cause problems when these characters are used in their "normal" context e.g. in math mode. Try adding the shorthands=off option when loading babel to stop this.
  • Some templates use the jabbrv package to automatically abbreviate journal titles. When a journal field in the .bib file contains unicode accented characters (e.g. Biología), this can block the compilation and cause a timeout on Overleaf. LaTeX commands need to be used instead, e.g. Biolog{\'i}a; or use xelatex/lualatex as your project's compiler.
  • When using the \includepdf command from the pdfpages package, make sure the path and filename to the .pdf is correct. If the compiler cannot locate the .pdf file to include, the compilation process cannot proceed at all.

Fair Use limits

If you have a very large document, it may just take a long time to compile. We offer longer compile times on our paid plans:

  Free Premium
Timeout 1 minute 4 minutes

We have to set timeouts in order to deal with infinite loops, and also to ensure that we are fair to all of our users.

Still stuck?

If you have a compile timeout error that you cannot resolve, please let us know and we'll take a look for you.

Overleaf guides

LaTeX Basics


Figures and tables

References and Citations


Document structure





Field specific

Class files

Advanced TeX/LaTeX