表格编号不匹配

表格编号不匹配

我现在写论文,其中包含许多章节和小节。我遇到了表格编号的问题。我写了一个简单的表格,如

\begin{table}[h]
\centering
\caption{My first table}\label{table1}
\begin{tabular}{|c|c|}
\hline
a & b \\
\hline
c & d \\
\hline
\end{tabular}
\end{table}

在文本中我有参考\ref{table1},但在最后(在 .pdf 中)我得到了标题表 1.1:我的第一个表,但在文本中,此表有编号1.0。本节的下一张表格的标题为表 1.2但在文本中1.1。同时,我对、figure等编号没有任何问题。equationsection

如果有人遇到同样的问题并且知道解决方案,我会很高兴!

答案1

这是更为扩展的评论...

  • 你的问题不清楚
  • 从有问题的代码片段和你的答案(应该移到问题)是不可能重现你的问题
  • 在问题中,你表明表格编号是表 1.1等等。这意味着,您在实际文档中的某个地方重新定义了表格编号。可能使用
\renewcommand\thetable{\thesection.\arabic{table}}
  • 您无法得知所包含文件中到底有什么。在节的文本旁边是否还有一些格式化命令?
  • 尝试以下 MWE。它基于一些猜测和通常的标准文档结构:
    \documentclass[a4paper,12pt]{article}
    \usepackage{amsmath}                    % added
    \numberwithin{table}{section}           % added
    \renewcommand\thetable{\thesection.\arabic{table}}  % added

    \usepackage{graphicx, floatrow}
    \usepackage[dvips]{xcolor}              % changed
    \usepackage{graphicx,amsmath,amssymb}   % changed

    \usepackage{lipsum}                     % added for emulating of real text

    \begin{document}
    %\include{section-1}% example its content is: 
    \setcounter{table}{0}
    \section{first}
    \begin{table}[ht]
    \centering
    \caption{My first table.}\label{table:line-1}
    \begin{tabular}{|c|c|c|}
    \hline
    bla & bla & bla \\
    bla & bla & bla \\
    \hline
    \end{tabular}
    \end{table}
    \lipsum[11]

    %\include{section-2}% example its content is: 
    \section{second}
    \begin{table}[ht]
    \centering
    \caption{My second table.}\label{table:line-2}
    \begin{tabular}{|c|c|c|}
    \hline
    bla & bla & bla \\
    bla & bla & bla \\
    \hline
    \end{tabular}
    \end{table}
    \lipsum[11]
    \begin{table}[ht]
    \centering
    \caption{My third table.}\label{table:line-3}
    \begin{tabular}{|c|c|c|}
    \hline
    bla & bla & bla \\
    bla & bla & bla \\
    \hline
    \end{tabular}
    \end{table}
    Test of referencing: see table \ref{table:line-1}, \ref{table:line-2} and \ref{table:line-3}
    \end{document}

[![enter image description here][1]][1]

- as you can see, numbering of tables as well their referencing is as expected
- please, consider all comments below your question and try to complete your question that provided MWE will show your problems.


  [1]: https://i.stack.imgur.com/2lGR7.png

相关内容