I am trying to use Martin Scharrer's nifty standalone
package to put a Beamer animation into a standalone file. Here is a minimal example that demonstrates the error I am running into. The subfile, creatively named subfile.tex
, that I am using is:
\documentclass[beamer]{standalone}
\usepackage{tikz}
\newcommand*{\mytext}{Hello world!}
\begin{document}%
\begin{standaloneframe}{Subfile}
\begin{tikzpicture}
\onslide<+->{\draw[red] (0,0) circle (3pt);}
\onslide<+->{\draw[blue] (1,1) circle (3pt);}
\onslide<+->{\draw[green] (2,0) circle (3pt);}
\onslide<+->{\node at (1,2) {\mytext};}
\end{tikzpicture}
\end{standaloneframe}%
\end{document}
On its own, this subfile compiles as expected.
The main file, named mainfile.tex
, that I am using is:
\documentclass{beamer}
\usepackage[subpreambles=true]{standalone}
%\usepackage{tikz}
%\newcommand*{\mytext}{Hello world!}
\begin{document}
\begin{frame}{Main file}
\input{subfile.tex}
\end{frame}
\end{document}
When I try to compile this main file with pdflatex mainfile.tex
, I get an error:
Runaway argument?
%\begin {standaloneframe}{Subfile}\begin {tikzpicture}\onslide <+->{\draw \ETC.
! File ended while scanning use of \sa@@endinput.
When I try a second run of pdflatex mainfile.tex
, this runaway argument error disappears, but another error takes its place: Extra }
, or forgotten \endgroup
. I use X
at the prompt to quit compilation after the error. Subsequent runs of pdflatex mainfile.tex
continue to give this missing \endgroup
error.
I have noticed a few things:
If I remove the
subpreambles=true
option and uncomment the two lines of copied preamble (\usepackage{tikz}
and\newcommand*{\mytext}{Hello world!}
), this modified main file compiles as expected.However, if I keep the
subpreambles=true
option but uncomment the two lines of copied preamble, I get the same error when I try to compile. This suggests that something goes wrong in thesubpreambles=true
option.
Does anyone know what I am doing wrong here? In his comment below, Martin Scharrer mentions that multiple compilation runs work for him. I'm not sure why I seem to be unable to get multiple compilation runs to work for me.
standalone
. Thebeamer
support isn't that great I have to confess. I will have a closer look at this. Feel free to report such issues at bitbucket.org/martin_scharrer/standalone/issues. – Martin Scharrer♦ Sep 13 '12 at 17:07pdflatex -interaction=nonstopmode mainfile
as the first run, then subsequent runs are performed regularly. – egreg Sep 14 '12 at 21:50standalone
(bitbucket.org/martin_scharrer/standalone). The error is caused by a clean-up macro which should end the reading of the subfile preamble once\begin{document}
is reached, but still has to discard everything in the same line of it. Having a%
after it is actually a bad idea, but the real problem seems to be the changed\endlinechar
. The new code resets it and discards anything verbatim to exclude any such issues. I will publish a bugfix release soon. – Martin Scharrer♦ Sep 14 '12 at 22:59standalone
which fixes this issue. I will also close this question as "too localized" (in time) as it is local practice for package bugs. – Martin Scharrer♦ Sep 15 '12 at 15:24standalone
works great! Thanks so much for your help! I wish I could give a bounty for your efforts. – Henry DeYoung Sep 15 '12 at 19:48