I have a lot of tikz, matlab2tikz or pgfplots figures, so I'm getting a compilation timeout Can I externalise my figures?
The output-from-other-project solution
If you create a separate project that just contains the figure, you can include the output of the figure in your original project by going to its project menu, selecting Add files…
, and then choosing Output from another project
.
That way, you only have to compile the complicated figure once, and then you can include the resulting pdf as a normal figure in your main project.
The tikz-external solution
It is now possible to use the tikz external
library to cache tikz drawings:
\usetikzlibrary{external}
\tikzexternalize[prefix=tikz/]
Note that the \tikzexternalize
command must be given in the main .tex file of the project, for tikz-externalization to work on Overleaf.
You will then need to create a tikz
folder in your project. For this to work on Overleaf, the folder you create needs to have a (dummy) file in it—for example, you can add a blank foo.txt
file in the tikz
folder.
As the externalised tikz PDFs are considered as output files, you will not see them show up in the file list, but they are indeed present within the project.
There're just too many of them!
However, if your drawings are too complex and there are too many of them, you will still get a timeout the first time the externalised files are generated. Building your project incrementally (by commenting different chunks of your project) may help, but bear in mind that all generated files are garbage collected at fixed intervals on the servers. Your project may then fail to compile when you next log in, and you'd have to re-generate them all incrementally again.
As a workaround, you can generate the files on a local machine first, by downloading your project and compiling it on your own local machine. After the compile completes, you should see the tikz
folder containing .pdf
, .md5
, .dpth
and .dpth
files for each of your tikz drawings. If you then upload these files to your Overleaf project's tikz
folder, your project will then use these files directly, and compilation should be fairly fast. These files won't be deleted by the server, as uploaded file are never garbage-collected.
A caveat: if you change your tikz code in future, you may have to delete the corresponding files in the tikz
folder first, so that Overleaf can generate and use a new version. Alternatively, you can re-generate the files on your machine, and re-upload them to Overleaf. Remember that you need to replace all the .pdf
, .md5
, .dep
and .dpth
for that particular tikz drawing. On Overleaf v2, these files must be prefixed with output, instead of the filename of your .tex.
Overleaf guides
- Creating a document in Overleaf
- Uploading a project
- Copying a project
- Creating a project from a template
- Including images in Overleaf
- Exporting your work from Overleaf
- Working offline in Overleaf
- Using Track Changes in Overleaf
- Using bibliographies in Overleaf
- Sharing your work with others
- Debugging Compilation timeout errors
- How-to guides
LaTeX Basics
- Creating your first LaTeX document
- Choosing a LaTeX Compiler
- Paragraphs and new lines
- Bold, italics and underlining
- Lists
- Errors
Mathematics
- Mathematical expressions
- Subscripts and superscripts
- Brackets and Parentheses
- Fractions and Binomials
- Aligning Equations
- Operators
- Spacing in math mode
- Integrals, sums and limits
- Display style in math mode
- List of Greek letters and math symbols
- Mathematical fonts
Figures and tables
- Inserting Images
- Tables
- Positioning Images and Tables
- Lists of Tables and Figures
- Drawing Diagrams Directly in LaTeX
- TikZ package
References and Citations
- Bibliography management in LaTeX
- Bibliography management with biblatex
- Biblatex bibliography styles
- Biblatex citation styles
- Bibliography management with natbib
- Natbib bibliography styles
- Natbib citation styles
- Bibliography management with bibtex
- Bibtex bibliography styles
Languages
- Multilingual typesetting on Overleaf using polyglossia and fontspec
- International language support
- Quotations and quotation marks
- Arabic
- Chinese
- French
- German
- Greek
- Italian
- Japanese
- Korean
- Portuguese
- Russian
- Spanish
Document structure
- Sections and chapters
- Table of contents
- Cross referencing sections and equations
- Indices
- Glossaries
- Nomenclatures
- Management in a large project
- Multi-file LaTeX projects
- Hyperlinks
Formatting
- Lengths in LaTeX
- Headers and footers
- Page numbering
- Paragraph formatting
- Line breaks and blank spaces
- Text alignment
- Page size and margins
- Single sided and double sided documents
- Multiple columns
- Counters
- Code listing
- Code Highlighting with minted
- Using colours in LaTeX
- Footnotes
- Margin notes
Fonts
Presentations
Commands
Field specific
- Theorems and proofs
- Chemistry formulae
- Feynman diagrams
- Molecular orbital diagrams
- Chess notation
- Knitting patterns
- CircuiTikz package
- Pgfplots package
- Typing exams in LaTeX
- Knitr
- Attribute Value Matrices
Class files
- Understanding packages and class files
- List of packages and class files
- Writing your own package
- Writing your own class
- Tips