# About numbering of figures and tables in appendix {elsarticle.cls}

When I am using elsarticle.cls to write papers, I always meet the following problem. If I already have one picture (table) in main text and then I put another picture (table) in appendix, the numbering of the picture (table) in appendix is not Figure A.1 (Table A.1) but Figure A.2 (Table A.2).

I tried to modify the elsarticle.cls by adding

\renewcommand\appendix{\par
\setcounter{section}{0}%
\setcounter{subsection}{0}%
\setcounter{equation}{0}
\setcounter{figure}{0}
\setcounter{table}{0}
....


But I failed, always encountering warnings and errors.

Here is the test code:

\documentclass[preprint,12pt]{elsarticle}
\begin{document}
\section{Test}
\begin{table}[h]
\caption{Test}\label{Tab_1}
\centering{}
\begin{tabular}{c|c}
\hline
$E(\mathrm{Mpa})$ & $\nu$\\
\hline
$6.8\times10^4$ & 0.21\\
\hline
\end{tabular}
\end{table}
\appendix
\section{Test}
\begin{table}[h]
\caption{Test}\label{Tab_2}
\centering{}
\begin{tabular}{c|c}
\hline
$E(\mathrm{Mpa})$ & $\nu$\\
\hline
$6.8\times10^4$ & 0.21\\
\hline
\end{tabular}
\end{table}
\end{document}


If we put picture we meet also the same problem.I do not know why this happen. Does mean that in appendix we can not put any table or figure? Can anyone help me out?

-
Could you make your snippet into a complete minimal working example (MWE)? –  cmhughes Feb 13 '13 at 16:47

A copy and paste from elsarticle.cls

\makeatletter
\renewcommand\appendix{\par
\setcounter{section}{0}%
\setcounter{subsection}{0}%
\setcounter{equation}{0}%
\gdef\theequation{\@Alph\c@section.\arabic{equation}}%
\gdef\thefigure{\@Alph\c@section.\arabic{figure}}%
\gdef\thetable{\@Alph\c@section.\arabic{table}}%
\gdef\thesection{\appendixname\@Alph\c@section}%
}
\makeatother

-
Wow, well done!!! thank you very much –  zengtaocn Feb 14 '13 at 2:53

Maybe, adding the following lines after \appendix helps?

\appendix
\numberwithin{equation}{section}
\numberwithin{figure}{section}
\numberwithin{table}{section}

-