禁止将 fbox、parbox、minipage 计为表格

禁止将 fbox、parbox、minipage 计为表格

我遇到了一个问题,即 fbox、parbox 或 minipage 被算作一个表。例如,我添加了与我的设置类似的示例代码。此代码导致第一个表被编号为表 1,第二个表(fbox 之后)被编号为表 3。显然 fbox 不是表,但出于某种原因被算作表。

\documentclass[acmsmall]{acmart} 
\usepackage{booktabs} % For formal tables
\usepackage{subcaption}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{color}
\usepackage{colortbl}
\usepackage{tabularx,colortbl}
\usepackage{caption}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{enumitem}
\usepackage{ltablex}
\usepackage{makecell}
\usepackage{lscape}
\usepackage{xcolor}
\usepackage{varwidth}
\usepackage{caption}

\usepackage[font=small,skip=5pt,belowskip=-1pt]{caption}
\setlength{\skip\footins}{0.4cm}
\setlength{\belowcaptionskip}{-1pt}
\usepackage{url}
\usepackage{graphics}
\newcommand*{\affmark}[1][*]{\textsuperscript{#1}}
\fancyhead{}
\makeatletter
\let\@authorsaddresses\@empty
\makeatother

\acmConference[SIGIR '20]{XXX}{XXX}{XXX}
\renewcommand\footnotetextcopyrightpermission[1]{} 
\settopmatter{printacmref=false}

\settopmatter{printacmref=false}
\usepackage{amssymb}
\usepackage{balance}
\usepackage{array}

\usepackage{appendix}

\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}

\newcolumntype{Y}{>{\centering\arraybackslash}X}% for centering text horizontally

\usepackage{array}\newcolumntype{R}{>{\raggedright\arraybackslash}X}

\renewcommand\tabularxcolumn[1]{m{#1}}% for vertical centering text in X column

\definecolor{LightGrey}{rgb}{0.93,0.93,0.93}

\newcommand\boldgray[1]{\cellcolor{lightgray}{\textbf{#1}}}
\newcommand\boldGrey[1]{\cellcolor{LightGrey}{\textbf{#1}}}
\newcommand{\tabitem}{~~~~~\textbullet~~}

\definecolor{mygrey}{gray}{0.8}

\begin{document}

\begin{table}[h]
\vspace{-.1cm}
\small
\caption{Caption for table 1.}
\label{tab:table-1}
\centering
\begin{tabularx}{\textwidth}{|Y|X|}
\hline
\textbf{Example Column A} & \textbf{Example Column B} \\ 
\hline
Contents A
& Contents B \\ 
\hline
\end{tabularx}
\end{table}

\vspace{0.3cm}
\begin{center}
\setlength{\fboxsep}{.5em}
\noindent\fbox{\begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}
    \parbox{\textwidth}{%

\emph{Title for List}: Description of the list. (create/conceptual)
\begin{itemize}[topsep=8pt]
\small
 \item First list item
 \item ...
 \item Last list item
 \end{itemize}
     }
\end{minipage}}

\end{center}
\vspace{0.3cm}

\begin{table}[h]
\vspace{-.1cm}
\small
\caption{Caption for table 2.}
\label{tab:table-2}
\centering
\begin{tabularx}{\textwidth}{|Y|X|}
\hline
\textbf{Example Column C} & \textbf{Example Column D} \\ 
\hline
Contents C
& Contents D \\ 
\hline
\end{tabularx}
\end{table}

\end{document}

我如何抑制 fbox 或 parbox 或 minipage 的编号,无论哪个触发编号被包含在表格编号中?

我尝试使用 caption 包并添加一个空的 \caption*{}。这没有用。

答案1

罪魁祸首是ltablex

如果我从(重组的)序言中对其进行评论,则输出是

在此处输入图片描述

一旦我取消注释\usepackage{ltablex},我就会得到

在此处输入图片描述

您会发现,除了编号错误之外,表格的形状也发生了变化。

\documentclass[acmsmall]{acmart} 
\usepackage{mathtools}
\usepackage{graphicx}
%\usepackage{amssymb}% not with acmart
%\usepackage{balance}
\usepackage{array}

\usepackage{booktabs} % For formal tables
\usepackage[font=small,skip=5pt,belowskip=-1pt]{caption}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage{enumitem}
%\usepackage{ltablex} % <--- this is the problem
\usepackage{makecell}
\usepackage{url}
%\usepackage{appendix}

%\setlength{\skip\footins}{0.4cm}
%\setlength{\belowcaptionskip}{-1pt}
\newcommand*{\affmark}[1][*]{\textsuperscript{#1}}

\fancyhead{}
\makeatletter
\let\@authorsaddresses\@empty
\makeatother

\acmConference[SIGIR '20]{XXX}{XXX}{XXX}
\renewcommand\footnotetextcopyrightpermission[1]{} 
\settopmatter{printacmref=false}
\settopmatter{printacmref=false}

\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\newcolumntype{Y}{>{\centering\arraybackslash}X}% for centering text horizontally
\newcolumntype{R}{>{\raggedright\arraybackslash}X}

\renewcommand\tabularxcolumn[1]{m{#1}}% for vertical centering text in X column

\definecolor{LightGrey}{rgb}{0.93,0.93,0.93}
\definecolor{mygrey}{gray}{0.8}

\newcommand\boldgray[1]{\cellcolor{lightgray}{\textbf{#1}}}
\newcommand\boldGrey[1]{\cellcolor{LightGrey}{\textbf{#1}}}
\newcommand{\tabitem}{~~~~~\textbullet~~}


\begin{document}

\begin{table}[h]
\small
\caption{Caption for table 1.}
\label{tab:table-1}
\centering
\begin{tabularx}{\textwidth}{|Y|X|}
\hline
\textbf{Example Column A} & \textbf{Example Column B} \\ 
\hline
Contents A
& Contents B \\ 
\hline
\end{tabularx}
\end{table}

\begin{center}
\setlength{\fboxsep}{.5em}
\fbox{%
  \begin{minipage}{\dimexpr\textwidth-2\fboxsep-2\fboxrule\relax}
  \emph{Title for List}: Description of the list. (create/conceptual)
  \begin{itemize}[topsep=8pt]
  \item First list item
  \item ...
  \item Last list item
  \end{itemize}
  \end{minipage}
}% end of \fbox
\end{center}

\begin{table}[h]
\small
\caption{Caption for table 2.}
\label{tab:table-2}
\centering
\begin{tabularx}{\textwidth}{|Y|X|}
\hline
\textbf{Example Column C} & \textbf{Example Column D} \\ 
\hline
Contents C
& Contents D \\ 
\hline
\end{tabularx}
\end{table}

\end{document}

不要多次加载包,并将设置与包加载分开。

我不确定您是否应该使用 加载或balance,也不确定您是否想更改 和 等参数。不要加载,因为该类使用的字体已经支持这些符号,您只会得到一个恼人的错误。appendixacmart\skip\footins\belowcaptionskipamssymb

相关内容