[Tex/LaTex] Numbering of newtheorem

numberingtheorems

Right now I have the following preamble

newtheorem{thm}{Theorem}[section]
\let\oldthm\thm
\renewcommand{\thm}{\oldthm\normalfont}

\newtheorem{corol}{Corollary}[section]
\let\oldcorol\corol
\renewcommand{\corol}{\oldcorol\normalfont}

\newtheorem{lem}{Lemma}[section]
\let\oldlem\lem
\renewcommand{\lem}{\oldlem\normalfont}

\newtheorem{defn}{Definition}[section]
\let\olddefn\defn
\renewcommand{\defn}{\olddefn\normalfont}

\newtheorem{exa}{Example}[section]
\let\oldexa\exa
\renewcommand{\exa}{\oldexa\normalfont}

\newtheorem{prop}{Proposition}[section]
\let\oldprop\prop
\renewcommand{\prop}{\oldprop\normalfont}

that suppresses the italic font that is used by the standard newtheorem command. I am looking to change the way these theorems, lemmas etcetera are numbered. I want to have them numbered by section, using the same counter, so for instance:

Section 1

— Subsection 1.1

—- Theorem 1.1

—- Corollary 1.2

Section 2

— Subsection 2.1

—- Lemma 2.1

—- Definition 2.2

Whereas right now the numbering is:

Section 1

— Subsection 1.1

—- Theorem 1.1

—- Corollary 1.1

Section 2

— Subsection 2.1

—- Lemma 2.1

—- Definition 2.1

I have tried using a dummy variable as an answer to another question proposed, but I haven't gotten it to work. Thanks in advance!

Edit

Here is a minimal example:

\documentclass{article}

\newtheorem{thm}{Theorem}[section]
\let\oldthm\thm
\renewcommand{\thm}{\oldthm\normalfont}

\newtheorem{corol}{Corollary}[section]
\let\oldcorol\corol
\renewcommand{\corol}{\oldcorol\normalfont}

\newtheorem{lem}{Lemma}[section]
\let\oldlem\lem
\renewcommand{\lem}{\oldlem\normalfont}

\newtheorem{defn}{Definition}[section]
\let\olddefn\defn
\renewcommand{\defn}{\olddefn\normalfont}

\newtheorem{exa}{Example}[section]
\let\oldexa\exa
\renewcommand{\exa}{\oldexa\normalfont}

\newtheorem{prop}{Proposition}[section]
\let\oldprop\prop
\renewcommand{\prop}{\oldprop\normalfont}

\begin{document}

\section{First}

\subsection{A}

\begin{thm}
Theorem
\end{thm}

\begin{corol}
Corollary
\end{corol}

\section{Second}

\subsection{B}

\begin{lem}
Lemma
\end{lem}

\begin{defn}
Definition
\end{defn}

\end{document}

Best Answer

With the amsthm package: When defining a new theorem, you can instruct it to use a shared counter:

\newtheorem{⟨env name⟩}[⟨shared counter⟩]{⟨text⟩}

For more details, see the amsthm documentation: "3 Theorem numbering"

\documentclass{article}

\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{thm}{Theorem}[section]
\newtheorem{corol}[thm]{Corollary}

\begin{document}

\section{sec}
\subsection{sub}
\begin{thm}
\end{thm}

\begin{corol}
\end{corol}

\section{sec}
\subsection{sub}
\begin{thm}
\end{thm}

\begin{corol}
\end{corol}

\end{document}

enter image description here