如何将表格放入单列中

如何将表格放入单列中

我正在使用 ACM 会议模板 sample-sigconf.tex这里参加 ACM 会议。我有一张比列宽略宽的桌子。我的空间有限,所以我不想使用 {table*} 将其放在中间,因为这会浪费我需要的一些空白空间。这说明了这个问题:

在此处输入图片描述

我怎样才能将表格放入一列中,即使这会使其稍微缩小一点?

脚本如下:

\documentclass[sigconf]{acmart}
\usepackage[T1]{fontenc} %to solve the font error
\usepackage{lmodern}  %to solve the font error
\usepackage{underscore} %underscores
%-------------------------for the table-----------------------------        
\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}
%-------------------------end table-----------------------------
\usepackage{lipsum}

% Copyright
%\setcopyright{none}
%\setcopyright{acmcopyright}
%\setcopyright{acmlicensed}
\setcopyright{rightsretained}
%\setcopyright{usgov}
%\setcopyright{usgovmixed}
%\setcopyright{cagov}
%\setcopyright{cagovmixed}


\begin{document}
\title{Title}

\subtitle{Test}

\author{Author}
\affiliation{%
  \institution{XYZ}}
\email{abc@xyz}

\begin{abstract}
Abstract goes here. 
\end{abstract}

\maketitle
\section{Introduction}
\lipsum

\begin{table}[tp]
\caption{Levels.}
\vspace*{-5mm}
\label{table:levels}
\centering
\begin{tabular}{ll}
\\ \toprule
A & B \\ \midrule

AA and BBBB & \begin{tabular}{l} aaaaabbbbccccddddeeeeffffgggghhhhiiiijjjj \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \end{tabular} \\
\hline
AA and BBBB & \begin{tabular}{l} aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \end{tabular} \\

\hline
AA and BBBB & \begin{tabular}{l} aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \\
                                 aaaaabbbbccccddddeeeeffffggggh \end{tabular} \\
\bottomrule
\end{tabular}
\end{table}  

\end{document}

答案1

编辑:我仔细查看了你那不那么小的 MWE。你已经开始加载了。tabularxmultirow这样:

\documentclass[twocolumn]{article}
\usepackage{tabularx,multirow,booktabs,blindtext}
\begin{document}
    \begin{table}
    \centering
    \begin{tabularx}{\linewidth} {lX}
    \toprule
    A & B\\
    \midrule
    \multirow{12}{.3\linewidth}{AA and BBBB }& aaaaa bbbb ccccd ddeeeef fffggggh \\
    &   aaaaa bbbb ccccd ddeeeef fffggggh \\
    &   aaaaabb bbccc cddd deeeefff fggggh \\
    &   aaaaabbb bccccd dddeeee ffffggggh \\
    &   aa aaabbbbccc cddddeeeeffffggggh \\
    &   a aaaa bbbbc cccddddeee effffggggh \\
    a & b\\
    \multirow{12}{.3\linewidth}{CC and DDD }& aaaaa bbbb ccccd ddeeeef fffggggh \\
    &   aaaaa bbbb ccccd ddeeeef fffggggh \\
    &   aaaaabb bbccc cddd deeeefff fggggh \\
    &   aaaaabbb bccccd dddeeee ffffggggh \\
    &   aa aaabbbbccc cddddeeeeffffggggh \\
    &   a aaaa bbbbc cccddddeee effffggggh \\
    \bottomrule
    \end{tabularx}
    \end{table}
\blinddocument
\end{document}

截屏

相关内容