以下代码演示了两种类型的错误,我认为它们本质上是相同的。代码应按原样格式化;现在删除 \usepackage{semantic} 前面的 %。重新格式化无法生成 PDF 文件。现在重新注释 \usepackage{semantic} 并取消注释 \usepackage{titling}。重新格式化会导致标题中的脚注错误。不幸的是,我的文档中需要这两个包。
\documentclass[book]{combine}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{filecontents}
\usepackage{alltt}
%\usepackage{semantic}
%\usepackage{titling}
% The input articles
\begin{filecontents*}{inputDoc1.tex}
\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{alltt}
\@ifclassloaded{combine}
{\let\@begindocumenthook\@empty}
{}
\makeatother
\begin{document}
\title{First article\footnote{my footnote}}
\author{Author of first article}
\maketitle
\section{first section}
\blindtext[3]
\begin{alltt} \(10\sp{-6}\) \end{alltt}\end{document}
\section{Second section}
\end{document}
\end{filecontents*}
\begin{filecontents*}{inputDoc2.tex}
\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{alltt}
\@ifclassloaded{combine}
{\let\@begindocumenthook\@empty}
{}
\makeatother
\begin{document}
\title{Second article}
\author{Author of second article}
\maketitle
\section{first section}
\blindtext[1]
\begin{alltt}
\textbf{deterministic} \textbf{assume}(|A - A'| < \(10\sp{-6}\) and
|B - B'| < \(10\sp{-6}\)) \{
C = parallel_matrix_multiply_float(A, B);\vspace{3pt}
\} \textbf{assert}(|C - C'| < \(10\sp{-6}\));
\end{alltt}
\end{document}
\end{filecontents*}
% Define abstract to be used in book class (or use report)
% http://tex.stackexchange.com/questions/51483/how-to-write-abstract-and-acknowledgement-in-book-format
% The main document
\begin{document}
\title{The collection}
\author{A. N. Editor}
\date{\today}
\maketitle
\chapter{First chapter}
\section{Introduction}
\ldots
\begin{papers}[]
\coltoctitle{First article}
\coltocauthor{Author of first article}
\import{inputDoc1}
\end{papers}
\chapter{Second chapter}
\section{Introduction}
\ldots
\begin{papers}[]
\coltoctitle{Third article}
\coltocauthor{Author of third article}
\import{inputDoc2}
\end{papers}
\end{document}
答案1
问题 1
如果您包含该titling
包,则会收到与标题中的脚注有关的错误。这与\footnote
命令“脆弱”有关。解决方法是将
\usepackage[stable]{footmisc}
在你的序言中。给出了解释这里。
使用
footmisc
带有包选项的包stable
— — 这会修改脚注,以便它们在移动参数中使用时会轻轻地、悄无声息地消失。”
问题 2
包中的错误根源semantic
是环境中的减号alltt
。正如 Herbert 解释的那样这里,
这是 的数学连字符定义和的包
semantic
处理之间的无限循环。\( ...\)
alltt
如果您使用 关闭数学连字符mathligsoff
,一切就都好了。
固定代码
\documentclass[book]{combine}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{filecontents}
\usepackage{alltt}
\usepackage{semantic} \mathligsoff
\usepackage[stable]{footmisc}
\usepackage{titling}
% The input articles
\begin{filecontents*}{inputDoc1.tex}
\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{alltt} \mathligsoff
\@ifclassloaded{combine}
{\let\@begindocumenthook\@empty}
{}
\makeatother
\begin{document}
\title{First article\footnote{my footnote}}
\author{Author of first article}
\maketitle
\section{first section}
\blindtext[3]
\begin{alltt} \(10\sp{-6}\) \end{alltt}\end{document}
\section{Second section}
\end{document}
\end{filecontents*}
\begin{filecontents*}{inputDoc2.tex}
\documentclass{article}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{alltt} \mathligsoff
\@ifclassloaded{combine}
{\let\@begindocumenthook\@empty}
{}
\makeatother
\begin{document}
\title{Second article}
\author{Author of second article}
\maketitle
\section{first section}
\blindtext[1]
\begin{alltt}
\textbf{deterministic} \textbf{assume}(|A - A'| < \(10\sp{-6}\) and
|B - B'| < \(10\sp{-6}\)) \{
C = parallel_matrix_multiply_float(A, B);\vspace{3pt}
\} \textbf{assert}(|C - C'| < \(10\sp{-6}\));
\end{alltt}
\end{document}
\end{filecontents*}
% Define abstract to be used in book class (or use report)
% https://tex.stackexchange.com/questions/51483/how-to-write-abstract-and-acknowledgement-in-book-format
% The main document
\begin{document}
\title{The collection}
\author{A. N. Editor}
\date{\today}
\maketitle
\chapter{First chapter}
\section{Introduction}
\ldots
\begin{papers}[]
\coltoctitle{First article}
\coltocauthor{Author of first article}
\import{inputDoc1}
\end{papers}
\chapter{Second chapter}
\section{Introduction}
\ldots
\begin{papers}[]
\coltoctitle{Third article}
\coltocauthor{Author of third article}
\import{inputDoc2}
\end{papers}
\end{document}