Table 单页 Latex 太长
Table too long for a single page Latex
我正在用 Latex 创建一个 table。它包含多行,因此它不适合 1 页。看起来是这样的:
这是我的 LaTex 代码:
\documentclass[11pt, a4paper]{article}
\pagenumbering{gobble}
\usepackage[
%showframe,
top=1pt,
bottom=1pt,
paperwidth=8.5in,
paperheight=11in,
]{geometry}
\usepackage{multirow}
\usepackage{tabularray}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{table}[!hbt]
\setlength\extrarowheight{-1cm}
\caption{Multi-row table}
\centering
\begin{tblr}{|c|c|c|c|c|}
\hline
Category & Epochs per round & Dataset & FedAvg & FedCurv \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\end{tblr}
%\end{center}
\label{tab:multicol}
\end{table}
\end{document}
如您所见,我有很多行,所以 table 超出了范围。现在,一个想法可以是将 table 分成两页,但是,我不知道我是否会喜欢这个解决方案。否则我更喜欢将 table 放在一页中。也许减少行间距或减少文本的尺寸,但我不知道该怎么做。任何解决方案表示赞赏。谢谢
您可以通过减少 rowsep
将 table 压缩到一页中:
\documentclass[11pt, a4paper]{article}
\pagenumbering{gobble}
\usepackage[
%showframe,
top=1pt,
bottom=1pt,
paperwidth=8.5in,
paperheight=11in,
]{geometry}
\usepackage{multirow}
\usepackage{tabularray}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{table}[!hbt]
%\setlength\extrarowheight{-1cm}
\caption{Multi-row table}
\centering
\SetTblrInner{rowsep=0pt}
\begin{tblr}{|c|c|c|c|c|}
\hline
Category & Epochs per round & Dataset & FedAvg & FedCurv \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\end{tblr}
%\end{center}
\label{tab:multicol}
\end{table}
\end{document}
我正在用 Latex 创建一个 table。它包含多行,因此它不适合 1 页。看起来是这样的:
这是我的 LaTex 代码:
\documentclass[11pt, a4paper]{article}
\pagenumbering{gobble}
\usepackage[
%showframe,
top=1pt,
bottom=1pt,
paperwidth=8.5in,
paperheight=11in,
]{geometry}
\usepackage{multirow}
\usepackage{tabularray}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{table}[!hbt]
\setlength\extrarowheight{-1cm}
\caption{Multi-row table}
\centering
\begin{tblr}{|c|c|c|c|c|}
\hline
Category & Epochs per round & Dataset & FedAvg & FedCurv \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\end{tblr}
%\end{center}
\label{tab:multicol}
\end{table}
\end{document}
如您所见,我有很多行,所以 table 超出了范围。现在,一个想法可以是将 table 分成两页,但是,我不知道我是否会喜欢这个解决方案。否则我更喜欢将 table 放在一页中。也许减少行间距或减少文本的尺寸,但我不知道该怎么做。任何解决方案表示赞赏。谢谢
您可以通过减少 rowsep
将 table 压缩到一页中:
\documentclass[11pt, a4paper]{article}
\pagenumbering{gobble}
\usepackage[
%showframe,
top=1pt,
bottom=1pt,
paperwidth=8.5in,
paperheight=11in,
]{geometry}
\usepackage{multirow}
\usepackage{tabularray}
\usepackage{array}
\usepackage{booktabs}
\begin{document}
\begin{table}[!hbt]
%\setlength\extrarowheight{-1cm}
\caption{Multi-row table}
\centering
\SetTblrInner{rowsep=0pt}
\begin{tblr}{|c|c|c|c|c|}
\hline
Category & Epochs per round & Dataset & FedAvg & FedCurv \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\SetCell[r=9]{} Uniform Distribution & 1 & \SetCell[r=3]{} MNIST & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \ \cline{2-5}
& 1 & \SetCell[r=3]{}CIFAR10 & accuracy & accuracy\
& 10 & & accuracy & accuracy\
& 30 & & accuracy & accuracy \\cline{2-5}
& 1 & \SetCell[r=3]{}TinyImageNet & accuracy & accuracy \
& 10 & & accuracy & accuracy \
& 30 & & accuracy & accuracy \
\hline
\end{tblr}
%\end{center}
\label{tab:multicol}
\end{table}
\end{document}