Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

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

2 Answers 2

A copy and paste from elsarticle.cls

\makeatletter
\renewcommand\appendix{\par
  \setcounter{section}{0}%
  \setcounter{subsection}{0}%
  \setcounter{equation}{0}%
  \setcounter{table}{0}%------------ << add
  \setcounter{figure}{0}%----------- << add
  \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}%
  \@addtoreset{equation}{section}%
  \@addtoreset{table}{section}%----- << add
  \@addtoreset{figure}{section}%---- << add
}
\makeatother
share|improve this answer
    
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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.