2

I'm using the scrreprt documentclass, which provides parts and chapters. While I found solutions to enumerate theorems like Theorem chapter.section.number, I did not manage to obtain Theorem part.chapter.number. Either I get part.number of chapter.number. Here is a minimal example:

\documentclass{scrreprt}
\usepackage{amsmath,amsthm,thmtools} %thmtools is used to share counters
\declaretheorem[numberwithin=chapter, name=Theorem]{Thm} %print Theorem 1.1
%\newtheorem{Thm}{Theorem}[part] %prints Theorem I.1
%\numberwithin{Thm}{part} %back to Theorem 1.1

\begin{document}

\part{First part}
\chapter{A chapter}

\begin{Thm}
A theorem.
\end{Thm}

\end{document}

3 Answers 3

3

Are you looking for the following?

enter image description here

enter image description here

\documentclass{scrreprt}
\usepackage{amsmath,amsthm,thmtools} %thmtools is used to share counters
\declaretheorem[numberwithin=chapter, name=Theorem]{Thm} %print Theorem 1.1
\renewcommand\theThm{\thepart.\thechapter.\arabic{Thm}} % <--- added part number

\begin{document}

\part{First part}
\chapter{first chapter}

\begin{Thm}
A theorem. \theThm
\end{Thm}
\begin{Thm}
A theorem. \theThm
\end{Thm}

\chapter{second chapter}

\begin{Thm}
A theorem. 
\end{Thm}
\begin{Thm}
A theorem. 
\end{Thm}

\end{document}
2
  • Yes! Coincidentally, I found the very same solution. Nov 12, 2023 at 8:09
  • Your solution is better, because it avoids \@addtoreset{Thm}{chapter} (in my solution it was necessary, since I did not use \declaretheorem) Nov 12, 2023 at 8:14
2

I'm not seeing the point of this. When you start a new \part, the chapter number is not reset. So if you have this skeleton

\part{First part}
\chapter{A}
\begin{Thm} text \end{Thm}
\chapter{B}
\begin{Thm} text \end{Thm}

\part{Second part}
\chapter{C}
\begin{Thm} text \end{Thm}

you'd get the theorems numbered

I.1.1
I.2.1
II.3.1

and knowing what part the theorem appears in is redundant.

Unless you also want to reset the chapter number at each \part, which will be confusing as well, because you move the redundancy elsewhere.

Anyway, how can you do this? With a very simple instruction, namely

\counterwithin{chapter}{part}

Full example, where the geometry line is used just to make smaller pictures.

\documentclass{scrreprt}

\usepackage[a6paper]{geometry}% just to make smaller pictures

\usepackage{amsmath,amsthm,thmtools}

\counterwithin{chapter}{part}

\declaretheorem[
  numberwithin=chapter,
  name=Theorem
]{Thm}

\begin{document}

\part{First part}
\chapter{A chapter}

\begin{Thm}
A theorem.
\end{Thm}

\chapter{Another chapter}

\begin{Thm}
Another theorem.
\end{Thm}

\part{Second part}
\chapter{Further chapter}

\begin{Thm}
Further theorem
\end{Thm}

\end{document}

enter image description here

If you want that chapter numbers are preceded by the part number (so adding a new layer of confusion), you can do it.

\documentclass{scrreprt}

\usepackage[a6paper]{geometry}% just to make smaller pictures

\usepackage{amsmath,amsthm,thmtools}

\counterwithin*{chapter}{part}

\declaretheorem[
  numberwithin=chapter,
  name=Theorem
]{Thm}
\renewcommand{\theThm}{\thepart.\thechapter.\arabic{Thm}}

\begin{document}

\part{First part}
\chapter{A chapter}

\begin{Thm}
A theorem.
\end{Thm}

\chapter{Another chapter}

\begin{Thm}
Another theorem.
\end{Thm}

\part{Second part}
\chapter{Further chapter}

\begin{Thm}
Further theorem
\end{Thm}

\end{document}

Of course your readers won't be able to find cross references to chapters, unless you always print something relating to the part in the page header and you will need to say “chapter 3 of part III” anyway. OK, the book is yours.

\documentclass{scrreprt}

\usepackage[a6paper]{geometry}% just to make smaller pictures

\usepackage{amsmath,amsthm,thmtools}

\counterwithin*{chapter}{part}

\declaretheorem[
  numberwithin=chapter,
  name=Theorem
]{Thm}
\renewcommand{\theThm}{\thepart.\thechapter.\arabic{Thm}}

\begin{document}

\part{First part}
\chapter{A chapter}

\begin{Thm}
A theorem.
\end{Thm}

\chapter{Another chapter}

\begin{Thm}
Another theorem.
\end{Thm}

\part{Second part}
\chapter{Further chapter}

\begin{Thm}
Further theorem
\end{Thm}

\end{document}

enter image description here

This might be the layout of a famous textbook. But I know of an even more famous textbook, namely Euclid's “Elements”. Do we need to follow Euclid's style? Of course not.

4
  • Thanks! I now understand the logic of these commands. Although, you find this pointless, it is the layout of a famous textbook. There is however one drawback to your method: I don't want to print the part in the chapter number (yes, call me crazy). Nov 12, 2023 at 10:20
  • @BrauerSuzuki See the updated answer. And also the final comment…
    – egreg
    Nov 12, 2023 at 10:31
  • Thanks again. Now you have basically Zarko's solution. Let me explain why I want this: First of all, the document is not meant to become an actual printed book. It is a collection of lecture notes, each part forms a course with 10-15 chapters running over 150 pages. Since every page contains several theorem-like environments, the reader can quickly see in which part/chapter we are. If, in a proof, I refer to Lemma~II.3.2, the reader already gets the information that the result was something proved in course II. Another reason is to avoid "large" numbers like Theorem 45.120. Nov 12, 2023 at 17:44
  • @BrauerSuzuki There is a big difference: with my answer, the chapter numbers are reset after \part.
    – egreg
    Nov 12, 2023 at 20:17
1

The following does the trick:

\renewcommand\theThm{\thepart.\thechapter.\arabic{Thm}}
\makeatletter
  \@addtoreset{Thm}{chapter}
  \@addtoreset{chapter}{part}
\makeatother

Not sure if this is the preferred way.

1
  • Definitely not the preferred way.
    – egreg
    Nov 12, 2023 at 9:56

You must log in to answer this question.

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