如何防止表格跳转到下一节

如何防止表格跳转到下一节

如何防止表格跳转到下一节?在此示例中,表格 2 和 3 应属于第 1 节,但它们跳转到与该节无关的第 2 节。请注意,这是一个双列乳胶模板,表格很大,因此它们需要跨越两列。这是我的代码:

\documentclass[default,iicol]{sn-jnl}% Default with double column layout
\jyear{2021}%



%\usepackage{float}
\usepackage{tabularx}
\usepackage{array, makecell}
\usepackage{cuted}
\usepackage{stfloats} 
%\usepackage{dblfloatfix}
\usepackage{lipsum}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}
%\usepackage{kantlipsum}


\begin{document}



\section{sec1}\label{sec1}
\lipsum[1-2]


%% TABLE 1
\begin{table*}[b]
\begin{center}
 \caption{TABLE 1}
\label{Tab1}
\begin{tabular}{|c|c|c|c|c|c|}
\hline 
name & job & title & age & address & status \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
\end{tabular}
\end{center}
\end{table*}

\lipsum[2-7]



%% TABLE 2
\begin{table*}[b]
\begin{center}
 \caption{TABLE 2}
\label{Tab2}
\begin{tabular}{|c|c|c|c|c|c|}
\hline 
name & job & title & age & address & status \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
\end{tabular}
\end{center}
\end{table*}


 %% TABLE 3
\begin{table*}[b]
\begin{center}
 \caption{TABLE 3}
\label{Tab3}
\begin{tabular}{|c|c|c|c|c|c|}
\hline 
name & job & title & age & address & status \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\ 
\hline 
\end{tabular}
\end{center}
\end{table*}

%-------------------------------------------------------------------------

\section{sec2}\label{sec2}

\lipsum[1-2]

    \end{document}

在此处输入图片描述

答案1

  • 浮动表格table*总是出现在插入的下一页的顶部。
  • 当您显示的表格可以很好地容纳在一列中时,为什么要使用table*环境(跨越两列)?
\documentclass[default,iicol]{sn-jnl}% Default with double column layout

\usepackage{tabularx}
\usepackage{array, makecell}
\usepackage{cuted}
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}

\usepackage{lipsum}
\begin{document}


%% TABLE 8
\begin{table}
\centering
\caption{the jumping table}
\label{Jump}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
Parameter & help & me & with & this & table \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
\end{tabular}
\end{table}
\lipsum
\end{document}

在此处输入图片描述

附录(1): 显然 OP 表太大了,以至于它需要跨越两列。在这种情况下,可能需要帮助包stfloats,它能够将表放在插入页面的底部或顶部:

\documentclass[default,iicol]{sn-jnl}% Default with double column layout

\usepackage{tabularx}
\usepackage{array, makecell}
\usepackage{stfloats}   % <-------
\DeclareMathOperator*{\argmax}{arg\,max}
\DeclareMathOperator*{\argmin}{arg\,min}

\usepackage{lipsum}
\begin{document}
\lipsum[1-2]

%% TABLE 8
\begin{table*}[b]
\centering
\caption{the jumping table}
\label{Jump}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
Parameter & help & me & with & this & table \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
$IMO$ & 1 \% & 2 \% & 3 \% & 4 \% & 5\% \\
\hline
\end{tabular}
\end{table*}
\lipsum[2-7]
\end{document}

在此处输入图片描述

**附录(2):

  • 您应该table*相应地设置定位。在编辑的问题中显示的情况下,MWE 可以是:
\documentclass[default,iicol]{sn-jnl}% Default with double column layout
\usepackage{makecell, tabularx}
\usepackage{stfloats}
\usepackage{lipsum}

\begin{document}
\section{sec1}\label{sec1}
\lipsum[1-2]

%% TABLE 1
\begin{table*}[b]   % <---
\centering
\caption{TABLE 1}
\label{Tab1}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
name & job & title & age & address & status \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
\end{tabular}
\end{table*}

\lipsum[2-7]

%% TABLE 2
\begin{table*}[t]
\centering
\caption{TABLE 2}
\label{Tab2}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
name & job & title & age & address & status \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
\end{tabular}
\end{table*}

%% TABLE 3
\begin{table*}[t]
\centering
\caption{TABLE 3}
\label{Tab3}
\begin{tabular}{|c|c|c|c|c|c|}
\hline
name & job & title & age & address & status \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols & Ida Nichols \\
\hline
\end{tabular}
\end{table*}

\section{sec2}\label{sec2}
\lipsum[1]
\end{document}

在此处输入图片描述

相关内容