\documentclass[12pt,oneside]{book}
\usepackage{geometry}
\geometry{
a4paper,
total={160mm,234mm},
left=20mm,
right=20mm,
top=20mm,
bottom=20mm
}
\usepackage[X2,T2A,OT2]{fontenc}
\usepackage[english,russian,russian.ancient]{babel}
\usepackage{marvosym}
\usepackage{fontspec}
\usepackage{url,indentfirst}
\RequirePackage{color,graphicx}
\usepackage{xcolor,colortbl}
\usepackage{enumitem}
\usepackage{epigraph}
\usepackage{caption}
\usepackage{multirow}
\usepackage{tikz}
\usepackage{chngcntr}
\usepackage{xifthen}
\setlength{\epigraphwidth}{0.5\textwidth}
\usepackage{booktabs,tabularx}
\usepackage{xltabular}
\usepackage{changepage}
\usepackage{titlesec}
\newpagestyle{mystyle}{\setfoot[\thepage][][]{}{}{\thepage}}
\pagestyle{mystyle}
\usepackage{titlesec}
\usepackage[absolute]{textpos}
\usepackage{titlefoot}
\usepackage{verse}
\usepackage{catchfilebetweentags}
\usepackage[stable]{footmisc}
\counterwithout{footnote}{chapter}
\counterwithout{section}{chapter}
\titleformat{\section}
{\centering\bfseries}{\S~\thesection.}{1em}{}
\titleformat{\subsection}
{\centering}{\thesubsection.}{1em}{}
\newcommand{\quotes}[1]{,,#1''}
\begin{document}
\begin{xltabular}{\textwidth}{X | X }
cell1 & cell2\footnote{par1 par1par1 par1par1par1 par1 par1par1 par1 par1 par1 par1
par1 par1par1 par1par1par1 par1 par1-par1-par1 w par1 par1 par1 w par1par1par1par1par1 par1 par1 par1 par1 par1 www
par2 par2par2par2 par2par2 par2 par2 par2 par2
par2 par2 par2par2 par2 par2-par2-par2 w par2 par2 par2 w par2par2par2 par2 par2 par2 par2 par2 ww
}
\end{xltabular}
\end{document}
需要在脚注中插入新段落。为什么上面的代码在编译时会出错:
xelatex code.tex
>>>>
Runaway argument?
{par1 par1par1 par1par1par1 par1 par1par1 par1 par1 par1 par1 par1 pa\ETC.
! Paragraph ended before \@footnotetext was complete.
<to be read again>
\par
l.118 \end{xltabular}
答案1
这个错误是 longtable.sty 中的一个 bug,位于文件末尾附近,其中有
\def\LT@p@ftntext#1{%
应该改为
\long\def\LT@p@ftntext#1{%
为了快速解决问题,请将 longtable.sty 从 latex 文件路径复制到文档目录。对其进行编辑并进行上述更改。
答案2
在脚注中获取新段落的最简单方法是使用\endgraf
而不是空行或\par
。这是由 TeX 直接提供的,建议在TeXbook该\par
机制叠加了大量与简单的换行和缩进下一行无关的处理,因此产生了令人厌烦的错误。
我不会重复问题中的整个例子,只重复带有两段脚注的部分。
\begin{xltabular}{\textwidth}{X | X }
cell1 & cell2\footnote{par1 par1par1 par1par1par1 par1 par1par1 par1 par1 par1 par1
par1 par1par1 par1par1par1 par1 par1-par1-par1 w par1 par1 par1 w par1par1par1par1par1 par1 par1 par1 par1 par1 www\endgraf
%
par2 par2par2par2 par2par2 par2 par2 par2 par2
par2 par2 par2par2 par2 par2-par2-par2 w par2 par2 par2 w par2par2par2 par2 par2 par2 par2 par2 ww
}
\end{xltabular}
答案3
长篇文内脚注,尤其是那些跨越两段或多段的脚注,对读者来说价值颇为可疑。(我认为以下建议来自经济学家 Greg Mankiw:“首先,将所有非必要内容放入脚注中。然后,删除脚注。”)
如果您想保留充足的脚注材料,您可以通过用\\
(“双反斜杠”)替换全空行或将较长的两段脚注拆分为两个单独的脚注来“解决”您遇到的问题。第二种可能性如下所示。
不过,您可能想问问自己,您所做的是否在排版上合适。应该通过脚注传达什么信息?鉴于它们出现在表格中,脚注是否应该与表格在视觉上相关联,因此应将其放在表格底部而不是页面底部?如果确实如此,您可能需要考虑使用包及其threeparttable
宏\tnote
和tablenotes
环境。以下示例也探讨了这种可能性。
\documentclass[12pt,oneside]{book}
% [I've pared down the preamble as much as possible]
\usepackage{geometry}
\geometry{a4paper,total={160mm,234mm},margin=20mm}
\usepackage[english,russian,russian.ancient]{babel}
\usepackage{fontspec}
\usepackage{booktabs,tabularx,xltabular}
\usepackage[stable,multiple,bottom]{footmisc}
\usepackage[flushleft]{threeparttable}\renewcommand\TPTtagStyle{\textit} % italic footnote markers
\setlength\textheight{8cm}
\begin{document}
\begin{xltabular}{\textwidth}{| X | X |}
\hline
cell1 & cell2%
\footnote{par1 par1par1 par1par1par1 par1 par1par1 par1 par1 par1 par1 par1 par1par1 par1par1par1 par1 par1-par1-par1 w par1 par1 par1 w par1par1par1par1par1 par1 par1 par1 par1 par1 www}%
\footnote{par2 par2par2par2 par2par2 par2 par2 par2 par2 par2 par2 par2par2 par2 par2-par2-par2 w par2 par2 par2 w par2par2par2 par2 par2 par2 par2 par2 www}
\\ \hline
\end{xltabular}
\begin{table}[h!]
\begin{threeparttable}
\begin{tabularx}{\textwidth}{| X | X |}
\hline
cell1 & cell2\tnote{a} \\
\hline
\end{tabularx}
\smallskip\footnotesize
\begin{tablenotes}
\item[a] par1 par1par1 par1par1par1 par1 par1par1 par1 par1 par1 par1 par1 par1par1 par1par1par1 par1 par1-par1-par1 w par1 par1 par1 w par1par1par1par1par1 par1 par1 par1 par1 par1 www
\smallskip % 2nd para of footnote:
par2 par2par2par2 par2par2 par2 par2 par2 par2 par2 par2 par2par2 par2 par2-par2-par2 w par2 par2 par2 w par2par2par2 par2 par2 par2 par2 par2 www
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}