for simple use I've written an environment wrapping the tikzpicture environment. So far no trouble. Now I realized I've got a huge amount of tikzpictures in my document and I've read once about tikz externalization, so I thought that would be a good idea. So I've got this code
\documentclass{article}
\usepackage{tikz}
% place in preamble and add "--shell-excape" to latex-run (for cluttex --shell-escape)
\usetikzlibrary{external}
\tikzexternalize[prefix=figures/] % activate and define figures/ as cache folder
\newenvironment{step}{
\newcommand{\myCmd}[1]{\node[draw] {##1};}
\tikzpicture[]
\scope[local bounding box=output]
}{
\endscope
\endtikzpicture
}
\begin{document}
\begin{step}
\myCmd{lore ipsum}
\end{step}
\end{document}
which spits out
(/usr/share/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg)))
Runaway argument?
! File ended while scanning use of \tikzexternal@laTeX@collect@until@end@tikzpi
cture.
<inserted text>
\par
<*> main.tex
?
I think this ia related to 53.2 (Requirements) of the tikz manual. Is there a way for me to still use externalization but don't give up the simplicity of the environment declaration?
(on each picture I draw some nodes in the beginning, put all of the things from inside my step
env in a tikz-scope
and draw some nodes after the termination of the scope. Replacing all step
-env occurrences with that declaration (which actually is always the same) would be ...unpleasant)
EDIT: Some way to e.g. use \begin{tikzpicture}[myTikz]
which in turn will automatically put my things at the beginning/end of the tikzpicture content would suffice too, but I'm not sure if there's a way to do that with tikz.
tikzpicture
environment itself.tex.sprint
back. (not necessary in this case, but that would be the easiest one that works with verbatim or catcode-changing environments)