views:

40

answers:

2

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.

+2  A: 

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.

Throwback1986
But if he wants that notation in small paper, to which article class is dedicated, classes report and book are useless. Unless you tune them to appear as article (lists on new page, large titles for chapter, twoside margins,...). If the paper is longer, your recommend is best way.
Crowley
A: 

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.

Aniko