即使是最微不足道的例子也会失败。
这是主文件 test.tex:
\documentclass[10pt]{combine}
\usepackage{combinet}
\begin{document}
\pagestyle{combine}
\clearpage
\begin{papers}
\import{a1}
\end{papers}
\end{document}
要导入主文档的 tex 文件 a1.tex(在同一文件夹中):
\documentclass{article}
\author{Author}
\title{Title}
\begin{document}
\maketitle
\end{document}
无论我尝试什么,它都无法编译,并产生以下错误:
This is pdfTeX, Version 3.141592653-2.6-1.40.24 (MiKTeX 21.12) (preloaded format=pdflatex.fmt)
restricted \write18 enabled.
entering extended mode
(C:/Users/vince/tex/MLbook/test.tex
LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2021-11-22>
(C:\Users\vince\AppData\Local\Programs\MiKTeX\tex/latex/combine\combine.cls
Document Class: combine 2010/07/10 v0.7a collection of documents
(C:\Users\vince\AppData\Local\Programs\MiKTeX\tex/latex/graphics\keyval.sty)
(C:\Users\vince\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls
Document Class: article 2021/10/04 v1.4n Standard LaTeX document class
(C:\Users\vince\AppData\Local\Programs\MiKTeX\tex/latex/base\size10.clo)))
(C:\Users\vince\AppData\Local\Programs\MiKTeX\tex/latex/combine\combinet.sty)
! Extra \endgroup.
\document ->\endgroup
\let \mainjobname \jobname \def \c@lmainauxfile {\jobn...
l.4 \begin{document}
?
答案1
该解决方案依赖于 Peter Wilson 的回答(原始开发人员)\endgroup
在\c@ladocument
宏中添加了附加内容。
\documentclass{combine}
\usepackage{combinet}
\begin{filecontents*}{a1.tex}
\documentclass{article}
\author{Author}
\title{Title}
\begin{document}
\maketitle
\end{document}
\end{filecontents*}
% *********************************** added <<<<<<<<<<<<<
\makeatletter
\let\document\c@ladocument\begingroup%
\makeatother
% ***********************************
\begin{document}
\pagestyle{combine}
\clearpage
\begin{papers}
\import{a1}
\end{papers}
\end{document