Add an appendix in LaTeX (appendix)
Write \appendix once, before the first appendix. From there on \section (in article) or \chapter (in report and book) is numbered with the letters A, B, C.
Preamble
The snippets on this page need these lines before \begin{document}:
\usepackage{graphicx}Appendix in an article
\appendix takes no argument and prints nothing. It resets the section counter and switches its format to capital letters. \ref to a label in the appendix prints the letter.
\section{Results}
The raw data is listed in appendix~\ref{app:data}.
\appendix
\section{Raw data}\label{app:data}
Text of appendix A.
\section{Proofs}
Text of appendix B.Appendix with chapters
In report and book the chapters after \appendix are headed "Appendix A", "Appendix B" in place of "Chapter 1".
Complete document:
\documentclass{report}
\begin{document}
\chapter{Results}
Text of chapter 1.
\appendix
\chapter{Raw data}
Text of appendix A.
\end{document}Number figures as A.1, A.2
In article the figure and table numbers continue in the appendix. \counterwithin{figure}{section} after \appendix restarts the figure counter in every appendix and puts the letter in front.
\appendix
\counterwithin{figure}{section}
\counterwithin{table}{section}
\section{Raw data}
\begin{figure}[h]
\centering
\includegraphics[width=4cm]{image.png}
\caption{This figure has the number A.1}
\end{figure}A heading and a contents entry for all appendices
The appendix package provides the appendices environment. The option toc adds the line "Appendices" to the table of contents, page prints that word as a heading before the first appendix, and titletoc writes "Appendix A" in place of "A" in the table of contents.
Complete document:
\documentclass{article}
\usepackage[toc, page, titletoc]{appendix}
\begin{document}
\tableofcontents
\section{Results}
Text of the section.
\begin{appendices}
\section{Raw data}
Text of appendix A.
\end{appendices}
\end{document}Pitfalls
\appendixis a switch, not a heading:\appendix{Raw data}prints "Raw data" as plain text. The heading comes from the\sectionor\chapterafter it.- Use it only once. Everything up to the end of the document counts as appendix, so the bibliography usually comes before it or is added with a starred heading.
Compiled with pdfLaTeX from TeX Live 2023.
Related pages
- Package
appendix - How-to Sections, subsections and chapters in LaTeX
- How-to Create a table of contents in LaTeX
- How-to Counters in LaTeX
- How-to Set up a thesis in LaTeX
- Package
graphicx