我无法消除表格与表格和表格与文本之间的间隙

我无法消除表格与表格和表格与文本之间的间隙

尽管我付出了长时间的努力,但我还是无法消除表格之间的空格。

我的代码如下:

\documentclass[sigconf, nonacm]{acmart}
\usepackage[all=normal, floats, bibnotes, wordspacing, charwidths, indent, lists]{savetrees}
\usepackage{hyperref}

\makeatletter

\captionsetup{belowskip=0pt}

\belowcaptionskip 0pt

\skip\footins 0.5\baselineskip
\floatsep 0.5\baselineskip
\textfloatsep 0.5\baselineskip
\intextsep 0.5\baselineskip 
\dbltextfloatsep 0.5\baselineskip  
\dblfloatsep 0.5\baselineskip 


\usepackage{longtable}
\setlength\LTpre{0.5\baselineskip}
\setlength\LTpost{0.5\baselineskip}

\usepackage{titlesec}
\titlespacing\section{0pt}{0.5\baselineskip}{0pt}
\titlespacing\subsection{0pt}{0.5\baselineskip}{0pt}
\titlespacing\subsubsection{0pt}{0pt}{0pt}

\raggedbottom

\pagestyle{plain}

\begin{document}

\title{Title}

\maketitle

aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa


aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa

aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa aaa


\begin{table}[t]
  \small
  \centering
  \begin{tabular}{|c||c|c|c|c|c|c|}  
    \hline
    & A & B & C & D & E \\\hline\hline
    \textbf{\textsf{P}} & 0\% & 0\% & 0\% & 0\% & 0\% \\\hline 
    \textbf{\textsf{A + B}} & 0\% & 0\% & 0\% & 0\% & 0\% \\\hline    
  \end{tabular}
  \caption{This is a caption.}  
\end{table}

\begin{table}[t]
  \small
  \centering  
  \begin{tabular}{|c||c|c|c|c|c|c|}
    \hline
    & A & B & C & D & E \\\hline\hline
    \textbf{\textsf{A}} & 0\% & 7\% & 9\% & 0\% & 0\% \\\hline 
    \textbf{\textsf{A + B}} & 0\% & 0\% & 0\% & 0\% & 0\% \\\hline   
  \end{tabular}
  \caption{This is a caption.}  
\end{table}

\clearpage

\end{document}

上述代码产生以下输出:

我该如何消除间隙?如您所见,\dbltextfloatsep 0.5\baselineskip不起作用\dblfloatsep 0.5\baselineskip

答案1

尝试一下这个代码。

添加

\captionsetup[table]{position=bottom}
\setlength{\abovecaptionskip}{1ex} % 
\setlength{\belowcaptionskip}{-\baselineskip} 
\addtolength{\belowcaptionskip}{1ex}

设置标题上方和下方的空格。

需要这一行\captionsetup[table]{position=bottom} 是因为 ACM 期刊的风格是:

图表标题必须在图表主体之后输入,表格标题必须在表格主体之前输入。

因此该类使用 相应地设置标题上方和下方的空格\captionsetup[table]{position=top}

A

\documentclass[sigconf, nonacm]{acmart}
\usepackage[all=normal, floats, bibnotes, wordspacing, charwidths, indent, lists]{savetrees}
\usepackage{hyperref}

\usepackage{kantlipsum} % only for dummy text
%************************************** added <<<<<<<<<<<<
\captionsetup[table]{position=bottom}
\setlength{\abovecaptionskip}{1ex} % 
\setlength{\belowcaptionskip}{-\baselineskip} 
\addtolength{\belowcaptionskip}{1ex}
%********************************************

\skip\footins 0.5\baselineskip
\floatsep 0.5\baselineskip
\textfloatsep 0.5\baselineskip
\intextsep 0.5\baselineskip 
\dbltextfloatsep 0.5\baselineskip  
\dblfloatsep 0.5\baselineskip 
    
\usepackage{longtable}
\setlength\LTpre{0.5\baselineskip}
\setlength\LTpost{0.5\baselineskip}

\usepackage{titlesec}
\titlespacing\section{0pt}{0.5\baselineskip}{0pt}
\titlespacing\subsection{0pt}{0.5\baselineskip}{0pt}
\titlespacing\subsubsection{0pt}{0pt}{0pt}

\raggedbottom

\pagestyle{plain}

\begin{document}
        
    \title{Title}   
    \maketitle
    
    1. \kant[1-2]
    
    \begin{table}[ht!]
        \small
        \centering
        \begin{tabular}{|c||c|c|c|c|c|c|}  
            \hline
            & A & B & C & D & E \\\hline\hline
            \textbf{\textsf{P}} & 0\% & 0\% & 0\% & 0\% & 0\% \\\hline 
            \textbf{\textsf{A + B}} & 0\% & 0\% & 0\% & 0\% & 0\% \\\hline    
        \end{tabular}
        \caption{This is a caption.}  
    \end{table}
    
    \begin{table}[ht!]
        \small
        \centering  
        \begin{tabular}{|c||c|c|c|c|c|c|}
            \hline
            & A & B & C & D & E \\\hline\hline
            \textbf{\textsf{A}} & 0\% & 7\% & 9\% & 0\% & 0\% \\\hline 
            \textbf{\textsf{A + B}} & 0\% & 0\% & 0\% & 0\% & 0\% \\\hline   
        \end{tabular}
        \caption{This is a caption.}  
    \end{table}

    2. \kant[3-4]
    
    \clearpage
    
\end{document

用过的acmart.cls 2022/02/19 v1.83

相关内容