我正在尝试使用 ACM 模板将两个表格放在一起,以便它们立即放在一起,但我遇到了问题。表格将并排放在一起,但第一个表格太靠左,而第二个表格则位于正确的位置。无论我如何尝试定位表格,表格都会放在自己的页面上,而不是与文本放在一起。
这是一个有效的例子:
\documentclass{acm_proc_article-sp}
\usepackage{caption}
\usepackage{float}
\begin{document}
\title{Example}
\maketitle
\begin{table*}
\caption{Power Measurements, 1 and 2 Bids}
\centering
\begin{tabular} {| c | c | c | c | c | c | c |}
\hline
\textbf{Number of Bids} & \multicolumn{3} {|c|} {\textbf{1}} & \multicolumn{3} {|c|} {\textbf{2}} \\
\hline
Trial & 1 & 2 & 3 & 1 & 2 & 3 \\
\hline
Duration & 5m 59s & 16m 6s & 5m 57s & 6m 6s & 15m 37s & 6m 59s \\
\hline
\end{tabular}
\newline \vspace*{1 mm} \newline
\caption{Power Measurements, 3 and 4}
\centering
\begin{tabular} {| c | c | c | c | c | c | c |}
\hline
\textbf{Number of Bids} & \multicolumn{3} {|c|} {\textbf{3}} & \multicolumn{3} {|c|} {\textbf{4}} \\
\hline
Trial & 1 & 2 & 3 & 1 & 2 & 3 \\
\hline
Duration & 7m 25s & 16m 7s & 10m 57s & 5m 49s & 16m 8s & 7m 24s \\
\hline
\end{tabular}
\end{table*}
\end{document}
我不确定我需要如何纠正这个问题。
答案1
\documentclass{acm_proc_article-sp}
\usepackage{caption}
\usepackage[labelformat=simple,labelsep=colon]{subcaption}
\newcommand{\tabc}{\stepcounter{table}}
% \tabc command will be used to increment counter
% in subtable.
% add this command in the end of caption of a
% subtable but leaving the subcaption of the first subtable.
\renewcommand{\thesubtable}{Table~\thetable}
\begin{document}
\title{Example}
\maketitle
\section{one}
\begin{table*}[!h]
\begin{subtable}{\textwidth}
\caption{Power Measurements, 1 and 2 Bids}% no \tabc command here
\centering
\begin{tabular} {| c | c | c | c | c | c | c |}
\hline
\textbf{Number of Bids} & \multicolumn{3} {|c|} {\textbf{1}} & \multicolumn{3} {|c|} {\textbf{2}} \\
\hline
Trial & 1 & 2 & 3 & 1 & 2 & 3 \\
\hline
Duration & 5m 59s & 16m 6s & 5m 57s & 6m 6s & 15m 37s & 6m 59s \\
\hline
\end{tabular}
\end{subtable}
\\[1mm]
\begin{subtable}{\textwidth}
\caption{Power Measurements, 3 and 4 \tabc} % \tabc command here and
% in the subtables following this one in this table environment
\centering
\begin{tabular} {| c | c | c | c | c | c | c |}
\hline
\textbf{Number of Bids} & \multicolumn{3} {|c|} {\textbf{3}} & \multicolumn{3} {|c|} {\textbf{4}} \\
\hline
Trial & 1 & 2 & 3 & 1 & 2 & 3 \\
\hline
Duration & 7m 25s & 16m 7s & 10m 57s & 5m 49s & 16m 8s & 7m 24s \\
\hline
\end{tabular}
\end{subtable}
% Do not use caption here
\end{table*}
\end{document}