I'm trying to figure out why the externalization of tikzpictures does not work any more (used to).
I have the following in the preamble:
\usepgfplotslibrary{external}
% \tikzexternalize[prefix=fig/ext/]
If I uncomment the second (to externalize all the plots and figures) line all the figures fail the externalization.
If the line is commented out (no externalization), the final pdf is generated without errors.
Unfortunately, I cannot recognize useful elements in the externalized log files.
Which is the best way to troubleshoot this? I suspect packages incompatibilities.
Can't post a MWE right away (will write one as soon as I am able to),
Here's a not-so-minimal non WE, reproducing the behavior described above:
\RequirePackage[hyphens]{url}
\RequirePackage[final]{graphicx}
\documentclass[a4paper,twoside,openright,final]{memoir}
\usepackage{filecontents,lipsum}
\begin{filecontents*}{packages.tex}
\usepackage{calc}
\usepackage{ifoddpage}
\usepackage[osf]{mathpazo}
\linespread{1.1}
\usepackage[scaled]{helvet}
\usepackage{courier}
\normalfont
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[italian,english]{babel}
\usepackage[obeyFinal]{todonotes}
\usepackage{pgfplots,tikzscale}
\pgfplotsset{compat=newest}
\usepgfplotslibrary{units}
\usetikzlibrary{plotmarks,positioning,chains,fit,shapes,calc}
\usepackage{array,booktabs,tabularx}
\usepackage{mdframed,colortbl}
\usepackage{multirow}
\usepackage{pdflscape,rotating}
\usepackage[shortcuts,noredefwarn,toc,symbols,acronym,nonumberlist]{glossaries}
\usepackage{amsfonts,amsmath,amssymb,amsthm,bm,bigints}
\usepackage{dsfont}
\usepackage{siunitx}
\usepackage{xspace}
\usepackage{csquotes}
\usepackage{soul}
\usepackage[vlined,ruled,commentsnumbered,linesnumbered]{algorithm2e}
\usepackage[%
bibstyle = ieee,
citestyle = numeric,
isbn = true,
doi = false,
sorting = nty,
% sorting = none,
% sorting = debug,
url = false,
defernumbers = true,
bibencoding = utf8,
backend = biber
]{biblatex}
% % do not externalize todonotes' graphics
\usepackage{letltxmacro} % https://tex.stackexchange.com/a/115095/177
\LetLtxMacro{\oldmissingfigure}{\missingfigure}
\renewcommand{\missingfigure}[2][]{\tikzexternaldisable\oldmissingfigure[{#1}]{#2}\tikzexternalenable}
\LetLtxMacro{\oldtodo}{\todo}
\renewcommand{\todo}[2][]{\tikzexternaldisable\oldtodo[#1]{#2}\tikzexternalenable}
\usepackage[pdfusetitle,final]{hyperref}
\hypersetup{
% bookmarksopen=true
hidelinks,
% colorlinks,
pdfinfo={
% Author={Alessandro Cuttin},
Subject={PhD Thesis},
% Title={Title to be defined},
}
}
\usepackage[open,openlevel=1]{bookmark}
\usepackage[noabbrev,capitalise]{cleveref}
\end{filecontents*}
\begin{filecontents*}{other-commands.tex}
\hyphenation{a-chieved mil-li-me-ter-wave na-no-sat-el-lite}
\newcommand{\Rho}{\textrm{P}}
\newcommand{\matlab}{Matlab\textsuperscript\textregistered\xspace}
\newcommand{\logand}{$\wedge$\xspace}
\newcommand{\logor}{$\vee$\xspace}
\newcolumntype{m}{>{$}c <{$}}
% adapted from https://tex.stackexchange.com/a/36003/177
\usepackage{ifmtarg}% http://ctan.org/pkg/ifmtarg
\makeatletter
\newcommand{\algtoprule}{\hrule height.8pt depth0pt \kern2pt} % Caption top horizontal rule+skip
\newcommand{\algmidrule}{\kern2pt\hrule\kern2pt} % Caption bottom (or mid) horizontal rule+skip
\newcommand{\algbottomrule}{\kern2pt\hrule\relax}% Algorithm bottom rule
\newcommand{\algcaption}[2][]{%
\refstepcounter{algorithm}%
\@ifmtarg{#1}
{\addcontentsline{loa}{figure}{\protect\numberline{\thealgorithm}{\ignorespaces #2}}}
{\addcontentsline{loa}{figure}{\protect\numberline{\thealgorithm}{\ignorespaces #1}}}%
\algtoprule
\textbf{\fname@algorithm~\thealgorithm}\ #2\par % Caption
\algmidrule
}
\makeatother
% https://tex.stackexchange.com/a/68310/177 and https://tex.stackexchange.com/a/10131/177
\makeatletter
% \let\runauthor\@author
\let\runtitle\@title
\makeatother
\DeclareMathOperator\erf{erf}
\DeclareMathOperator\erfc{erfc}
\newtheorem{theorem}{Proposition}
\newtheorem{corollary}{Corollary}[theorem]
\end{filecontents*}
\begin{filecontents*}{lit-rev.tex}
\chapter{Modern random access methods}
\label{sec:mod-ran-acc-met}
\lipsum
\begin{figure}[tb]
\centering
\subbottom[ \label{fig:aloha-max-thr}]{%
\includegraphics[width=0.475\textwidth]{aloha-throughput.tikz}
}
\caption{The Aloha System: \subcaptionref{fig:aloha-pac-sch} schematic of the Aloha communication multiplexing \cite{Abramson1970}, and \subcaptionref{fig:aloha-max-thr} network throughput.}
\label{fig:lit-rev-alo}
\end{figure}
\end{filecontents*}
\begin{filecontents*}{aloha-throughput.tikz}
\begin{tikzpicture}
\begin{axis}[
ymax = 0.2,
ymin = 0,
xmin = 0,
xmax = 2,
xlabel={$G$},
ylabel={$S$},
ytick distance = 0.1,
grid = major
]
% throughput upper bound of Aloha
\addplot [
domain=0:2,
samples=40,
]
{x * exp(-2*x};
\end{axis}
\end{tikzpicture}
\end{filecontents*}
\input{packages}
\input{other-commands}
% \input{set/tufte-like-plots}
% toggle the following lines to prevent tikz plots compilation every time - always use after loading pgfplots package
\usepgfplotslibrary{external}
\tikzexternalize
% memoir settings
\setsecnumdepth{subsection}
\settocdepth{subsection}
\newsubfloat{figure}% Create subfloat in figure environment
\author{myname}
\title{mytitle}
\loadglsentries{example-glossaries-brief.tex}
\makeglossaries
\glstoctrue
\ifdraftdoc
% special things for a draft document
\usepackage{showkeys}
\linespread{1.3} % more linespread for showkeys
\makeevenfoot{simple}{}{\texttt{Draft: \today}}{ }
\makeoddfoot{simple}{}{\texttt{Draft: \today}}{}
% \usepackage{showframe}
\else
% perhaps special things for a non-draft document
\fi
% \includeonly{con/annotations,con/lit-rev,con/introduction,con/jsac}
\begin{document}
\pagestyle{simple}
\frontmatter
\cleardoublepage
\tableofcontents
\glsunsetall
\cleardoublepage
\listoffigures
\cleardoublepage
\listoftables
\printglossaries
\glsresetall
\mainmatter
\part{Background}
\include{lit-rev}
\end{document}
It seems that externalized figures are not created. I suspect a package incompatibility, and will try to comment out the packages one by one.
\end{document}and place it randomly in your document. If compiles move it further, otherwise move it up until you find where it chokes. Get that bit and make an example out of it. You will probably solve it before you bring it over here. – percusse Dec 27 '17 at 09:13Runaway argument?is certainly a problem and should be corrected but it is unclear if is also the source of your other problem. – Ulrike Fischer Dec 27 '17 at 15:59.logfile and search for any related warnings. Perhaps the-shell-escapefeature is disabled or disallowed the operation. – Christian Feuersänger Dec 28 '17 at 11:23-shell-escapeis enabled in the settings:"build_arguments": ["-shell-escape"],– Alessandro Cuttin Dec 28 '17 at 20:58\tikzexternalizewith thecalcpackage and/or the\settocdepthcommand was the problem. – Alessandro Cuttin Feb 13 '18 at 18:27