I have a long (mathematical) document with parts, sections, subsections and paragraphs. The theorems etc. in the parts are numbered

Theorem 1.2.3

where the first number corresponds to the section, the second number to the subsection and the third to the number of the theorem, example, etc.

In the appendix (and only in the appendix), I will only use sections, no subsections. By default, a lemma in the appendix is numbered as

Lemma A.0.1

for the first lemma in the first appendix. I would like to suppress the subsection number (only in the appendix), so that the first lemma in the first appendix is numbered as

Lemma A.1

I have tried to add \setcounter{secnumdepth}{1} after the \appendix command, but nothing changed.

  • 1
    Try \renewcommand{\thetheorem}{\thesection.\arabic{theorem}} after you've started you Appendix.
    – Werner
    Commented Sep 7, 2013 at 13:53
  • @Werner Almost works. The numbering is carried on from the last section (presumably because the Lemma number is dependent on the subsection counter). So, if the last section had 4 lemmas, then the first lemma of the appendix is numbered Lemma A.5. Do I need to redefine all my theorems/lemmas/etc.? Is that possible outside of the preamble?
    – Earthliŋ
    Commented Sep 7, 2013 at 14:06
  • Try loading the package chngcntr and putting \counterwithin{theorem}{section} after \appendix. Commented Sep 7, 2013 at 14:34
  • Obviously, if theorem is not your counter, replace it with the one you-re using, e.g. lemma. Commented Sep 7, 2013 at 14:46
  • @karlkoeller That works, thank you very much. Could you post your solution as an answer?
    – Earthliŋ
    Commented Sep 7, 2013 at 15:24

1 Answer 1


If your lemmas use the theorem counter as in the MWE below, you can insert the line


just after the \appendix command. Note that you have to load the package chngcntr to be able to use \counterwithin.



\usepackage{lipsum}  % just for the example



\section{1st section}
\subsection{1st subsection}

\section{2nd section}
\subsection{2nd subsection}

\section{Appendix section}



enter image description here

If your lemmas use a different counter, e.g. lemma, you have to change the mentioned line to, e.g.


You must log in to answer this question.

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