1

I have multiple appendices and use the appendix package to name them

Appendix A    Some Title
Appendix B    Different Title

Now these appendices contain tables and figures and I would like to refer to them by their appendix letter. That is, in Appendix A, they should be called Figure A1 or Figure A2, whereas in Appendix B, this should be Figure B1and so forth.

I could declare at the beginning of each appendix,

\renewcommand\thefigure{A\arabic{figure}} 
\renewcommand\thetable{A\arabic{table}} 

and vary the A\arabic{...} part but I wondered whether there is a variable holding the appendix letter. Assuming this variable is called \appxletter, I could then declare once

\renewcommand\thefigure{\appxletter\arabic{figure}} 
\renewcommand\thetable{\appxletter\arabic{table}} 

and only reset the counters for each appendix (unless this can also be automated?). Is there something that makes this possible?

4
  • 1
    Exactly what I needed! Make it an answer? I use the article class.
    – bumblebee
    Aug 19, 2020 at 7:56
  • Off-topic: If you want the appendix sectioning headers to say "Appendix A <Some material>", "Appendix B <Some more material>", etc rather than just "A <Some material>", "B <Some more material>", etc, do take a look at the posting Having 'Appendix A' instead of 'A Appendix'. That query employs the llncs document class; however, the suggested solutions work with the article class as well.
    – Mico
    Aug 19, 2020 at 8:38
  • 1
    Thanks! I use \usepackage[title]{appendix}, which accomplishes the same goal, I believe.
    – bumblebee
    Aug 19, 2020 at 8:44
  • You are correct!
    – Mico
    Aug 19, 2020 at 9:06

1 Answer 1

2

Given that you employ the article document class along with the appendix package, the following instructions -- to be placed after the \appendix instruction -- will let you achieve your formatting objectives for the caption numbers of figure and table environments placed in one of the document's appendices:

\counterwithin{figure}{section}
\counterwithin{table}{section}
\renewcommand\thefigure{\thesection\arabic{figure}}
\renewcommand\thetable{\thesection\arabic{table}}

The first two instructions tell LaTeX to reset the figure and table counters to zero each time a \section directive is encountered within the appendix. The final two instructions determine how the caption numbers are displayed, viz., by prefixing the section letters (A, B, etc) to the table and figure arabic numerals.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .