In my thesis I have several appendices, which are defined via \section{First Appendix}
, \section{Second Appendix}
, etc. latex statements. The appendices have the following titles (hence, appear like this in the table of contents): A First Appendix, B Second Appendix, etc.
These appendices include listings and figures. Currently, the listings in the appendices are numbered as follows:
- A.1 First Listing of Appendix A
- A.2 Second Listing of Appendix A
- B.3 First Listing of Appendix B
- C.4 First Listing of Appendix C
However, I would like to have the following numbering (I think it's more intuitive and looks nicer):
- A.1 First Listing of Appendix A
- A.2 Second Listing of Appendix A
- B.1 First Listing of Appendix B
- C.1 First Listing of Appendix C
In other words, after each new appendix (which is defined via \section{Second Appendix}
), I want the listings/figures/tables counter to be reset. In the main content of the thesis this is done automatically. I do not know why this is not the case in the appendix.
Note, that I use the following commands to achieve the desired numbering of figures/listings/tables which appear in the appendix:
\renewcommand{\thelstlisting}{\Alph{section}.\arabic{lstlisting}}
\renewcommand\thetable{\Alph{section}.\arabic{table}}
\renewcommand\thefigure{\Alph{section}.\arabic{figure}}
Best Answer
Add the
lstlisting
counter to the reset list of thesection
counter with\counterwithout*{lstlisting}{section}
-- the
*
prevents redefinition of\thelstlisting
then!Saying
this will automatically enable this specific style of resetting if
\appendix
is used.