尽管使用 \vspace{} 减少了表格大小和空白,但我仍然有很多空白,并且第二个表格仍然进入第二页。我希望第二个表格紧跟在第一个表格之后。我的代码如下,后面是两张图片
编辑:有人告诉我要扩展我的代码。我不太确定这意味着什么,所以我只包含了主要的 latex 文档。
\documentclass[12pt]{nmsuth01}
\usepackage{eurosym}
\usepackage{float}
\usepackage{makeidx}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{amsmath,amsthm}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage[version=4]{mhchem}
\usepackage{hyperref}
\usepackage{indentfirst}
\setcounter{MaxMatrixCols}{10}
%TCIDATA{OutputFilter=LATEX.DLL}
%TCIDATA{Version=5.00.0.2606}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{LastRevised=Wednesday, May 04, 2005 15:55:23}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
\setlength{\evensidemargin}{0.5in}
\setlength{\oddsidemargin}{0.5in}
\setlength{\textwidth}{5.75in}
\setlength{\topmargin}{-0.25in}
\setlength{\textheight}{8.25in}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{convention*}{Convention}
\newlength{\singlespace}
\setlength{\singlespace}{\baselineskip}
\newlength{\doublespace}
\setlength{\doublespace}{2.0\baselineskip}
\setlength{\parindent}{4em}
%\input{tcilatex}
\begin{table}[H]
\centering
\caption{Soil Recoveries in HCl media }
\label{tab:my-table}
\resizebox{0.3\textwidth}{!}{%
\begin{tabular}{cc}
\hline
\multicolumn{1}{l}{\textbf{Sample}} & \multicolumn{1}{l}{\textbf{Recoveries (\%)}} \\ \hline
10916 & 62.99 \\
10917 & 63.38 \\
10918 & 78.98 \\
10919 & 73.39 \\
10920 & 64.76 \\
10921 & 66.27 \\
\multicolumn{1}{l}{} & \multicolumn{1}{l}{} \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
&
\end{tabular}%
}
\vspace{-4in}
\end{table}
dskjlflsjdfk
\begin{table}[H]
\centering
\caption{Soil in HNO3 media recoveries}
\label{tab:my-table}
\resizebox{0.3\textwidth}{!}{%
\begin{tabular}{cc}
\hline
\multicolumn{1}{l}{\textbf{Sample}} & \multicolumn{1}{l}{\textbf{Recoveries (\%)}} \\ \hline
10916 & 36.28 \\
10917 & 36.69 \\
10918 & 32.48 \\
10919 & 46.68 \\
10920 & 35.51 \\
10921 & 39.99 \\
\multicolumn{1}{l}{} & \multicolumn{1}{l}{} \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
& \\
&
\end{tabular}%
}
\end{table}
[
答案1
空行太多:删除它们。
不\resizebox
。
\documentclass[12pt]{article}%{nmsuth01}
\usepackage{eurosym}
\usepackage{float}
\usepackage{makeidx}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{amsmath,amsthm}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage[version=4]{mhchem}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage{indentfirst}
\setcounter{MaxMatrixCols}{10}
%TCIDATA{OutputFilter=LATEX.DLL}
%TCIDATA{Version=5.00.0.2606}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{LastRevised=Wednesday, May 04, 2005 15:55:23}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
\setlength{\evensidemargin}{0.5in}
\setlength{\oddsidemargin}{0.5in}
\setlength{\textwidth}{5.75in}
\setlength{\topmargin}{-0.25in}
\setlength{\textheight}{8.25in}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{convention*}{Convention}
\newlength{\singlespace}
\setlength{\singlespace}{\baselineskip}
\newlength{\doublespace}
\setlength{\doublespace}{2.0\baselineskip}
\setlength{\parindent}{4em}
%\input{tcilatex}
\begin{document}
\begin{table}[!htp]
\centering
\caption{Soil Recoveries in \ce{HCl} media }
\label{tab:my-table-HCl}
\begin{tabular}{cc}
\toprule
\textbf{Sample} & \textbf{Recoveries (\%)} \\
\midrule
10916 & 62.99 \\
10917 & 63.38 \\
10918 & 78.98 \\
10919 & 73.39 \\
10920 & 64.76 \\
10921 & 66.27 \\
\bottomrule
\end{tabular}
\end{table}
dskjlflsjdfk
\begin{table}[!htp]
\centering
\caption{Soil in \ce{HNO3} media recoveries}
\label{tab:my-table-HNO3}
\begin{tabular}{cc}
\toprule
\textbf{Sample} & \textbf{Recoveries (\%)} \\
\midrule
10916 & 36.28 \\
10917 & 36.69 \\
10918 & 32.48 \\
10919 & 46.68 \\
10920 & 35.51 \\
10921 & 39.99 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
既然你加载了mhchem
,就用它作为标题中的分子。我还建议利用booktabs
这些功能。
注意。我使用是article
因为我没有nmsuth01
。
您可能想要使用两个子表,这样也可以节省空间。
\documentclass[12pt]{article}%{nmsuth01}
\usepackage{eurosym}
\usepackage{float}
\usepackage{makeidx}
\usepackage{amssymb}
\usepackage{latexsym}
\usepackage{amsmath,amsthm}
\usepackage{graphicx}
\usepackage{natbib}
\usepackage[version=4]{mhchem}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage{indentfirst}
\setcounter{MaxMatrixCols}{10}
%TCIDATA{OutputFilter=LATEX.DLL}
%TCIDATA{Version=5.00.0.2606}
%TCIDATA{<META NAME="SaveForMode" CONTENT="1">}
%TCIDATA{BibliographyScheme=Manual}
%TCIDATA{LastRevised=Wednesday, May 04, 2005 15:55:23}
%TCIDATA{<META NAME="GraphicsSave" CONTENT="32">}
\setlength{\evensidemargin}{0.5in}
\setlength{\oddsidemargin}{0.5in}
\setlength{\textwidth}{5.75in}
\setlength{\topmargin}{-0.25in}
\setlength{\textheight}{8.25in}
\theoremstyle{plain}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\theoremstyle{remark}
\newtheorem*{remark}{Remark}
\newtheorem*{convention*}{Convention}
\newlength{\singlespace}
\setlength{\singlespace}{\baselineskip}
\newlength{\doublespace}
\setlength{\doublespace}{2.0\baselineskip}
\setlength{\parindent}{4em}
%\input{tcilatex}
\begin{document}
\begin{table}[!htp]
\centering
\caption{Soil Recoveries in (a)~\ce{HCl} and (b)~\ce{HNO3} media }
\label{tab:my-table-HCl-HNO3}
\begin{subtable}{0.4\textwidth}
\centering
\caption{\ce{HCl} recoveries}\label{tab:my-table-HCl}
\begin{tabular}{cc}
\toprule
\textbf{Sample} & \textbf{Recoveries (\%)} \\
\midrule
10916 & 62.99 \\
10917 & 63.38 \\
10918 & 78.98 \\
10919 & 73.39 \\
10920 & 64.76 \\
10921 & 66.27 \\
\bottomrule
\end{tabular}
\end{subtable}\hfil
\begin{subtable}{0.4\textwidth}
\centering
\caption{\ce{HNO3} recoveries}
\label{tab:my-table-HNO3}
\begin{tabular}{cc}
\toprule
\textbf{Sample} & \textbf{Recoveries (\%)} \\
\midrule
10916 & 36.28 \\
10917 & 36.69 \\
10918 & 32.48 \\
10919 & 46.68 \\
10920 & 35.51 \\
10921 & 39.99 \\
\bottomrule
\end{tabular}
\end{subtable}
\end{table}
\end{document}
答案2
编辑: 第一次尝试时,我误读了表格的标题:它们并不相同。实际上,您有两个相似的、狭窄的表格,其中有很多空行。我假设,在您的示例中,它们尚未填充数据。
由于您的表格又长又窄,我建议将两个表格合并为一个长表格,例如使用 包longtblr
中定义的tabularray
四列(前两列为第一个表格,第三列和第四列为第二个表格):
\documentclass[12pt]{article}
\usepackage[version=4]{mhchem} % for chemistry expressions
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\NewTblrTheme{fancy}{
\SetTblrStyle{head}{font=\footnotesize}
\SetTblrStyle{foot}{font=\footnotesize\itshape}
\SetTblrStyle{caption-tag}{font=\bfseries}
}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\begin{longtblr}[
theme = fancy,
caption = {Soil Recoveries in \ce{HCl} and \ce{HNO3} media},
label = {tblr:test},
]{
colspec = {l Q[c, si={table-format=2.2}]
l Q[c, si={table-format=2.2}] },
rowhead = 2,
row{2} = {font=\bfseries},
rowsep = 1pt
}
\SetCell[c=2]{c} \ce{HCl} media
& & \SetCell[c=2]{c}\ce{HNO3} media
& \\
Sample & \SetCell[c=1]{c} {{{Recoveries (\%)}}}
& Sample & \SetCell[c=1]{c} {{{Recoveries (\%)}}}
\\
\cmidrule[lr]{1-2}
\cmidrule[lr]{3-4}
10916 & 62.99 & 10916 & 36.28 \\
10917 & 63.38 & 10917 & 36.69 \\
10918 & 78.98 & 10918 & 32.48 \\
10919 & 73.39 & 10919 & 46.68 \\
10920 & 64.76 & 10920 & 35.51 \\
10921 & 66.27 & 10920 & 35.51 \\
... & & ... & \\
& & & \\
& & & \\
& & & \\
& & & \\
& & & \\
& & & \\
& & & \\
& & & \\
& & & \\
& & & \\
& & & \\
& & & \\
... & & ... & \\
\cmidrule[lr]{1-2}
\cmidrule[lr]{3-4}
\end{longtblr}
\end{document}
笔记:因为我没有你的文档类(nmsuth01
),所以我使用标准article
。在这种情况下,你使用背页,那么你需要tabularray
自己安装 packe,因为背页(仍然)不包含它。
如果空行未被使用,请将其删除。在这种情况下,您仍然可以使用上面建议的解决方案,或者简单地并行编写两个短表:
\documentclass[12pt]{article}
\usepackage[version=4]{mhchem}
\usepackage[skip=1ex,
font=footnotesize,
labelfont=bf]{caption}
\usepackage{tabularray}
\UseTblrLibrary{booktabs, siunitx}
\usepackage{lipsum}
\begin{document}
\lipsum[1-2]
\begin{table}[ht]
\caption{Soil Recoveries in \ce{HCl} and \ce{HNO3} media},
\label{tblr:test},
\centering
\begin{tblr}{colspec = {l Q[c, si={table-format=2.2}]},
row{2} = {font=\bfseries},
}
\SetCell[c=2]{c} \ce{HCl} media
& \\
\toprule
Sample & \SetCell[c=1]{c} {{{Recoveries (\%)}}}
\\
\midrule
10916 & 62.99 \\
10917 & 63.38 \\
10918 & 78.98 \\
10919 & 73.39 \\
10920 & 64.76 \\
10921 & 66.27 \\
\bottomrule
\end{tblr}\hfil%
\begin{tblr}{colspec = {l Q[c, si={table-format=2.2}]},
row{2} = {font=\bfseries},
}
\SetCell[c=2]{c}\ce{HNO3} media
& \\
\toprule
Sample & \SetCell[c=1]{c} {{{Recoveries (\%)}}}
\\
\midrule
10916 & 36.28 \\
10917 & 36.69 \\
10918 & 32.48 \\
10919 & 46.68 \\
10920 & 35.51 \\
10920 & 35.51 \\
\bottomrule
\end{tblr}
\end{table}
\lipsum[66]
\end{document}