# reset theorem counter after every subsection and print just #subsection

I have declared \newtheorem{thm}{Theorem} \numberwithin{thm}{subsection}. This numbers every theorem in this format [chapter].[section].[subsection].[numberofthm]. Is it possible to have the counter just printing [numberofthm] instead?

• You want to be mean to your readers. ;-) Your text will be full of “as we saw in Theorem 3 of subsection 2.9.42“. Just number them by section, uniquely throughout the document. – egreg Oct 31 '13 at 17:00
• @egreg The OP's document features chapters. ;-) – lockstep Oct 31 '13 at 17:11
• Haha, its my teachers fault, he does the numbering that way. But it should be Ok, because each subsection is pretty different. – flawr Oct 31 '13 at 18:29
• I can't check what this does without a MWE, but you could try \renewcommand{\thethm}{\arabic{thm}} (after the two commands you did show us). – Dan Oct 31 '13 at 19:53

Use the chngcntr package and its \counterwithin* macro -- the starred version changes the parent counter, but does not add/remove prefixes.

\documentclass{book}

\usepackage{chngcntr}

\newtheorem{thm}{Theorem}
\counterwithin*{thm}{subsection}

\begin{document}

\chapter{foo}

\section{foobar}

\subsection{foobargnu}

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

\begin{thm}
A second theorem.
\end{thm}

\subsection{foobargnat}

\begin{thm}
A third theorem.
\end{thm}

\end{document}


• Thank you very much! That was exactly what i was looking for! – flawr Oct 31 '13 at 18:29
• \newtheorem{thm}{Theorem}[subsection] and \renewcommand{\thethm}{\arabic{thm}} will do without any external package. – egreg Oct 31 '13 at 21:09