# Appendix and alphabetic appendix number problem

In the following MWE \appendix doesn't change the section numbering to Alph:

\documentclass{book}

\chapter{#1}\setcounter{secnumdepth}{2}}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter
\chapter{Foo}

\appendix
\section{Bar}

\end{document}

-
\appendix does change the chapter numbering style to \Alph, but your code does not contain any \chapter command after \appendix. Insert one and you'll see. –  Jubobs May 30 '13 at 20:03
@Jubobs I want an unnumbered appendix header "Mathematical Appendix" and then alphabetically numbered sections and subsections. So basically the way to go is to change the section counter to use alphabetical numbers? –  petobens May 30 '13 at 20:11
Normally, appendices are chapters, not sections. Why not simply use chapters? –  Jubobs May 30 '13 at 20:17
@Jubobs Thanks for your answer! I ended up doing what I said in my last comment. Should I accept your answer or post my comment as an answer? –  petobens May 30 '13 at 20:54
show 1 more comment

Normally appendices are chapters, not sections. I wouldn't deviate from that convention, if I were you. If you want an appendix heading, you can use \appendixpage from the appendix package.

Note: I've used the onside option here to get a more compact output (fewer blank pages).

\documentclass[oneside]{book}

\usepackage{appendix}
\renewcommand\appendixpagename{Mathematical Appendix}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter
\chapter{Foo}

\appendix
\appendixpage
\renewcommand\thechapter{M.\arabic{chapter}}

\chapter{Bar}

\end{document}


-

I ended up doing the following:

\documentclass{book}

\newcommand*{\bookappendix}[2]{%
\setcounter{secnumdepth}{-1}\chapter{#1}\setcounter{secnumdepth}{2}%
\setcounter{section}{0}\renewcommand*{\thesection}{{#2}.\arabic{section}}%
}

\begin{document}

\frontmatter
\tableofcontents

\mainmatter
\chapter{Foo}
\section{Faz}

\bookappendix{Mathematical Appendix}{M}
\section{Bar}
\subsection{Baz}

\bookappendix{Statistical Appendix}{S}
\section{Par}
\subsection{Paz}

\end{document}

-