[texhax] Modifying number of the first table/figure

Heiko Oberdiek heiko.oberdiek at googlemail.com
Thu Jun 21 16:28:42 CEST 2012


On Thu, Jun 21, 2012 at 10:27:58AM -0300, Darío wrote:

> Hi list, my questions is whether possible numbering the first table or
> figure of a section or subsub...., because when compiling, the first
> table appears as number one, ie Table 1, and not as for example 3.4.1
> (where 3 is a section and 4 the subsection and 1 the number of table
> or figure).

\documentclass{article}

\makeatletter
\@addtoreset{table}{subsection}
\renewcommand*{\thetable}{\thesubsection.\arabic{table}}
\makeatother

\begin{document}
\section{First section}
\section{Second section}
\subsection{Subsection}
\begin{table}
\caption{Table caption in 2.1}
\end{table}
\section{Third section}
\subsection{First subsection}
\subsection{Second subsection}
\subsection{Third subsection}
\subsection{Fourth subsection}
\begin{table}
\caption{Table caption in 3.4}
\end{table}
\end{document}

If package amsmath is loaded, then its \numberwithin can be used:

\usepackage{amsmath}
\numberwithin{table}{subsection}

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list