xltabular 分页符 多页

xltabular 分页符 多页

作为一篇文章的一部分,我正在将一段东方语言的文本翻译成德语。我正在写一个简短的介绍,然后是正文。因此,我想把它放在一个有两列两行的表格中。我的问题:我使用的是 xltabular,但它没有自动分页。我该如何修复它?对于东方语言,避免换行很重要。这是我的 MWE:

\documentclass{article}
\usepackage{xltabular}
\keepXColumns
\usepackage{blindtext}
\begin{document}

In the next lines, the text will be translated into German:

\begin{xltabular}[l]{0.75\linewidth}{@{} lX @{}}
\caption{The \texttt{xltabular} environment with \texttt{longtable} property
and left aligned by setting the optional argument.}\\[\belowcaptionskip]\hline
Arabic & German\\
\hline
Left column & At first a line with some nonsense text to show how long this line is.
The caption has the same width as the text. At first a line with some nonsense text to show how long this line is.
The caption has the same width as the text At first a line with some nonsense text to show how long this line is.
The caption has the same width as the text At first a line with some nonsense text to show how long this line is.
The caption has the same width as the text At first a line with some nonsense text to show how long this line is.
The caption has the same width as the text At first a line with some nonsense text to show how long this line is.
The caption has the same width as the text At first a line with some nonsense text to show how long this line is.
The caption has the same width as the text At first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the textAt first a line with some nonsense text to show how long this line is.
The caption has the same width as the text\\
t\\\hline
\end{xltabular}


\end{document}

答案1

虽然可以将表格拆分为多个页面,但您无法拆分单个单元格。这是因为单元格是一个牢不可破的盒子,因此对于每种环境xltabular都适用。longtabletabular

因此,我建议采用不同的方法,尽管它也有一定的限制:您可以使用环境description并根据需要使用该enumitem包对其进行样式设置。这样,至少包含描述文本的右侧“列”可以拆分为多个页面。

不过,包含标签的左侧“列”(现在放置在 内\parbox)不能跨页。另外,如果左侧“列”中的文本比右侧“列”中的文本长,它将与下一行重叠。

\documentclass{article}

\usepackage{enumitem}
\newlist{translation}{description}{1}
\setlist[translation]{align=parleft, labelwidth=*, leftmargin=14em, font=\normalfont, before=\raggedright}

\usepackage{lipsum}

\begin{document}

\begin{translation}

    \item[\textbf{English}] \textbf{German}
    
    \item[One morning, as Gregor Samsa was waking up from anxious dreams, he discovered that in bed he had been changed into a monstrous verminous bug. He lay on his armour-hard back and saw, as he lifted his head up a little, his brown, arched abdomen divided up into rigid bow-like sections.]

    Als Gregor Samsa eines Morgens aus unruhigen Träumen erwachte, fand er sich in seinem Bett zu einem ungeheueren Ungeziefer verwandelt. Er lag auf seinem panzerartig harten Rücken und sah, wenn er den Kopf ein wenig hob, seinen gewölbten, braunen, von bogenförmigen Versteifungen geteilten Bauch, auf dessen Höhe sich die Bettdecke, zum gänzlichen Niedergleiten bereit, kaum noch erhalten konnte. Seine vielen, im Vergleich zu seinem sonstigen Umfang kläglich dünnen Beine flimmerten ihm hilflos vor den Augen.

    \item[``What's happened to me,'' he thought. It was no dream.]

    \lipsum[1-2]

\end{translation}

\end{document}

在此处输入图片描述


一些说明:

如果要[]在 的参数中使用方括号\item,则需要将整个参数放在花括号之间{}。因此,它应该看起来像这样:\item[{something with [square] brackets}]

如果您希望第一列的文本居中或右对齐,您可以通过使用定义新的对齐样式来实现\SetLabelAlign,然后使用此样式和选项align

\SetLabelAlign{parcenter}{\strut\smash{\parbox[t]\labelwidth{\centering #1}}}

\newlist{translation}{description}{1}
\setlist[translation]{align=parcenter, labelwidth=*, leftmargin=14em, font=\normalfont, before=\raggedright}

相关内容