表格编号错误:所有表格均有标题,但缺少一些数字

表格编号错误:所有表格均有标题,但缺少一些数字

我有一份很长的文档,其中包含许多表格。我检查了表格列表,发现表格的编号不正确,即

表 3.7,下一个表是表 3.9。我查找了它们之间的任何表格,但什么也没找到。有人知道为什么吗?所有表格都有标题并且位于表格环境中。

我不使用 MWE,因为它太长了

编辑:

我重现了错误

我使用的每一个包都有我文本的基本结构(也许有些包是问题所在)

如您所见,只有一个表,但它从 4.2 开始编号,而不是 4.1,上一节中的编号是正确的

\documentclass[12pt,a4paper]{article}
\usepackage{blindtext}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{xfrac}
\usepackage{textcomp}
\usepackage[bitstream-charter]{mathdesign}
\usepackage{makeidx}
\usepackage{graphicx,graphics}
\usepackage{bookmark}
\usepackage[%
    left=3.00cm,
    right=2.00cm,
    top=3.00cm,
    bottom=2.00cm
]{geometry}
\usepackage[none]{hyphenat}
\usepackage{multirow}
\usepackage{multicol}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{subcaption}
\usepackage{tocloft}
\usepackage[parfill]{parskip}
\usepackage{icomma}
\usepackage[%
    inline,     
    shortlabels     
]{enumitem}
\usepackage{bigstrut}
\usepackage{booktabs}
\usepackage{afterpage}
\usepackage{rotating}
\usepackage{microtype}
\usepackage{tabto}
\usepackage{acro}
\usepackage[%
    font=footnotesize,
    justification=centering,
    figurewithin=section,
    tablewithin=section
]{caption}
\usepackage{setspace}
\usepackage{siunitx}
\usepackage{sectsty}
\usepackage{secdot}
\usepackage{mfirstuc}
\usepackage[export]{adjustbox}
\usepackage{array}
\usepackage{colortbl}
\usepackage{makecell}
\usepackage{ltablex}
\usepackage{threeparttable}
\usepackage[referable]{threeparttablex}
\usepackage{pdfpages}
\usepackage{chemformula}
\usepackage[%
backend=biber,
citestyle=authoryear-comp,  
bibstyle=authoryear,        
giveninits=true,        
maxcitenames=2,         
uniquelist=false,           
sorting=ynt,            
sortcites,              
maxbibnames=99,         
url=false,              
eprint=false,           
dashed=false,           
]{biblatex}
\usepackage{hyperref}
\usepackage[%
noabbrev,
nameinlink
]{cleveref} 
\keepXColumns
\sloppy


\partfont{\centering}
\sectionfont{\raggedright\large\MakeUppercase}
\subsectionfont{\raggedright\normalsize\MakeUppercase}
\subsubsectionfont{\raggedright}
\paragraphfont{\raggedright\normalfont\em}
\setlength{\intextsep}{1.5\baselineskip}

\sectiondot{section}
\sectiondot{subsection}
\sectiondot{subsubsection}
\sectiondot{paragraph}

\setchemformula{radical-space = {0.4em}}

\linespread{1.3}


\assignrefcontextentries[]{*}



%%%%%%%%%%
\begin{document}
\listoftables
\section{Sec 1}%
\acresetall
%
\blindtext
%
\section{Sec 2}%
%
\blindtext
%
\section{Sec 3}%
\blindtext
\begin{table}[htb]
    \footnotesize
    \centering
    \caption{Table 3.1}
    \begin{tabular}{lccc}
        \midrule
        A & B & C & D\\
        \midrule
    \end{tabular}
    \label{tab:3.1}
\end{table}%
%
\section{Sec 4: Atention}%
\acresetall
%
\begin{figure}[htb]
\footnotesize
\centering
\includegraphics[width=0.5\textwidth]{example-image-a}
\begin{tabularx}{\linewidth}{rX}
\textbf{Item 1}     & Description \\
\textbf{Item 2}     & Long description \blindtext
\end{tabularx}
\caption{First figure}
\label{fig:1}
\end{figure}
%
\blindtext
%
\begin{figure}[htb]
\centering
\includegraphics[width=0.5\textwidth]{example-image-a}
\caption{Second figure}
\label{fig:2}
\end{figure}
%
\begin{table}[htb]
\footnotesize
\centering
\caption{Wrong numbered table}
\begin{tabular}{cccc}
\midrule
A & B & C & D\\
\midrule
\end{tabular}
\label{tab:4.1}
\end{table}%
%
\begin{table}[htb]
    \footnotesize
    \centering
    \caption{Table 2}
    \begin{tabular}{lccc}
\midrule
A & B & C & D\\
\midrule
    \end{tabular}
    \label{tab:4.2}
\end{table}%
%
\begin{table}[htb]
    \footnotesize
    \centering
    \caption{Table 4}
    \begin{tabular}{lccc}
        \midrule
        A & B & C & D\\
        \midrule
    \end{tabular}
    \label{tab:4}
\end{table}%

\end{document}

在此处输入图片描述

答案1

该问题是由tabularx图中(与ltablex包结合)引起的。

  • 作为一个快速破解,你可以将 -1 添加到表计数器

或者

  • (我的首选选项)使用描述进行描述:

\documentclass[12pt,a4paper]{article}

\usepackage{tabularx}
\usepackage{ltablex}

\begin{document}

\listoftables

\begin{figure}[htb]
\begin{tabularx}{\linewidth}{rX}
\textbf{Item 1}     & Description \\
\textbf{Item 2}     & Long description\\
\end{tabularx}
\caption{First figure}
\addtocounter{table}{-1}
\end{figure}

\begin{figure}[htb]
\begin{description}
\item[Item 1] Description
\item[Item 2] Long description
\end{description}
\caption{First figure}
\end{figure}

\begin{table}[htb]
\caption{Wrong numbered table}
\end{table}%

\end{document}

相关内容