Latexmk Automatically Continue After Could Not Open Document
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.
mhchem
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
.
biblatex
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:
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:
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 outsidetabular
; otherwise it may cause fatal errors if thecaption
package is loaded. (Butlongtable
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
orchanges
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 thep{...}
column type and/ortabularx
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, intikzpicture
s - The
breqn
package'sdmath
environment may run into infinite loops; replace withalign
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 forflushend
's algorithm to operate on. Theflushend
package was removed from the ACM template for this reason. You may want to temporarily remove - 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 theshorthands=off
option when loadingbabel
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 thepdfpages
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.
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
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.
Source: https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F
Post a Comment for "Latexmk Automatically Continue After Could Not Open Document"