Number theorems starting with a prefix `n`: theorem n.1

numberingtheorems

I am writing lecture notes in different files. So I want the theorems in the Lecture 1 file like

Theorem 1.1

Theorem 1.2

And, theorems in Lecture 2 file like

Theorem 2.1

Theorem 2.2

Thank you in advance for the help.

Best Answer

I will assume that you're using a package such as amsthm or ntheorem and use commands such as \newtheorem to create theorem-like environments. If this is the case, I suggest you create a LaTeX counter called, say, lecturenum, set this counter to the appropriate number (e.g., 3), and then use \newtheorem directives to create theorem-like environments that use the value of lecturenum as a prefix to the theorem numbers.

That way, the only setup instruction that has to be adjusted across the preambles of the lecture_n.tex files is the instruction

\setcounter{lecturenum}{n} % this is lecture "n" (e.g, 3)

enter image description here

\documentclass{article} % or some other suitable document class

\newcounter{lecturenum}
\setcounter{lecturenum}{5} % this is lecture 5

\usepackage{amsthm} % or 'ntheorem'
\newtheorem{theorem}{Theorem}[lecturenum]

\begin{document}

\begin{theorem} bla bla bla \end{theorem}
\begin{theorem} ble ble ble \end{theorem}

\end{document}