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.
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:
See this article for detailed suggestions on handling large images.
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}
\usepackage{chemformula}
\let\ce\ch
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 clone your project so that the new cloned project uses TeX Live 2018 with biblatex v3.12, which compiles much faster.
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.
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.
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.
Unfortunately, some LaTeX compile errors can block the latexmk
build process completely and therefore lead to a timeout. In order to debug such errors it may be necessary to add a file named latexmkrc
(without any file extension) to your project, on the top level, containing just these three lines:
$pdflatex = 'pdflatex --halt-on-error %O %S';
$lualatex = 'lualatex --halt-on-error %O %S';
$xelatex = 'xelatex --halt-on-error %O %S';
This would then make the compilation halt at the very first compile error message that occurs (albeit without generating any output preview). You can then debug and correct each error you come across until the project is error-free; you can then delete this latexmkrc
. (If you still get a timeout even with this latexmkrc
file, 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.\ref{...}
or \cite{...}
within a \caption
may need to be preceded by \protect
to avoid fatal errors.soul
or changes
package to highlight text or strike text out, \cite
and \ref
may require \protect
before them.\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.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...)\author{...}
should not contain blank lines.;
at the end of path/node commands, and ]
at the end of parameter lists, in tikzpicture
sbreqn
package's dmath
environment may run into infinite loops; replace with align
and manually break lines if necessary.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.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:
\usepackage{balance}
%% don't load flushend
\begin{document}
.... (somewhere in the left column of the last page)
\balance
[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.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.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 | Student, Collaborator, Pro | |
---|---|---|
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.
If you have a compile timeout error that you cannot resolve, please let us know and we'll take a look for you.