这是这回答我之前的问题。我有三个这样的表格,我想确保它们出现在 1 页上,以便底部的键出现在所有键的正下方。
- 是否可以减少表格之间的空间,以便一些文本可以出现在页面上(表格之前或之后),因为看起来表格之间有很大空间?
\documentclass[runningheads]{llncs}
\usepackage{booktabs,siunitx}
%\usepackage{cleveref}
\begin{document}
\section{Main Section}
\subsection{Sub-section I}
Checking cross-reference for Table \ref{tab:exp1}
\title{Paper Title}
\begin{table}[!htbp]
\caption{Experiemnt 1} \label{tab:exp1}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
l
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{}
}
\toprule
TM &
\multicolumn{5}{c}{Precision} &
\multicolumn{5}{c}{Recall} &
\multicolumn{5}{c}{F1-Score} \\
\cmidrule(r{1ex}){2-6} \cmidrule(r{1ex}){7-11} \cmidrule{12-16}
& {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D}\\
\midrule
Walk & & & & & & & & & & & & & & & \\
Bike & & & & & & & & & & & & & & & \\
Bus & & & & & & & & & & & & & & & \\
Taxi & & & & & & & & & & & & & & & \\
Train & & & & & & & & & & & & & & & \\
\bottomrule
\end{tabular*}
\end{table}
\begin{table}[!htbp]
\caption{Experiemtn 2} \label{tab:exp2}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
l
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{}
}
\toprule
TM &
\multicolumn{5}{c}{Precision} &
\multicolumn{5}{c}{Recall} &
\multicolumn{5}{c}{F1-Score} \\
\cmidrule(r{1ex}){2-6} \cmidrule(r{1ex}){7-11} \cmidrule{12-16}
& {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D}\\
\midrule
Walk & & & & & & & & & & & & & & & \\
Bike & & & & & & & & & & & & & & & \\
Bus & & & & & & & & & & & & & & & \\
Taxi & & & & & & & & & & & & & & & \\
Train & & & & & & & & & & & & & & & \\
\bottomrule
\end{tabular*}
\end{table}
\begin{table}[htbp]
\caption{Experiemnt 3} \label{tab:exp3}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
l
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{}
}
\toprule
TM &
\multicolumn{5}{c}{Precision} &
\multicolumn{5}{c}{Recall} &
\multicolumn{5}{c}{F1-Score} \\
\cmidrule(r{1ex}){2-6} \cmidrule(r{1ex}){7-11} \cmidrule{12-16}
& {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D}\\
\midrule
Walk & & & & & & & & & & & & & & & \\
Bike & & & & & & & & & & & & & & & \\
Bus & & & & & & & & & & & & & & & \\
Taxi & & & & & & & & & & & & & & & \\
Train & & & & & & & & & & & & & & & \\
\bottomrule
\end{tabular*}
\medskip
TM: Transportation mode
R: RF\textit{(baseline)}; S: RF-SMOTEd; A: AdaBoost; B: SMOTEBoost; D: DECOC
\end{table}
\end{document}
输出:
答案1
LaTeX 默认设置下,页面的 1/3 部分用于文本,因此页面中没有足够的空间容纳三个浮动元素。您可以通过两种方式解决这个问题:
- 将所有浮点数合并为一个:
\documentclass[runningheads]{llncs}
\usepackage[skip=1ex]{caption} % added, for better placement of captions
\usepackage{booktabs,siunitx}
%\usepackage{cleveref}
\begin{document}
\section{Main Section}
\subsection{Sub-section I}
Checking cross-reference for Table \ref{tab:exp1}
\title{Paper Title}
\begin{table}[!htbp]
\caption{Experiement 1} \label{tab:exp1}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
l
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{}
}
\toprule
TM &
\multicolumn{5}{c}{Precision} &
\multicolumn{5}{c}{Recall} &
\multicolumn{5}{c}{F1-Score} \\
\cmidrule(r{1ex}){2-6} \cmidrule(r{1ex}){7-11} \cmidrule{12-16}
& {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D}\\
\midrule
Walk & & & & & & & & & & & & & & & \\
Bike & & & & & & & & & & & & & & & \\
Bus & & & & & & & & & & & & & & & \\
Taxi & & & & & & & & & & & & & & & \\
Train & & & & & & & & & & & & & & & \\
\bottomrule
\end{tabular*}
\caption{Experiemtn 2} \label{tab:exp2}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
l
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{}
}
\toprule
TM &
\multicolumn{5}{c}{Precision} &
\multicolumn{5}{c}{Recall} &
\multicolumn{5}{c}{F1-Score} \\
\cmidrule(r{1ex}){2-6} \cmidrule(r{1ex}){7-11} \cmidrule{12-16}
& {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D}\\
\midrule
Walk & & & & & & & & & & & & & & & \\
Bike & & & & & & & & & & & & & & & \\
Bus & & & & & & & & & & & & & & & \\
Taxi & & & & & & & & & & & & & & & \\
Train & & & & & & & & & & & & & & & \\
\bottomrule
\end{tabular*}
\caption{Experiment 3} \label{tab:exp3}
\setlength{\tabcolsep}{0pt}
\begin{tabular*}{\textwidth}{
@{\extracolsep{\fill}}
l
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{\hskip 1ex}
*{5}{S[table-format=1.2]}
@{}
}
\toprule
TM &
\multicolumn{5}{c}{Precision} &
\multicolumn{5}{c}{Recall} &
\multicolumn{5}{c}{F1-Score} \\
\cmidrule(r{1ex}){2-6} \cmidrule(r{1ex}){7-11} \cmidrule{12-16}
& {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D} & {R} & {S} & {A} & {B} & {D}\\
\midrule
Walk & & & & & & & & & & & & & & & \\
Bike & & & & & & & & & & & & & & & \\
Bus & & & & & & & & & & & & & & & \\
Taxi & & & & & & & & & & & & & & & \\
Train & & & & & & & & & & & & & & & \\
\bottomrule
\end{tabular*}
\medskip
TM: Transportation mode
R: RF\textit{(baseline)}; S: RF-SMOTEd; A: AdaBoost; B: SMOTEBoost; D: DECOC
\end{table}
\end{document}
编辑:
- 或者如果你坚持(出于未知原因)将浮点数与表格分开,那么你(再次)有两种可能性:
- 将所有表格放置选项更改为
[!htbp]
@Mico 在其评论中的建议(您已经在前两个表格中使用它们,为什么在第三个表格中省略了它们,尚不清楚,但这是导致您出现问题的原因),或者 - 在序言中添加:
\renewcommand{\textfraction}{0.07}
并且对于所有表格位置选项仅使用[htbp]
。
- 将所有表格放置选项更改为
在这种情况下,表格将放在同一页中,如下所示:
(红线显示页面布局)
无关:
对于您的表格,您可以考虑将所有表格合并到一个表格中,每个表格在单独的行中都有标题。 在这种情况下,使用包talltblr
tabularray
:
\documentclass[runningheads]{llncs}
%---------------- show page layout. don't use in a real document!
\usepackage{showframe}
\renewcommand\ShowFrameLinethickness{0.15pt}
\renewcommand*\ShowFrameColor{\color{red}}
%---------------------------------------------------------------%
\usepackage[skip=1ex]{caption} % added, for better placement of captions
\usepackage{tabularray}
\UseTblrLibrary{booktabs,siunitx}
\NewTableCommand\experiment[1][2ex]{%
\SetRow{abovesep+=#1, preto=\hspace{-1em}}
\SetCell[c=16]{font=\bfseries\itshape}
}
\begin{document}
\section{Main Section}
\subsection{Sub-section I}
Checking cross-reference for Table \ref{tab:exp1}
\title{Paper Title}
\begin{table}[htbp]
\caption{Experiment 1}
\label{tab:exp1}
\begin{talltblr}[
caption = {Result of experiments 1 -- 3},
label = {tab:exp1},
note{} = {TM: Transportation mode\newline
R: RF(\textit{baseline});
S: RF-SMOTEd;
A: AdaBoost;
B: SMOTEBoost;
D: DECOC}
]{colspec = {Q[l,leftsep=1em]
*{3}{*{5}{X[c, si={table-format=1.2}]}}},
row{1,2} = {guard},
rowsep=1pt
}
\toprule
TM & \SetCell[c=5]{c} Precision
& & & & \SetCell[c=5]{c} Recall
& & & & & \SetCell[c=5]{c} F1-Score
& & & & & \\
\cmidrule[lr=-1]{2-6}
\cmidrule[lr=-1]{7-11}
\cmidrule[l=-1]{12-16}
& R & S & A & B & D & R & S & A & B & D & R & S & A & B & D \\
\midrule
\experiment Experiment 1
& & & & & & & & & & & & & & & \\
Walk & & & & & & & & & & & & & & & \\
Bike & & & & & & & & & & & & & & & \\
Bus & & & & & & & & & & & & & & & \\
Taxi & & & & & & & & & & & & & & & \\
Train & & & & & & & & & & & & & & & \\
\experiment Experiment 2
& & & & & & & & & & & & & & & \\
Walk & & & & & & & & & & & & & & & \\
Bike & & & & & & & & & & & & & & & \\
Bus & & & & & & & & & & & & & & & \\
Taxi & & & & & & & & & & & & & & & \\
Train & & & & & & & & & & & & & & & \\
\experiment Experiment 3
& & & & & & & & & & & & & & & \\
Walk & & & & & & & & & & & & & & & \\
Bike & & & & & & & & & & & & & & & \\
Bus & & & & & & & & & & & & & & & \\
Taxi & & & & & & & & & & & & & & & \\
Train & & & & & & & & & & & & & & & \\
\bottomrule
\end{talltblr}
\end{table}
\end{document}