我正在使用 Texmaker latex 编辑器,在尝试使用独立包时出现以下错误:!Extra },或忘记了 \endgroup。
我只是遵循关于独立包的 overleaf 教程制作多文件文档。我完全复制了他们的代码,并相应地设置了文件。当我编译主文档和“介绍”时,我得到了上述错误。它在 overleaf 编辑器中加载正常,但在 Texmaker 中加载不正常。我在 Ubuntu 和 Windows 上遇到了同样的问题。任何帮助都值得感激。
主文件
\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}
介绍文件
\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}
图表文件
\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}
这些文件是
./Latex/main.tex
./Latex/sections/introduction.tex
./Latex/sections/diagrams/diagram.tex