简体   繁体   English

LaTex表编号

[英]LaTex table numbering

How could I number the tables in my article chapter based ? 如何根据文章章节中的表格编号? So I want all the tables in the fifth section to be numbered like "Table 5.1", ..., "Table 5.n". 因此,我希望第五部分中的所有表都被编号为“ Table 5.1”,...,“ Table 5.n”。

I tried 我试过了

\usepackage{chngcntr}

\counterwithin{figure}{section}

\counterwithin{table}{section}

\counterwithin{equation}{section}

but I am having some problems (missing package I guess). 但我遇到了一些问题(我想缺少包装)。

However, I need a simpler solution, without the need to use such packages. 但是,我需要一个更简单的解决方案,而无需使用此类软件包。

The article class doesn't have chapters. 文章类没有章节。 Try the book or report classes - you'll find that the tables and figures are automatically numbered according to chapter. 尝试书籍或报告类-您会发现表格和数字会根据章节自动编号。

Here is a solution without the use of any package (courtesy of "The Latex Companion", A1.4): 这是不使用任何程序包的解决方案(由“ The Latex Companion”,A1.4提供):

\makeatletter
\renewcommand{\thetable}{\thesection.\@arabic\c@table}
\@addtoreset{table}{section}
\makeatother

This resets the table counter whenever a new section is started, and formats it as sectionno.tableno instead of just tableno . 每当启动新节时,此操作都会重置表计数器,并将其格式化为sectionno.tableno而不是tableno You can change the figure and equation counters similarly. 您可以类似地更改figureequation计数器。

If you are using the amsmath package (or an AMS class like amsart that loads it automatically), you can use 如果您使用的是amsmath软件包(或自动加载的amsart类的AMS类),则可以使用

\numberwithin{table}{section}

This was created for equations, but works for any pair of counters though supposedly there might be tricky situations that it does not handle well. 这是为方程式创建的,但适用于任何一对计数器,尽管据称可能存在棘手的情况,但处理效果不佳。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM