简体   繁体   中英

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".

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):

\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 . You can change the figure and equation counters similarly.

If you are using the amsmath package (or an AMS class like amsart that loads it automatically), you can use

\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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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