I am preparing the final version of a paper to be processed (and edited) by a publisher. This means converting the source to the publisher style, and removing dependency on certain packages.
One of those packages is tikz, and the source contains quite a few tikz figures. It's not so hard to compile all the figures into pdfs using the tikz/externalize library, but this does not remove the dependency on the package since tikz takes care of the inclusion.
Basically, I would like to convert a document:
\documentclass{acmart}
\usepackage{tikz}
%\usetikzlibrary{external}
%\tikzexternalize[prefix=figures/]
\begin{document}
\title{A paper with tikz figures}
\author{Jakub Opršal}
\email{jakub@example.com}
\maketitle
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\begin{figure}
\begin{tikzpicture}
\draw (0,0) circle (1);
\end{tikzpicture}
\caption{A circle}
\end{figure}
\end{document}
Into:
\documentclass{acmart}
\begin{document}
\title{A paper with tikz figures}
\author{Jakub Opršal}
\email{jakub@example.com}
\maketitle
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
\begin{figure}
\includegraphics{figures/stack-exchange-figure0.pdf}
\caption{A circle}
\end{figure}
\end{document}
While compiling all tikz figures in the process (which not such a big issue, since it is enough to compile the original document once).
Do you know of some efficient way to replace the tikz figures in the code by the corresponding graphics include?
\includegraphicsas you suggest. That is just an editing question, so depends on your editor how easy that is, but I assume in a journal submission you don't have thousands of these to edit. – David Carlisle Mar 18 '21 at 14:14ifthenpackage is an option? Using the tikzcode in the one case and the\includegraphicsin the other? You would only have to change the value of the switch before submitting. – Markus G. Mar 18 '21 at 17:08externallibrary can be switched out for thetikzexternalpackage that only imports the pdfs where\tikzandtikzpictures are (without having to change the actual document (just the preamble). Is this what you're after? Thetikzexternal.stycan be simply placed besides the main tex file. – Qrrbrbirlbel Oct 18 '22 at 13:24tikzexternal. I need a tool that changes the TeX source. – Jakub Opršal Oct 19 '22 at 14:05