Fixing and preventing compile timeouts
When you click the Recompile button in your Overleaf project, you start a process that reads your project files and converts them into a typeset PDF. If you hit a compile timeout error, this means the compilation process couldn’t complete within the timeout limit for your Overleaf plan.
While it's possible that some projects are too large or complex to produce a PDF in the time provided, compile timeouts can often be fixed or prevented.
Steps to resolve compile timeouts
Follow these steps to identify and fix common issues that cause compile timeouts:
In addition to following these steps, please review the suggestions about what to do in specific timeout situations as well as what best practices to follow to prevent compile timeouts.
While many projects can be compiled in the time provided on Overleaf's free plan, if you're preparing a large or complex document, you may need to subscribe to a premium plan to get more compile time.
Step 1: Check for compile errors and fix them
Some compile errors, or the build-up of several errors, can completely block the latexmk build process and lead to a compile timeout. To find and fix errors, turn on the Stop on first error compilation mode under the Recompile drop-down menu:

The Stop on first error compile mode does exactly what you'd expect—it stops compiling immediately when an error is hit. When this happens, no PDF is generated and a message describing the error will be shown. Turning on Stop on first error allows you to find and fix each error in the project until the project is error-free.
Clicking on each error message will bring you to the line in the source code that is causing the problem so that you can correct your code. Several common errors are explained on this page, and some LaTeX debugging suggestions are listed on this page. Please also see the section in this article that lists some common fatal compile errors that cause compile timeouts.
Step 2: Try compiling in Fast [draft] mode
Including many or large image files in your project can significantly add to the time required to compile your project.
One method that can help determine if image processing is the cause of the timeout is to try compiling in Fast [draft] mode. To do that, choose the Fast [draft] option from the Recompile menu. This replaces all of your graphics with boxes and makes the PDF compile much faster:

If your document compiles in Fast [draft] mode but won't complete compile in Normal mode, the cause may be large or many image files.
Optimizing image files
If you've used multiple large, high-resolution PNG or JPEG files, processing those files can increase the time needed to compile your project, sometimes considerably. Be sure to:
Use PDF files instead of PNG files for diagrams and plots.
Reserve the use of JPEGs for photographs.
For additional advice, see Optimizing large image files.
Step 3: Assess your project for time-consuming tasks and fatal errors
If both Stop on First Error and Fast [draft] compile mode are still leading to a compile timeout, you may need to look further to identify the cause of the compile timeout and (hopefully) address it.
1. Review the list of time-consuming practices and packages that can slow down compilation
2. Review the list of common fatal errors that can lead to timeouts
3. Check the advice for specific timeout scenarios that best describes your situation
Time-consuming practices and packages
Some practices and packages can lead to very slow compiles, and even to timeouts.
Including complex 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 every time it makes a new PDF.
Using the mhchem
package
Recent versions of the mhchem
package can take longer to compile. Depending on what you are using it for, the chemformula
package may reduce the time needed for compiling. If you’ve already been using mhchem
, you can try to drop-in chemformula
as a replacement:
% \usepackage{mhchem}
\usepackage{chemformula}
\let\ce\ch
Including tracing or debugging calls
If you happen to have a \tracingall
command in your document, it may be writing a lot of data to the .log
. Recording and processing \tracingall
data in the .log
file can cause compilation to become extremely slow. It is recommended to remove the \tracingall
calls, or if you need to use similar methods for debugging, to use the trace
package instead.
Using the acro
package
Users of the acro
package have reported that version 3 is slow to load acronym declarations. One consequence of acro
’s increased compilation time is the possibility of triggering a compile timeout. Fortunately, there is a workaround: using version 2 of the acro
package.
Switching from version 3 back to version 2 may require editing your project to ensure it is compatible with version 2’s options, features, and commands. Documentation for version 2 is available, contained within earlier source code releases that can be downloaded from GitHub.
Here are some items to check when reverting to version 2—this list is far from exhaustive:
Modify your project’s main
.tex
to:change
\usepackage{acro}
to\usepackage{acro}[=v2]
change the
include=...
option key of\printacronyms
toinclude-classes=...
Within any
\DeclareAcronym
command, ensure thetag=...
option key is changed toclass=...
.
Please refer to acro
version 2.10’s documentation for commands and options available in version 2 but not in version 3.
Using EPS or SVG images
The use of EPS or SVG images can require extra processing to convert them to PDF format. This extra processing will add to the time needed to compile your project.
While the latex compiler will support EPS images directly, the pdfLaTeX compiler does not support EPS images, so an extra step is required to convert these to PDF images when that compiler is used. The processing is handled by the
epstopdf
package which usesGhostscript
to convert the EPS files to PDF. This conversion step can significantly add to the time required to compile the project.SVG image files are not supported by any LaTeX compiler directly, and require the use of the
svg
package and the\includesvg
command that it provides. Thesvg
package usesinkscape
to convert SVG images to PDF. This conversion step can significantly add to the time required to compile the project.
For faster results that may help to avoid compile timeouts, use PDF versions of your images instead of EPS or SVG formats.
Using the tabularray
package
The tabularray
package provides an alternative to the standard commands and environments for implementing tables in LaTeX. Unfortunately the tabularray
package runs very slowly, particularly for larger tables and those that use certain column types. Currently, standard table definition methods are recommended over tabularray
because of compile time considerations.
Creating an infinite loop in a command
During compilation, LaTeX commands can, very occasionally, trigger an “infinite loop.” Infinite loops are most commonly caused by bugs in packages or in user-defined commands.
If you suspect that you may be experiencing a loop, check to see if you accidentally created a recursive definition in one of your custom commands, such as \newcommand{\foo}{\foo}
.
Some causes of fatal compile errors
Below are some known causes of fatal errors.
Including blank lines in sensitive titling commands
LaTeX classes and journal templates often provide special commands for providing parts of a document's title. These commands are usually meant to include simple arguments, and using them in unexpected ways can lead to compile errors and even timeouts. Most importantly, commands such as \author{...}
, \date{...}
and \title{...}
should not contain blank lines.
Including too many fixed floats
If you have too many tables or figures using the [H]
placement identifier from the float
package, 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.
Errors in the \caption
command and tabular
environments
Here is a list of table-related issues to be aware of—in general, try to be careful when typesetting tables!
\caption{...}
should always be placed outside thetabular
environment because it may cause fatal errors if thecaption
package is loaded, as demonstrated in the following example:\documentclass{article} \usepackage{caption} \begin{document} \begin{table} \begin{tabular}{c|c} \caption{Caption}% \caption{...} should be OUTSIDE the tabular environment a & b \\ c & d \\ \end{tabular} \end{table} \end{document}
In contrast, note that the
longtable
environment does require\caption{...}
within it, as demonstrated by an example in our tables help article.\caption{...}
should not contain\\
,\newline
,\centering
,\raggedright
etc.With some templates or packages,
\ref{...}
or\cite{...}
within a\caption
may need to be prefixed by\protect
in order to avoid fatal errors; for example,\protect\cite{...}
.Check for incomplete
\cmidrule{...}
withintabular
environments. 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
tabular
environments. Have a look at themakecell
package if you’d like to add manual line breaks in a table cell, or thep{...}
column type and/ortabularx
package if you’re looking for ways to create columns that auto-wrap long lines.If you have tabular rows that start with
[...
you may need to add\relax
after the\\
on the previous row.
Using the soul
or changes
package
If you’re using the soul
or changes
package to highlight text or strike text out, then \cite
and \ref
may need to be prefixed by \protect
, for example, \protect\cite{...}
.
Using the tikzpicture
Check for missing ;
at the end of path/node commands and ]
at the end of parameter lists in tikzpicture
s.
Using the breqn
package
The breqn
package’s dmath
environment may run into infinite loops. Replace with align
and manually break lines if necessary.
Using the babel
package
Some babel
language options change the meaning of certain characters which can cause problems when those characters are used in their “normal” context, for example, in math mode. To avoid this, try using the option shorthands=off
when loading babel (e.g., \usepackage[shorthands=off]{babel}
).
Using the jabbrv
package
Some templates use the jabbrv
package to automatically abbreviate journal titles (see this Overleaf example). When a journal field in the .bib
file contains accented Unicode 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 you can change the project’s compiler to XeLaTeX
or LuaLaTeX
, both of which have built-in support for reading Unicode characters.
Advice for some specific timeout situations
Best practices for preventing compile timeouts
It is much nicer to prevent compile timeouts from happening than having to deal with the sometimes stressful process of fixing them once they've occurred. These recommendations should help you prevent compile timeouts from happening, or quickly recover from them when they do.
More information on compiling and compile time
Last updated
Was this helpful?