我在一个双列文档中有一个表格。我想将其居中。我使用了\centring
但它并没有将表格置于中心。当我使用时它正确居中resizebox
,但我不得不对其进行注释,因为在我添加 后它导致我出现错误\begin{threeparttable}
。
我的问题:如何才能resizebox
正确使用?或者如何在没有?\begin{threeparttable}
的情况下将表格居中。resizebox
这是一张图片:
\documentclass[compsoc, conference, letterpaper, 10pt, times]{IEEEtran}
\ifCLASSOPTIONcompsoc
\usepackage[nocompress]{cite}
\else
\usepackage{cite}
\fi
\ifCLASSINFOpdf
\else
\fi
\hyphenation{op-tical net-works semi-conduc-tor}
\usepackage{underscore} %for underscores
\usepackage[font=itshape]{quoting} %for double quotation
\usepackage{graphicx} %for images
\usepackage{epstopdf} %for images in eps files
\usepackage[font=small,labelfont=bf]{caption}
\usepackage{textcomp} % for th \textquotesingle
\usepackage{amsmath} %used in subequations
\usepackage{pbox} %for parbox
\usepackage{placeins} %for \FloatBarrier before references
\usepackage{colortbl}
\usepackage{array}
\usepackage{booktabs}
\usepackage{multirow}
\newcommand{\head}[1]{\textnormal{\textbf{#1}}}
\newcommand{\normal}[1]{\multicolumn{1}{l}{#1}}
\usepackage{amssymb}% http://ctan.org/pkg/amssymb
\usepackage{pifont}% http://ctan.org/pkg/pifont
\newcommand{\cmark}{\ding{51}}%
\newcommand{\xmark}{\ding{55}}%
\newcommand*\rot{\rotatebox{90}}
\usepackage{tabularx}
\usepackage{threeparttable, tablefootnote}
\usepackage{lipsum}
\begin{document}
\lipsum
\begin{table*}[tb!]
\begin{threeparttable}
\caption{My Table}
\label{table:my-table}
\centering
%\resizebox{\textwidth}{!} {
\begin{tabular} {lc*{16}l }
\hline
\multicolumn{1}{c}{A}
&&\multicolumn{3}{c}{B}
&&\multicolumn{3}{c}{C}
&&\multicolumn{3}{c}{D}
&&\multicolumn{2}{c}{E}
\\
\cmidrule(lr){1-1}
\cmidrule(lr){3-5}
\cmidrule(lr){7-9}
\cmidrule(lr){11-13}
\cmidrule(lr){15-16}
\\
& \vline &\rot{A} & \rot{B} & \rot{C}
& \vline & \rot{AAA} & \rot{BBB} & \rot{CCC}
& \vline & \rot{AAA} & \rot{BBB} &\rot{CCC}
& \vline & \rot{AAA} & \rot{BBB}
\\ \hline
\rowcolor[gray]{.9}
A &\vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} &{} & & \vline & & \cmark \tnote{1} \\
B &\vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} & {} & & \vline & {} & \cmark\tnote{1} \\
\rowcolor[gray]{.9}
C & \vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} &{} & &\vline & {} & {} \\
D & \vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} &{} & &\vline & {} & {} \\
\rowcolor[gray]{.9}
E & \vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} & {} & &\vline & {} & {} \\
F & \vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} & {} & & \vline & {} & \cmark \\
\rowcolor[gray]{.9}
G & \vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} & {} & & \vline & {} & {} \\
H & \vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} &{}& & \vline & {} & {} \\
\rowcolor[gray]{.9}
I & \vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} &{} & & \vline & {} & {} \\
J & \vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} &{} & &\vline & {} & \cmark \\
\rowcolor[gray]{.9}
K &\vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} & {} & & \vline & {} & {} \\
L & \vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} & {} & &\vline & {} & {} \\
\rowcolor[gray]{.9}
M & \vline & {} & {} & {} & \vline & {} & {} & {} & \vline & {} & {} &{} &\vline & {} &{} \\
\hline
\end{tabular}
%}%end resize boxs
\begin{tablenotes}\footnotesize
\item [1] A cute little footnote
\end{tablenotes}
\end{threeparttable}
\end{table*}
\lipsum
\end{document}