我想将表格放在两列文档页面的中央。
这是我的原始代码
\begin{table}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|c|}
\hline
\multirow{2}{*}{{Method}} & \multirow{2}{*}{{\begin{tabular}[c]{@{}c@{}}temperature \\ \end{tabular}}} & \multicolumn{4}{c|}{{B}} & \multicolumn{4}{c|}{{C}} \\ \cline{3-10}
& & {Region1} & { Region2} & { Region3} & { Region4} & { Region5} & { Region6} & { Region7} & { Region8} \\ \hline
{Timberlake {[6}{]}} & {98} & {81.2} & {95.9} & {73.6} & {12.2} & {32.5} & {91.5} & {11.59} & {3.2} \\ \hline
{Agnewl {[8}{]}} & {99} & {82.2} & {54.2} & {67.2} & {87.2} & {81.2} & {32} & {1.3} & {44.0} \\ \hline
\end{tabular}
\vspace{0.1cm}
\caption {List with Temp vs regions } \label{tab:title}
\end{table}
我尝试过\begin{center}
,\centering
但没有任何帮助。
有人能给出建议吗?我怎样才能将这张表放在两个文档页面的中央?
答案1
我提出了两种解决方案:交换行和列,以便可以适应列宽,或者使用包( bundle)strip
中的环境,该环境允许在两列文档中使用全宽对象。当然,这些不浮动,必须用命令替换。cuted
shipunov
\caption
\captionof
我擅自根据自己的喜好改进了表格,删除了所有垂直线,并使用了以下规则命令booktabs
:
\documentclass[twocolumn]{article}%
\usepackage{geometry}
\usepackage{cuted, ragged2e}
\usepackage{lipsum, array, booktabs, caption}
\usepackage{multirow}
\begin{document}
\lipsum[11]
\begin{table}[!htbp]
\centering\renewcommand{\arraystretch}{1.2}
\begin{tabular}{@{}lccc@{}}
\toprule
\multicolumn{2}{l}{Method} & Timberlake {[6}{]} & Agnewl {[8}{]}\\
\multicolumn{2}{l}{Temperature} & 98 & 99 \\
\midrule
\multirow{4}{*}{B} & Region 1 & 81.2 & 82.2 \\
& Region 2 & 95.9 & 54.2 \\
& Region 3 & 73.6 & 67.2 \\
& Region 4 & 12.2 & 87.2 \\
\addlinespace[2ex]
\multirow{4}{*}{C} & Region 5 & 32.5 & 81.2 \\
& Region 6 & 91.5 & 32 \\
& Region 7 & 11.59 & 1.3 \\
& Region 8 & 3.2 & 44.0 \\
\bottomrule
\end{tabular}
\caption{List with Temp vs regions } \label{tab:titlenew}
\end{table}
\lipsum[2-4]
\begin{strip}
\setlength\arraycolsep{4pt}
\centering
\begin{tabular}{@{}l@{}*{8}{c}c@{}}
\toprule
\multirow{2}{*}[-0.6ex]{Method} & \multirow{2}{*}[-0.6ex]{Temperature} & \multicolumn{4}{c}{{B}} & \multicolumn{4}{c}{{C}} \\
\cmidrule(lr){3-6}\cmidrule(l){7-10}
& & Reg.\,1 & Reg.\,2 & Reg.\,3 & Reg.\,4 & Reg.\,5 & Reg.\,6 & Reg.\,7 & Reg.\,8 \\
\midrule\addlinespace
{Timberlake {[6}{]}} & {98} & {81.2} & {95.9} & {73.6} & {12.2} & {32.5} & {91.5} & {11.59} & {3.2} \\ \addlinespace
{Agnewl {[8}{]}} & {99} & {82.2} & {54.2} & {67.2} & {87.2} & {81.2} & {32} & {1.3} & {44.0} \\
\bottomrule
\end{tabular}
\captionof{table}{List with Temp vs regions } \label{tab:title}
\end{strip}
\lipsum[4-8]
\end{document}