I searched the internet for a while now but didn't quite get what i wanted.
I want number different theorems with the same counter, which depends on chapter and section. eg Lemma 1.1.1 Example 1.1.2 Proof 1.1.3…
I tried to define a counter like this but i get an error which says missing \begin{document} for the setcounter command but when i put it inside the document it doesn't work neither.
\documentclass[12pt]{report}
\newcounter{cnt}[section]
\newcounter{thmcount}
\setcounter{thmcount}{\thechapter.\thesection.\thecnt}
\newtheorem{lem}{Lemma}[thmcount]
\newtheorem{eg}{Example}[thmcount]
\newtheorem{pro}{Proof}[thmcount]
\begin{document}
\chapter{abc}
\section{xyz}
\begin{lem}
asdf
\end{lem}
\begin{eg}
fdsa
\end{eg}
\begin{pro}
sdaf
\end{pro}
\end{document}
Best Answer
There's no need to define a new counter:
The first
\newtheorem
sets up a new counter calledlem
(tied tosection
) that then is shared by all subsequent environments created withlem
as optional argument just after the environment's name.