上一页表格已满,如何扩展下一页表格?

上一页表格已满,如何扩展下一页表格?

我在使用 LaTeX 表格时遇到了问题,因为它们位于多页上,尽管最大页数为两页。此外,行间距很大。我该如何调整?当上一页已满且没有任何间距时,如何让表格移动到下一页?

在此处输入图片描述

\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
 \renewcommand{\arraystretch}{0.5}
 \begin{longtable}{|C{2cm}|C{2.5cm}|C{3cm}|C{2cm}|C{5cm}|}
 \caption{Summarizing deep learning for medical image classification}
 \label{table:ex1} \\
  \hline
   Reference & Model & Domain & Objectives & The best result of performance metrics \\
   \hline
    \endfirsthead
    \multicolumn{5}{c}%
     {\tablename\ \thetable\ -- \textit{Continued from previous page}} \\
      \hline
       Reference & Model & Domain & Objectives & The best result of performance metrics 
       \\
        \hline
         \endhead
           \hline \multicolumn{5}{r}{\textit{Continued on next page}} \\
            \endfoot
              \hline
              \endlastfoot
         \cite{sarwinda2021deep} & ResNet-18, ResNet-50 & Gastroenterology & The models 
         were able to differentiate between benign and malignant colorectal cancer & The 
         highest accuracy achieved by ResNet-50 \\ \hline  \cite{sarwinda2021deep} & 
          ResNet-18, ResNet-50 & Gastroenterology & The models 
         were able to differentiate between benign and malignant colorectal cancer & The 
         highest accuracy achieved by ResNet-50 \\ \hline\cite{sarwinda2021deep} & 
          ResNet-18, ResNet-50 & Gastroenterology & The models 
         were able to differentiate between benign and malignant colorectal cancer & The 
         highest accuracy achieved by ResNet-50 \\ \hline\cite{sarwinda2021deep} & 
         ResNet-18, ResNet-50 & Gastroenterology & The models 
         were able to differentiate between benign and malignant colorectal cancer & The 
         highest accuracy achieved by ResNet-50 \\ \hline\cite{sarwinda2021deep} & 
          ResNet-18, ResNet-50 & Gastroenterology & The models 
         were able to differentiate between benign and malignant colorectal cancer & The 
         highest accuracy achieved by ResNet-50 \\ \hline\cite{sarwinda2021deep} & 
          ResNet-18, ResNet-50 & Gastroenterology & The models 
         were able to differentiate between benign and malignant colorectal cancer & The 
         highest accuracy achieved by ResNet-50 \\ \hline
              \end{longtable}

笔记:此处所讨论的表格内容有重复。

答案1

  • 请始终提供 MWE(最小工作示例),这是一个完整的小文档,以便我们可以对其进行编译。
  • \textwidtharticle使用文档类时,给定列的宽度总和超出了默认大小。

使用包的解决方案longtblrtabularray其中考虑:

  • geometry页面布局由包定义
  • 最后两列的宽度相同(比前两列宽 2.3 倍)
  • 用于对齐最后两列单元格中的文本的ragged2e
  • 也用于microtype包装以更好地实现文本的词间间距
  • 为了更好地调整单元格中的文本间距,表格中的字体大小减小了(至\small

梅威瑟:

\documentclass{article}
\usepackage{geometry}
%--------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%
\usepackage{lipsum}                             % for dummy text
%---------------------------------------------------------------%
\usepackage{microtype}
\usepackage{ragged2e}
\usepackage{tabularray}
\SetTblrStyle{contfoot}{font=\footnotesize\itshape}


\begin{document}

\begin{longtblr}[
caption = {Summarizing deep learning for medical image classification},
                ]{hlines, vlines,
                 cells = {font=\small},
                 colspec = { *{2}{X[c]} c *{3}{X[2.3, j, cmd={\RaggedRight\hspace{0pt}}]} },
                 colsep  = 3pt,
                 row{1}  = {cmd={\Centering}, m},
                 rowhead = 1
                 }
% column headers
Reference & Model & Domain & Objectives & The best result of performance metrics \\
% table body
\cite{sarwinda2021deep} 
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\cite{sarwinda2021deep}
    & ResNet-18, ResNet-50  & Gastroenterology & The models were able to differentiate between benign and malignant colorectal cancer & The highest accuracy achieved by ResNet-50 \\
\end{longtblr}
\end{document}
\end{document}

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

(红线表示页面布局)

答案2

从一开始,如果您唯一的问题是表格高度,您可以尝试更改此特定的行...

\begin{longtable}{|C{2cm}|C{2.5cm}|C{3cm}|C{2cm}|C{5cm}|}

变成这样!

\begin{longtable}{|C{2.5cm}|C{3cm}|C{3cm}|C{3cm}|C{3cm}|}

因为,因为列类型“ C”在第一行上的定义方式,在每个 上C{x}x控制每列文本框的宽度。如果您的项目需要总长度为 14.5 厘米,您可以使用我之前发布的行。但它的要点是修改这些值,以便较长的文本有更多可用的水平空间!

另外,您是否需要使用tabularxlongtable包来编写此文档?您可以查看tabularray包,因为它可以让您更好地控制表格。

最后,请记住,定义为“长表”的表总是会尽可能地破坏页面。如果您想避免这种情况,请在示例中使用环境tabularx

相关内容