Is there any way to externalise a chemfigscheme with tikz?
At the moment a good fix to externalise simple chemfig pictures is to place them inside a \begin{tikzpicture}...\end{tikzpicture}environment. This can be done automatically, as discussed here.
I am aware that arrows drawn with \chemmove won't work, as per this answer, but I am hoping to find a way to externalise simple schemes, like the one below.
This is my (updated) MWE:
\documentclass{article}
\usepackage{chemfig}
\usetikzlibrary{external}
\tikzexternalize
\begin{document}
\begin{figure}
\centering
\begin{tikzpicture}
\schemestart
\chemfig{A}\arrow{->[\scriptsize above]}\chemfig{B}
\schemestop
\end{tikzpicture}
\caption{}
\end{figure}
\end{document}
Interestingly, disabling tikzexternalbefore schememestartand re-enabling it immediately afterwards generates the corresponding external figure only for 'A'. Adding a second \tikzexternalenablegenerates a picture also for B. See below:
\begin{figure}
\centering
\tikzexternaldisable
\schemestart
\tikzexternalenable
\chemfig{A}\arrow{->[\scriptsize above]}\tikzexternalenable\chemfig{B}
\schemestop
\caption{}
\end{figure}
Edit: it turned out my MWE was too minimal to reproduce the issue. Here's a list of simple things I found originate errors. I suspect they can be easily fixed.
My arrows are redefined so as to automatically print out label in
scriptsize(now triggered manually in the updated MWE).This, however, gives the following error:
TeX capacity exceeded, sorry [input stack size=5000]. \pgf@selectfontorig ->\pgf@selectfontorig
\nullfontThat is true any time the font size or weight is varied, anywhere in between
\schemestartand\schemestopwhen in a\tikzpictureenvironment. For example,\chemnum's standard\cmpd{name}gives a similar error because the compound's label is printed as\textbf{label}. Wrapping the incriminated text in brackets doesn't fix it.\parboxand\mboxdon't work, possibly because they'd be nested environments?- Bonus: It would be a lifesaver if all my schemes could be redefined a posteriori to be wrapped in
tikzpicture, as it was done for\chemfigin the answer linked above.
\schemestart .. \schemestopwith\begin{tikzpicture} ... \end{tikzpicture}, the figure is externalized correctly. What are you looking for? – wimi Nov 18 '19 at 19:06