[Tex/LaTex] How to number theorems in introduction without section counter and later with it

amsthmntheoremnumberingtheorems

I would like to have my theorems numbered in the following way.

Theorem 1. Blah-blah

Theorem 2. More blah-blah

Section 1.

Theorem 1.1. Special blah

Theorem 1.2. More special blah

Section 2

Theorem 2.1. Another special blah

and so on, preferably using the amsmath package. I've been struggling for a while with this, can anyone suggest a simple solution? I would also like to be able to \label and \ref all theorems.

Best Answer

Here's a simple solution. Define your structures without their counters being subordinate to the section counter and just before the first \section use \numberwithin from the amsmath (or \counterwithin from the chngcntr package) package to add the section counter:

\documentclass{article}
\usepackage{amsthm}
\usepackage{amsmath}

\newtheorem{thm}{Theorem}
\newtheorem{lem}[thm]{Lemma}

\begin{document}

\section*{Introduction}
Some cross-references: \ref{a}, \ref{b}, \ref{c}, \ref{d}, \ref{e}, and \ref{f}.
\begin{thm}\label{a}
test theorem in the introduction
\end{thm}

\begin{lem}\label{b}
test lemma in the introduction
\end{lem}

\begin{thm}\label{c}
test theorem in the introduction
\end{thm}

\numberwithin{thm}{section}
\section{A test numbered section}

\begin{lem}\label{d}
test lemma in a numbered section
\end{lem}

\begin{thm}\label{e}
test theorem in a numbered section
\end{thm}

\begin{thm}\label{f}
test theorem in the introduction
\end{thm}

\end{document}

enter image description here