MartinScharrer / standalone

A LaTeX class and package is provided which allows LaTeX diagrams or other LaTeX code to be compiled standalone or as part of a main document. Special support for pictures with beamer overlays is also provided.
LaTeX Project Public License v1.3c
10 stars 3 forks source link

incompatibility with subfiles package #9

Open Axolord opened 1 year ago

Axolord commented 1 year ago

Using the standalone package in conjunction with the subfiles package, errors occur in complexer examples. Here is a minimal setup, producing an error:

test.tex:

\documentclass{article}
\usepackage{standalone}
\usepackage{tikz}
\usepackage{subfiles}

\begin{document}

Main document

\subfile{test2.tex}

\end{document}

test2.tex

\documentclass[test.tex]{subfiles}
\begin{document}

Hello World! from the subfile

\begin{figure}
  \input{fig}
\end{figure}

\end{document}

fig.tex

\documentclass{standalone}

\usepackage{tikz}

\begin{document}
\begin{tikzpicture}
  \node[fill=yellow] {tikz};
\end{tikzpicture}
\end{document}

error:

! Extra }, or forgotten \endgroup.
\@endfloatbox ...pagefalse \outer@nobreak \egroup 
                                                  \color@endbox 
l.8 \end{figure}

?  
)
! Missing } inserted.
<inserted text> 
}
l.10 \subfile{test2.tex}

it seems to have something todo with the figure environment, but I am not sure, since without it it works fine. Same error with pdflatex or lualatex.