如何让表格跨越两页?

如何让表格跨越两页?

假设我有以下 MWE:

    \documentclass[letterpaper,11pt]{article}
    \usepackage{ragged2e}
    \usepackage{latexsym}
    \usepackage[empty]{fullpage}
    \usepackage{titlesec}
    \usepackage{marvosym}
    \usepackage[usenames,dvipsnames]{color}
    \usepackage{verbatim}
    \usepackage{enumitem}
    \usepackage[hidelinks]{hyperref}
    \usepackage{fancyhdr}
    \usepackage[english]{babel}
    \usepackage{tabularx}
    \input{glyphtounicode}
    \usepackage{changepage}
    \usepackage{calc}
    \usepackage{longtable}
    \usepackage{lipsum} 
    
    % Adjust margins
    \addtolength{\oddsidemargin}{-0.5in}
    \addtolength{\evensidemargin}{-0.5in}
    \addtolength{\textwidth}{1in}
    \addtolength{\topmargin}{-.5in}
    \addtolength{\textheight}{1.0in}
    
    \raggedbottom
    \raggedright
    \setlength{\tabcolsep}{0in}
    
    
    
    \begin{document}
    
    
    \lipsum[2-8]
    
    
    {\renewcommand{\arraystretch}{1.11}
    \begin{tabular*}{\textwidth}{p{18cm} @{\extracolsep{\fill}}r}
    Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name & 2022 \\
    \end{tabular*}
    }
    
    
    
\end{document}

这将产生以下两页输出:

第 1 页:

在此处输入图片描述

第2页:

在此处输入图片描述

该表列出了某人在 2022 年添加的会议。我希望表格能够填充文本块后第一页的空白处,然后“流到”下一页,这样它看起来像这样:

所需页面 1:

在此处输入图片描述

所需页面 2:

在此处输入图片描述

我怎样才能实现这个目标?

答案1

你可以使用较小的 来将文本打印为普通段落\hsize。例如,你可以定义宏:

\def\conference#1#2\par{%
  \bgroup \noindent\rlap{\hbox to\hsize{\hss #1}}\advance\hsize by-3em
  \rightskip=0pt \relax
  \indent \ignorespaces #2\par
  \egroup 
}

并按照以下文本使用它:

Previous paragraph

\conference {2022}
Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name.

Next paragraph.

答案2

Longtable 在这里没有帮助,因为它不会跨页面拆分表格。

如果您可以将 放在2022左边而不是右边(这对我来说似乎更合乎逻辑),那么您可以使用环境description。否则,我建议paracol包排版两个平行的段落(第二个仅包含2022)。

以下是两种解决方案的示例。

\documentclass[letterpaper,11pt]{article}
    \usepackage{ragged2e}
    \usepackage{latexsym}
    \usepackage[empty]{fullpage}
    \usepackage{titlesec}
    \usepackage{marvosym}
    \usepackage[usenames,dvipsnames]{color}
    \usepackage{verbatim}
    \usepackage{enumitem}
    \usepackage[hidelinks]{hyperref}
    \usepackage{fancyhdr}
    \usepackage[english]{babel}
    \usepackage{tabularx}
    \input{glyphtounicode}
    \usepackage{changepage}
    \usepackage{calc}
    \usepackage{longtable}
    \usepackage{lipsum} 
    
    % Adjust margins
    \addtolength{\oddsidemargin}{-0.5in}
    \addtolength{\evensidemargin}{-0.5in}
    \addtolength{\textwidth}{1in}
    \addtolength{\topmargin}{-.5in}
    \addtolength{\textheight}{1.0in}
    
    \raggedbottom
    \raggedright
    \setlength{\tabcolsep}{0in}
    \usepackage{paracol}

    \begin{document}
    
    
    \lipsum[2-8]
    
    \begin{description}
    \item[\normalfont 2022]
     Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name 
    \end{description}
\newpage
\lipsum[2-8]
\medskip
    \setcolumnwidth{18cm}
    \begin{paracol}{2}
    Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name, Conference name 
\switchcolumn
 2022 
     \end{paracol}
    
\end{document}

在此处输入图片描述

在此处输入图片描述

相关内容