1

I would like to include per-chapter appendices in my long paper, which uses the amsbook document class. To do this, I use the subappendices environment from the appendix package (c.f. this older question). For instance, here is a simple minimal example:

\documentclass{amsbook}

\usepackage{appendix}
\usepackage{lipsum}

\begin{document}

\chapter{Some chapter title}

\section{Section title}
\lipsum[1]

\begin{subappendices}
\section{This should be an appendix}
\lipsum[1]
\end{subappendices}

\end{document}

The section header for the appendix appears as "1.A. This should be an appendix". So far so good, but I want to include the word "Appendix"---i.e. the section header should be "Appendix 1.A. This should be an appendix". Following the documentation for the appendix package, I pass the title option to the package. That is in the above example I change line 3 to

\usepackage[title]{appendix}

(with no other changes).

Problem. This results in the section header being "Appendix Appendix 1.A. This should be an appendix": the word Appendix appears twice! (If you change amsbook to book, then it works as expected.)

Question. Is there a way to work around this apparent conflict between the appendix package and amsbook, or is it easiest to do the appendix section numbering by hand in each chapter?

Remark: I dug around a bit in appendix.sty and I can't work out why this happens with amsbook. Bonus marks if you can explain what the bug is!

1 Answer 1

1

The problem is that appendix assumes that \@seccntformat is the same as in standard classes, which it isn't with amsbook.

\documentclass{amsbook}

\usepackage{appendix}
\usepackage{lipsum}

\makeatletter
%%% moderate surgery to amsbook
\def\@seccntformat#1{%
  \protect\textup{%
    \protect\@secnumfont
    \protect\elzenaar@appendix
    \csname the#1\endcsname
    \protect\@secnumpunct
  }%
}
%%% your setup
\newif\if@elzenaar@app
\AddToHook{env/subappendices/begin}{\@elzenaar@apptrue}
\def\elzenaar@appendix{\if@elzenaar@app\appendixname\ \fi}
\makeatother

\begin{document}

\chapter{Some chapter title}

\section{Section title}
\lipsum[1]

\begin{subappendices}
\section{This should be an appendix}
\lipsum[2]
\end{subappendices}

\end{document}

enter image description here

You must log in to answer this question.

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