[Tex/LaTex] How to have Appendix A continue by Appendix B

appendices

I want to make Appendix A continue by Appendix B. This is the command I used:

\appendix
\include{appendixA} \label{appendixprocedure}
\newpage{\pagestyle{empty}\cleardoublepage}

\include{appendixB} \label{appendixlinearization}
\newpage{\pagestyle{empty}\cleardoublepage}

But I got both in the naming Appendix A.

Best Answer

The only way I can reproduce this problem is by including the \appendix command inside your appendixA.tex and appendixB.tex. Here's an example that replicates this (even though it's an article without \includes, the principle remains the same):

enter image description here

\documentclass{article}

\begin{document}

\tableofcontents

\section{A section}

\appendix
\section{An appendix}

\appendix
\section{Another appendix}

\end{document}

If this is what you're doing, you're doing it wrong. \appendix resets appendix-specific counters (which may depend on your document class). Here's what \appendix does in book and report (comments added):

\newcommand\appendix{\par
  \setcounter{chapter}{0}% <--- Reset chapter counter
  \setcounter{section}{0}% <--- Reset section counter
  \gdef\@chapapp{\appendixname}%
  \gdef\thechapter{\@Alph\c@chapter}}

article does something similar, only one level down:

\newcommand\appendix{\par
  \setcounter{section}{0}% <--- Reset section counter
  \setcounter{subsection}{0}% <--- Reset subsection counter
  \gdef\thesection{\@Alph\c@section}}

It is obvious that \appendix reset the main appendix counters, so including it as part of every appendix unit is incorrect. Only use it once to demarcate the end of your regular chapters and the start of the appendices.

In conclusion, remove \appendix from your appendixA.tex and appendixB.tex.

Some things to note in your code:

  • Your \labels might not reference the correct location within your document, as it is only called at the end of every appendix.

  • \newpage does not take an argument, so don't use \newpage{..}.

  • If you want a blank (no header/footer) page between your appendices, consider reading Really blank pages between chapters or creating a page break command.

Related Question