# Number chapters as 01, 02, … , 10, 11, … appendices A, B

Minimal example (the problem is obvious):

\documentclass[]{report}

\makeatletter
\vspace*{-5.0em}
{\parindent \z@  \normalfont
\interlinepenalty\@M
\LARGE{0\thechapter}
\par\vspace{0.25cm}
\flushleft\MakeUppercase{#1}}
\par\vspace{3.5em}
}
\makeatother

\begin{document}

\chapter{First Chapter}
\setcounter{chapter}{9}
\chapter{Tenth Chapter}

\appendix
\chapter{Appendix A}

\end{document}


Edit: I forgot to mention something important. Only the displayed chapter numbers should have 0s in front of them, not definitions, theorems, etc. That is: Chapter 01, Definition 1.1., etc.

You can adjust the printing of \thechapter within \@makechapterhead to insert a 0 only if the value of the chapter counter is less than 10:

\documentclass{report}

\usepackage{etoolbox}

\makeatletter
{\thechapter}% <search>
{\expandafter\ifx\@chapapp\appendixname\else\ifnum\value{chapter}<10 0\fi\fi\thechapter}% <replace>
{}{}% <success><failure>
\makeatother

\usepackage{amsthm}
\newtheorem{thm}{Theorem}[chapter]

\begin{document}

\chapter{First Chapter}

\begin{thm}
A first theorem
\end{thm}
\setcounter{chapter}{9}
\chapter{Tenth Chapter}

\appendix
\chapter{Appendix A}
\begin{thm}
Another theorem
\end{thm}

\end{document}


The nested condition in the "replacement clause" of \patchcmd first checks whether you're in the appendix or not. If you aren't, then it prepends the \thechapter counter with 0, similar to the kernel \two@digits macro.

• +1; Your patch is basically the command \two@digits defined in the LaTeX kernel, so you could just write \two@digits{\thechapter}. – Pier Paolo Jun 7 '15 at 14:51
• @Mico: Thanks for picking that up. I've corrected for this in the updated post. – Werner Jun 9 '15 at 6:01

Easy with \numprintand its \nplpadding command:

\documentclass[]{report}

\usepackage{numprint, apptools}

\makeatletter
\vspace*{-5.0em}
{\parindent \z@ \normalfont
\interlinepenalty\@M
\par\vspace{0.25cm}
\flushleft\MakeUppercase{#1}}
\par\vspace{3.5em}
\makeatother

\usepackage{amsthm}
\newtheorem{thm}{Theorem}[chapter]

\begin{document}

\chapter{First Chapter}

\begin{thm}
A first theorem
\end{thm}
\setcounter{chapter}{9}
\chapter{Tenth Chapter}

\appendix
\chapter{Appendix A}
\begin{thm}
Another theorem
\end{thm}

\end{document}


• Actually there's something I forgot to mention (sorry). I only want the displayed chapter numbers to have 0s. The definitions, theorems, etc. will be labeled normally. Any way to fix that? I'll leave the answer accepted because it's not that big of a deal, but I would like to fix it if possible. – Randy Randerson Jun 6 '15 at 13:53
• @RandyRanderson: please see my updated answer. – Bernard Jun 6 '15 at 14:07
• @Mico: with \newtheorem{thm}{Theorem}[chapter], it is modified, so I had to change my code. – Bernard Jun 6 '15 at 14:09
• Shouldn't the chapter numbering style be reset explicitly to \Alph in the appendix? Without such a reset, one would seem to get "01" in the page header instead of "A". – Mico Jun 6 '15 at 14:18
• It doesn't have to. It seems the \appendix switch does it.removed. It's fixed now. – Bernard Jun 6 '15 at 14:23

Here is a solution for ConTeXt users to force double digit numbers for the chapters. With the use of the \startsectionblockenvironment command one could provide setups which are only applied for a certain sectionblock environment.

\startsectionblockenvironment[bodypart]
\stopsectionblockenvironment

\starttext

\startsectionblock[bodypart]

\chapter{First chapter}

\stopsectionblock

\startsectionblock[appendix]

\chapter{Appendix A}

\stopsectionblock

\stoptext


To have the same layout for the heading with the number on a separate line one has to write its own rendering alternative for it.

\defineheadalternative
[stacked]
[alternative=vertical,

\vbox {
\begstrut
\par
\fi

After this is done with can load this new rendering with the alternative key from \setuphead.
\setuphead