同一章中不同小节中的两个表格显示不同的表格编号。(无连续性)

同一章中不同小节中的两个表格显示不同的表格编号。(无连续性)

以下是代码:

\documentclass{article}
\thispagestyle{plain} % To force page numbering when using conference IEEEtran
\pagestyle{plain} % To force page numbering when using conference IEEEtran
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\newcommand{\subfigureautorefname}{\figureautorefname} % For autoref to name subfloats as Figure
\renewcommand{\tablename}{Table}

%%%%%%%%%% FIGURES %%%%%%%%%%%
\usepackage[justification=centering]{caption} % Figures caption
\usepackage{graphicx}
\captionsetup{labelsep = period} % Figure 2. Caption (rather than Figure 2: Caption)
%\usepackage{float} % To place figures where I want with [H]
\renewcommand{\figurename}{Fig.} % Fig.2 (rather than Figure 2)
\usepackage[export]{adjustbox}
\usepackage{caption, subcaption, floatrow}
\def \hfillx {\hspace*{-\textwidth} \hfill}
\begin{document}
\section{Second}

\subsection{Second in Second}

\subsubsection{Second in Second in Second}

\begin{table}[H]
           \centering
           \captionsetup[subtable]{position = below}
          \captionsetup[table]{position=top}
           \caption{Blahblah}
           \begin{subtable}{0.3\linewidth}
               \centering
               \begin{tabular}{|c|c|}
                   \hline
                   \textbf{h [m]} & \textbf{dim [m]} \\ \hline
                   30 & 0.75 \\ \hline
                   50 & 1.25 \\ \hline
                   70 & 1.75 \\ \hline
                   100 & 2.50 \\ \hline
               \end{tabular}
               \caption{Minimum dimension of an object for it to be detected by the FFT algorithm at different heights}
               \label{tab:dimFFT}
           \end{subtable}%
           \hspace*{4em}
           \begin{subtable}{0.3\linewidth}
               \centering
               \begin{tabular}{|c|c|}
                   \hline
                   \textbf{h [m]} & \textbf{dim [m]} \\ \hline
                   30 & 0.28 \\ \hline
                   50 & 0.47 \\ \hline
                   70 & 0.66 \\ \hline
                   100 & 0.94 \\ \hline
               \end{tabular}
                \caption{Minimum dimension of an object for it to be detected by the GMM algorithm at different heights}
                 \label{tab:dimGMM}
           \end{subtable}
       \end{table}



 \section{First}

 \subsection{First in First}

 \subsubsection{First in First in First}

\begin{table}[H]
           \centering
           \captionsetup[subtable]{position = below}
          \captionsetup[table]{position=top}
           \caption{Blahblah}
           \begin{subtable}{0.3\linewidth}
               \centering
               \begin{tabular}{|c|c|}
                   \hline
                   \textbf{h [m]} & \textbf{dim [m]} \\ \hline
                   30 & 0.75 \\ \hline
                   50 & 1.25 \\ \hline
                   70 & 1.75 \\ \hline
                   100 & 2.50 \\ \hline
               \end{tabular}
               \caption{Minimum dimension of an object for it to be detected by the FFT algorithm at different heights}
               \label{tab:dimFFT}
           \end{subtable}%
           \hspace*{4em}
           \begin{subtable}{0.3\linewidth}
               \centering
               \begin{tabular}{|c|c|}
                   \hline
                   \textbf{h [m]} & \textbf{dim [m]} \\ \hline
                   30 & 0.28 \\ \hline
                   50 & 0.47 \\ \hline
                   70 & 0.66 \\ \hline
                   100 & 0.94 \\ \hline
               \end{tabular}
                \caption{Minimum dimension of an object for it to be detected by the GMM algorithm at different heights}
                 \label{tab:dimGMM}
           \end{subtable}
       \end{table}


\end{document}

执行它并检查表号。

第一个小节里面的表格是表 1。

下一节中的下一小节中的表格变成了表格 3。?这怎么可能?这有什么问题?请帮忙。

答案1

问题似乎是由于\caption子表之前有导致table计数器增加两次。但出于某种原因,如果\captionsubtable环境之后,则不会出现问题。

我已经修复了下面的问题,并且还清理了一些东西。我还利用它booktabs让桌子看起来更漂亮一点,不像监狱牢房 :)

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage{booktabs}

\usepackage{caption}
\usepackage{subcaption}
\usepackage{floatrow}

\captionsetup{labelsep = period}
\renewcommand{\figurename}{Fig.} % Fig.2 (rather than Figure 2)

\begin{document}

\section{Second}

\begin{table}[H]
  \centering
  %% Try (un)commenting out the following two lines, and doing to opposite at
  %% the bottom two lines
  % \label{tab:Second}
  % \caption{Blahblah}
  \begin{subtable}{0.45\linewidth}
    \centering
    \begin{tabular}{cc}
      \toprule
      \textbf{h [m]} & \textbf{dim [m]} \\
      \midrule
      30 & 0.75 \\
      50 & 1.25 \\
      70 & 1.75 \\
      100 & 2.50 \\
      \bottomrule
    \end{tabular}
    \caption{Minimum dimension of an object for it to be detected by the FFT algorithm at different heights}
    \label{subtab:dimFFT}
  \end{subtable}%
  \hspace*{\fill}
  \begin{subtable}{0.45\linewidth}
    \centering
    \begin{tabular}{cc}
      \toprule
      \textbf{h [m]} & \textbf{dim [m]} \\
      \midrule
      30 & 0.28 \\
      50 & 0.47 \\
      70 & 0.66 \\
      100 & 0.94 \\
      \bottomrule
    \end{tabular}
    \caption{Minimum dimension of an object for it to be detected by the GMM
      algorithm at different heights}
    \label{subtab:dimGMM}
  \end{subtable}
  \label{tab:Second}
  \caption{Blahblah}
\end{table}

\section{First}

\begin{table}[H]
  \centering
  \begin{subtable}{0.45\linewidth}
    \centering
    \begin{tabular}{cc}
      \toprule
      \textbf{h [m]} & \textbf{dim [m]} \\
      \midrule
      30 & 0.75 \\
      50 & 1.25 \\
      70 & 1.75 \\
      100 & 2.50 \\
      \bottomrule
    \end{tabular}
    \caption{Minimum dimension of an object for it to be detected by the FFT
      algorithm at different heights}
    \label{subtab:dimFFT}
  \end{subtable}
  \hspace*{\fill}
  \begin{subtable}{0.45\linewidth}
    \centering
    \begin{tabular}{cc}
      \toprule
      \textbf{h [m]} & \textbf{dim [m]} \\
      \midrule
      30 & 0.28 \\
      50 & 0.47 \\
      70 & 0.66 \\
      100 & 0.94 \\
      \bottomrule
    \end{tabular}
    \label{subtab:dimGMM}
    \caption{Minimum dimension of an object for it to be detected by the GMM
      algorithm at different heights}
  \end{subtable}
  \label{tab:first}
  \caption{Blahblah}
\end{table}

\end{document}

输出

相关内容