Change Figure Numbering For Appendix
Answer :
Redefine \thefigure
when your appendices start, and set the figure counter to zero at the beginning of each appendix.
\documentclass{article} \begin{document} \begin{figure} \centering\rule{1cm}{1cm} \caption{This is a figure} \end{figure} \appendix \renewcommand\thefigure{\thesection.\arabic{figure}} \section{A nice appendix} \setcounter{figure}{0} \begin{figure} \centering\rule{1cm}{1cm} \caption{This is a figure in appendix A} \end{figure} \end{document}
You can use the chngcntr
package which includes the command \counterwithin
.
Using this as \counterwithin{figure}{section}
changes the figure numbering from that point on so that the section number is included and resets the numbering of figures at the beginning each subsequent section. An example is:
\documentclass{article} \usepackage{chngcntr} \begin{document} \section{Introduction} \subsection{Problem description} \begin{figure}[htp] \centering Figure \caption{Call this figure 1.} \label{fig1} \end{figure} \appendix \counterwithin{figure}{section} \section{Figures} \begin{figure}[htp] \centering Figure \caption{Call this figure A.1.} \label{figa1} \end{figure} \begin{figure}[htp] \centering Figure \caption{Call this figure A.2.} \label{figa2} \end{figure} \end{document}
A simple way to prepend an A to your appendix figures and to have the counter reset is to paste the following two lines before your first figure of the appendix.
\renewcommand{\thefigure}{A\arabic{figure}} \setcounter{figure}{0}
as illustrated here.
Comments
Post a Comment