I am attempting to put together a paper to submit to APS, for which I am using ReVTeX 4.1. I would like to include figures as separate files via the standalone package, and have the option to build them as pdfs with the same size as seen in the final document.
To do this I tried to use the standalone class with the class option class=revtex4-1 and within the main document use the \includestandalone[mode=buildnew] macro. This fails as pdflatex seems to get stuck in an infinite loop building a larger and larger pdf document of the standalone file.
Here's a MWE. Consider a file main.tex
\documentclass[aps,prl,10pt]{revtex4-1}
\usepackage[subpreambles=true]{standalone}
\begin{document}
\includestandalone[mode=buildnew]{sketch}
\end{document}
And a file sketch.tex
\documentclass[class=revtex4-1,aps,prl,10pt]{standalone}
\begin{document}
Test
\end{document}
And compile via the command
pdflatex --shell-escape main.tex
edit: I upgraded to TeXlive 2016 and now I cannot compile standalone documents with lualatex, it gives the following error in the log file.
! Bad number (18).
\sa@buildgraphic #1->\ifeof 18
\PackageError {standalone}{Shell escape neede...
l.6 \includestandalone[mode=buildnew]{sketch}
Since I expected to read a number between 0 and 15,
I changed this one to zero.
! Package standalone Error: Shell escape needed to create graphic! Use the '-sh
ell-escape' option..
See the standalone package documentation for explanation.
Type H <return> for immediate help.
...
l.6 \includestandalone[mode=buildnew]{sketch}
This error message was generated by an \errmessage
command, so I can't give any explicit help.
Pretend that you're Hercule Poirot: Examine all clues,
and deduce the truth by order and method
\RequirePackage{luatex85}prior to\documentclassto compile astandaloneclass file with LuaTeX from TL 2016. For portability, wrap it in a conditional check:\IfFileExists{luatex85.sty}{\RequirePackage.... – cfr Dec 04 '16 at 01:56! Bad number (18). \sa@buildgraphic #1->\ifeof 18 \PackageError {standalone}{Shell escape neede...– stephematician Jan 31 '17 at 13:22revtex. Can you not specify the class forstandalone? Will it make any difference to the graphic? – cfr Jan 31 '17 at 17:05class=revtex4.1. It seems to be standalone documents withclass=revtex4.1that produces errors. The error will vary by compiler. lualatex gives me the above error (which is related to the changed in TL16), pdflatex and latex will fail to build the standalone components as described in the OP. – stephematician Feb 01 '17 at 06:30standaloneversion v1.3a 2018-03-26 fixes the problems with current LuaTeX versions. – Martin Scharrer Mar 27 '18 at 17:54