0

I am using the Texmaker latex editor, and get the following error when trying to use the Standalone package: ! Extra }, or forgotten \endgroup.

I am simply following the overleaf tutorial on the standalone package to make a multi-file document. I have copied their code exactly, and set up the files accordingly. When I compile both the main document and the `introduction' I get the above error. It loads fine in the overleaf editor, but not in Texmaker. I get the same issue on Ubuntu and Windows. Any help is appreciated.

Main file

\documentclass{article}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}

\title{Standalone package example}
\author{Overleaf}
\date{May 2021}

\begin{document}

\maketitle

\section{First section}
\import{sections/}{introduction}

\end{document}

Introduction file

   \documentclass[class=article, crop=false]{standalone}
\usepackage[subpreambles=true]{standalone}
\usepackage{import}
\usepackage{blindtext}

\begin{document}
A TikZ figure will be rendered below this line

\begin{figure}[ht]
\centering
\subimport{diagrams/}{diagram.tex}
\label{fig:tikzexample}
\caption{A nice simple diagram}
\end{figure}

\blindtext
\end{document}

diagram file

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}[
roundnode/.style={circle, draw=green!60, fill=green!5, very thick, minimum size=7mm},
squarednode/.style={rectangle, draw=red!60, fill=red!5, very thick, minimum size=5mm},
]
%Nodes
\node[squarednode]      (maintopic)                              {2};
\node[roundnode]        (uppercircle)       [above=of maintopic] {1};
\node[squarednode]      (rightsquare)       [right=of maintopic] {3};
\node[roundnode]        (lowercircle)       [below=of maintopic] {4};

%Lines
\draw[->] (uppercircle.south) -- (maintopic.north);
\draw[->] (maintopic.east) -- (rightsquare.west);
\draw[->] (rightsquare.south) .. controls +(down:7mm) and +(right:7mm) .. (lowercircle.east);

\end{tikzpicture}
\end{document}

The files are

./Latex/main.tex

./Latex/sections/introduction.tex

./Latex/sections/diagrams/diagram.tex

2
  • 6
    There is 99% certainty that you did something wrong. If we follow the same tutorial, we will not do your mistake so we cannot advice you where the problem is. Because you didn't show your problem, you didn't show your code. Give your code in your question which generates the mentioned error message. Without this, it is impossible to help you.
    – wipet
    Oct 28, 2022 at 5:19
  • Exact same problem. It occurs in Line 555 of the .sty pack I have tried the exact same example and with my own documents, always get the same error.
    – RSVUK
    Nov 14, 2022 at 14:24

1 Answer 1

1

You just need to add the relevant options to the \documentclass of your diagram file:

\documentclass[class=article, crop=false]{standalone}

Having done that, after recompilation from scratch, I get the following, seemingly correct, output:

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .