1

I want to add an appendix section to one chapter in a latex document of class book.

I do not like the style of the subappendices package, where the appendices per chapter are quite highlighted. I like very much the style that the MWE below gives, but I have two problems: I currently manually number the appendix section as 2.A. The effort is okay with me, but the spacing is not quite right. More importantly, I don't know how to get the Lemma labeled ``2.A.1''.

If I add \renewcommand{\thesection}{2.A} before the Lemma in the appendix and \renewcommand{\thesection}{\arabic{\section}} (currently commented out in MWE) then the sections in the following chapter are not numbered within the chapter anymore (3.1 Three.One becomes 1 Three.One in the MWE)

\documentclass{book}
\usepackage{amsmath}
\newtheorem{lemma}{Lemma}[section]
\begin{document}
    \tableofcontents
    \chapter{One}
    \section{One.One}
    Test One.One
    \begin{lemma}
        This is numbered as desired.
    \end{lemma}
    \section{One.Two}
    Test One.Two
    \chapter{Two}
    \section{Two.One}
    Test Two.One
    \section{One.Two}
    Test Two.Two
    \section*{2.A Appendix: Pi}
    \addcontentsline{toc}{section}{2.A  Appendix: Pi}
    This section has a little bit too little space between ``2.A'' and ``Appendix: Pi'' (both here and more visibly in the ToC)
    %\renewcommand{\thesection}{2.A}
    \begin{lemma}
        This should be Lemma 2.A.1
    \end{lemma}
    %\renewcommand{\thesection}{\arabic{section}}
    \chapter{Three}
    \section{Three.One}
    Test Three.One
    \begin{lemma}
        This should be Lemma 3.1.1
    \end{lemma}
\end{document}
0

1 Answer 1

2
+50

Quick and dirty fix. Seems to do what you want.

\documentclass{book}
\usepackage{amsmath}
\newtheorem{lemma}{Lemma}[section]
\begin{document}
    \tableofcontents
    \chapter{One}
    \section{One.One}
    Test One.One
    \begin{lemma}
        This is numbered as desired.
    \end{lemma}
    \section{One.Two}
    Test One.Two
    \chapter{Two}
    \section{Two.One}
    Test Two.One
    \section{One.Two}
    Test Two.Two

{\setcounter{section}{0}
\renewcommand{\thesection}{\thechapter.\Alph{section}}
    \section{Appendix: Pi}%
    This section has a little bit too little space between ``2.A'' and ``Appendix: Pi'' (both here and more visibly in the ToC)
    \begin{lemma}
        This should be Lemma 2.A.1
    \end{lemma}
}
    \chapter{Three}
    \section{Three.One}
    Test Three.One
    \begin{lemma}
        This should be Lemma 3.1.1
    \end{lemma}
\end{document}
1
  • It does, will award bounty as soon as I can, thanks
    – Bananach
    Oct 23, 2018 at 14:46

You must log in to answer this question.

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