我正在使用该xltabular
包创建跨多页的表格(在横向环境中)。它工作正常,如果新行超出当前页的末尾,它会放在下一页上。但是,我有时会单身的行的长度比页面的实际高度要长,因为我使用的列中经常会包含很多信息。无论我是否使用横向环境,情况都是如此。
以下是一个示例,其中实际文本被模拟信息替换。我尝试仅将文件中的相关信息复制.sty
到此示例代码中:
% ========== Document Metadata ========== %
% Document structure and setup
\documentclass[a4paper]{article} % Paper size
\usepackage[utf8]{inputenc} % Text encoding
\usepackage{helvet} % Document font
\usepackage[tmargin=1cm, lmargin=2.5cm, rmargin=2.5cm, bmargin=2.3cm, headheight=26pt, includeheadfoot]{geometry} % Margins
\usepackage{hyperref} % Allow hyperlinks using \href{}
\linespread{1.1}
% Tables
\usepackage{graphicx}
\usepackage[table,xcdraw]{xcolor}
\usepackage{tabularx}
\usepackage{color}
\usepackage{array}
% Header/footer
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyhf{}
\setlength\headheight{42pt} % Just to make warning go away. Adjust the value after looking into the warning.
\renewcommand{\familydefault}{\sfdefault}
\renewcommand{\headrulewidth}{0pt} % Remove hr from fancyhdr
\renewcommand{\sectionmark}[1]{\markright{#1}} % Remove section number from fancyhdr
% Lists
\usepackage{enumitem} % Reduce space between list items
\setlist{nolistsep} % Reduce space between list items
\usepackage[OT1]{fontenc}
\usepackage{titletoc}
\usepackage{lscape}
\usepackage{longtable}
\usepackage[acronym, nopostdot]{glossaries}
\usepackage{expl3}
\usepackage{xltabular}
\title{some title}
% ========== Title Page ========== %
\begin{document}
\begin{landscape}
Table example:
\begin{xltabular}{\linewidth}{|p{0.075\linewidth}|p{0.03\linewidth}|p{0.175\linewidth}|p{0.65\linewidth}|} \hline
\rowcolor[HTML]{EFEFEF}\textbf{text} & \textbf{text} & \textbf{text} & \textbf{text} \\ \hline \endhead
% ---------- New row ---------- %
Example
&
\incrementStep
&
example
&
\begin{enumerate}
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\item Here there will be a lot of text and the row breaks the page.
\end{enumerate}
\\\hline
% ---------- New row ---------- %
%
Example2
&
\incrementStep
&
example2
&
\begin{enumerate}
\item Here there will be a lot of text and the row breaks the page.
\end{enumerate}
\\\hline
\end{xltabular}
\end{landscape}
\end{document}
我正在编译它pdflatex
,输出(第 2 页和第 3 页)如下所示:
如您所见,最后一列可能包含一个很长的列表。在这种情况下,行对于页面来说太高,无法在该页面上继续。我完全知道一种解决方案就是提前停止行,但这感觉有点不合时宜,我选择希望使用 LaTeX 编写文档能为我提供一种方法来使它们符合我的要求。
不确定是否重要,但我正在使用进行编译pdflatex
。