2

It took me a little while to determine the following, but I think it's helpful and should be easily available, so I'm posting an "answer your own question" here. The question is this.

How do I label theorems in a different format in different sections, eg Theorem 1.1 and Theorem 3.2.2?

I had theorems label under section, 1.1, 1.2, 2.1, ..., ie under \newtheorem{thm}{Theorem}[section]. For just Section 3 I wanted them to be labelled under subsection, 3.1.1, 3.1.2, 3.2.1, ..., ie under \newtheorem{thm}{Theorem}[subsection].

  • 1
    Please phrase this as a question: how do I .... – Andrew Oct 13 '17 at 8:39
1

I found two relevant SE questions, [1,2]. However, these, to me, seemed fairly complicated and there was a lot of stuff I didn't understand in them. (I expect the same holds for most TeX users.) By inspecting the answers, I found that the following works (and is simple).

Put \usepackage{chngcntr} in the preamble. Then, when you want to change the numbering style (so at the start of S3 in my example above), I put \counterwithin{thm}{subsection} at the start of the section. This makes the counter reset with subsections. At the start of the next section, I then put \counterwithout{thm}{subsection} \counterwithin{thm}{section}. This stops the counter from reseting with subsections, and makes it reset with the section.

This worked perfectly for me. Thank you in particular to Christian Hupfer, and this answer.

Hopefully this will be helpful for someone!

  • 1
    If you want this to be helpful for others then please post a minimal working example. This should be a minimal piece of code that compiles and solves the problem. – Andrew Oct 13 '17 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.