Skip to main content
50 votes
Accepted

How to externalize TikZ pictures

There are two questions hidden in your post, they have two answers that are basically orthogonal: Speeding up compilation by using tikzexternalize: You don't actually have to write them into separate ...
sheß's user avatar
  • 3,702
18 votes
Accepted

Error using tikz externalize: can't write md5 file

Your issue occurs because you are using the flag -output-directory=build when running pdflatex. In order to makes explanations less ambiguous, let's rename folders: you are using the flag -output-...
ebosi's user avatar
  • 11.8k
13 votes
Accepted

Cannot run tikz externalize with lualatex but it used to work

You need the shellesc package \documentclass{article} \usepackage{shellesc} % main document, called main.tex \usepackage{tikz} \usetikzlibrary{external} \tikzexternalize % activate! \begin{document} \...
Ulrike Fischer's user avatar
11 votes
Accepted

Problems with tcolorbox and TikZ external

The reason for the problem is that the boxed title is a tcolorbox itself, but with a higher layer number. For this higher layer, the global setting of shield externalize is reset to the default, i.e. ...
Thomas F. Sturm's user avatar
9 votes
Accepted

with tikzexternalize, how to name the images with the current name of the imported file

For this to work, the code for the picture must actually be in an external file. Otherwise, the file name is identical with the name of the main file, which won't work. You can create such files on-...
cfr's user avatar
  • 212k
9 votes

What is the (relevant!) difference between \file_input:n and \input? Or has something else changed?

The approach in expl3 is that each command has clear, defined semantics independent of other code loaded. In contrast, the LaTeX document command \input is (as observed in the question) modified by ...
Joseph Wright's user avatar
  • 263k
9 votes

How to externalize TikZ pictures

I prefer a manual way to externalize TikZ pictures. This gives you full control and does not require any shell escape huzzle. Put every TikZ image in a file of its own (good for keeping track of your ...
usr1234567's user avatar
8 votes
Accepted

LuaLaTex fails on Tikzexternalize on very easy MWE

No doubt the packages will get updated to current luatex at some point, but until then: \RequirePackage{luatex85,shellesc} \documentclass{article} \usepackage{pgfplots} \usepgfplotslibrary{...
David Carlisle's user avatar
8 votes
Accepted

Tikz package "external" causes an unclosed tikzpicture@tcb@hooked environment

If the externalization library of tikz is used AND externalization is enabled globally AND tcolorbox is used with options like enhanced from its skins library which uses tikz, then the externalization ...
Thomas F. Sturm's user avatar
8 votes
Accepted

How to prevent tikzexternalize to generate files in current directory?

I think the most straightforward way to do this is not to set prefix at all but to instead do two things. Ensure that --output-directory is passed to the compiler when it is run by the ...
cfr's user avatar
  • 212k
7 votes

tikzexternalize only (or not) for flagged graphics

As an alternative to switching TikZ externalization off and on again, I ended up with using \usetikzlibrary{external} \tikzexternalize % activate! \tikzset{external/only named=true} and manually ...
F1iX's user avatar
  • 368
7 votes
Accepted

Loading tcolorbox with the minted option breaks tikzexternalize and results in compilation error with makeglossaries

The problem can be pulled down to the following example. \documentclass{book} \newwrite\blubi \newwrite\blubii \newwrite\blubiii \newwrite\blubiv \newwrite\blubv \newwrite\blubvi \newwrite\blubvii \...
Ulrike Fischer's user avatar
6 votes

Are the TikZ libraries cd and external incompatible with one another?

I had to adjust Marco Varisco's answer, in order to get the figure automatically rebuilt on change. Furthermore, I let the baseline of the artificial tikzpicture be on the height of the tikzcd's ...
Thorsten's user avatar
  • 332
6 votes
Accepted

printindex and tikzexternalize won't create a pdf-file for the tikz-image

The externalize library redefines \makeindex and related commands in a way that's incompatible with imakeidx. You can fix the wrong definitions by changing them (to be no-op, of course) in the ...
egreg's user avatar
  • 1.2m
6 votes
Accepted

About use of \usepgfplotslibrary{external} and \tikzexternalize in Overleaf

The invocation of the standalone package needs to have the option mode=buildnew: \usepackage[mode=buildnew]{standalone} Without that option, standalone doesn't actually accomplish the task given in ...
John Collins's user avatar
  • 11.4k
5 votes

Externalize PGF

I had the same problem, and wrote my own package to deal with it automatically. You can find it here. If you don't want to install the package, you can essentially put this code into your preamble: \...
Dion's user avatar
  • 223
5 votes
Accepted

pgfplots external vs TikZ external

This quote from section 5.6 Image externalization of the pgfplots manual probably answers your question: The external library has been written by Christian Feuersänger (author of pgfplots). It ...
Torbjørn T.'s user avatar
5 votes
Accepted

AucTeX mistakes Tikz warning as error

Exclamation marks are usually employed to denote errors, rather than warnings. Consider for example this document: \documentclass{article} \usepackage{does-not-exist} \begin{document} Hello world! \...
giordano's user avatar
  • 8,526
5 votes
Accepted

Presumed incompatibility between pgfplots-TikZ and pdflscape: externalization fails on all images

It is not a pgfplots problem and also not directly cause by pdflscape. Imho it is a problem of tikzscale. tikzexternalshared.code.tex calls at the end in \AtBeginDocument (after tikzscale has added ...
Ulrike Fischer's user avatar
5 votes
Accepted

Tikz externalize sub-folders

You can use \tikzsetexternalprefix{<file name prefix>} in the middle of document, and it can be used multiple times. It is documented in pgfmanual v3.1.8, sec. 52.4.2 Customizing the Generated ...
muzimuzhi Z's user avatar
  • 27.2k
5 votes
Accepted

tex4ht: using tikzexternalize still includes svg, not png

This is caused by the fact that TeX4ht now uses the pgfsys-dvisvgm4ht.def driver by default. It doesn't support the external library. Here is the version that fixes this issue: % Copyright 2021 by ...
michal.h21's user avatar
  • 51.8k
5 votes

TikZ-externalizing a PGF image (e.g. from matplotlib)

The error comes from having a pgfpicture environment inside a tikzpicture environment. Luckily, you can circumvent this by defining a node, i.e. \begin{tikzpicture} \node {\input{img}}; \end{...
gasteigerjo's user avatar
4 votes
Accepted

Configure vim-latex suite to use treat .tikz files as ordinary .tex files

Add the following lines to the ~/.vimrc file (or create it if doesn't exist): syntax on filetype on au BufNewFile,BufRead *.tikz set filetype=tex
alwaysask's user avatar
  • 2,268
4 votes
Accepted

Errors when including a Tikz figure in a beamer presentation

As requested, I'm posting my comment as an answer. Some dimensions and coordinates in example.tikz are expressed in terms of the two lengths \figurewidth and \figureheight, but those are not defined ...
LucaD's user avatar
  • 1,631
4 votes
Accepted

Conflict: TikZ externalisation, local bounding box with empty name, forked edges and multi-line nodes in Forest

Stripping down OP's MWE even further, we see that the following code produces the same error. \documentclass{article} \usepackage{forest} \begin{document} \begin{tikzpicture} \begin{scope}[local ...
Sašo Živanović's user avatar
4 votes

Disabling main pdf with TikZ externalize

You can call pdflatex with the --draftmode switch. pdflatex --shell-escape --draftmode mainfile then no output pdf is produced.
Ulrike Fischer's user avatar
4 votes
Accepted

tikzexternalize and includegraphics that containning a standalone file

Since you already include the standalone package in your main file, you can use \includestandalone. It takes the same options as \includegraphics and some additional ones. Most important here is the ...
Mike's user avatar
  • 8,704

Only top scored, non community-wiki answers of a minimum length are eligible