# Numbering of theorems in "report" style

I am writing a document in "Report" style. Throughout the document, results in Chapter X and Section Y appears as: "Theorem X.Y.1" or "Lemma X.Y.2" etc. I want to keep that this way.

However my first Chapter, that serves as an introduction, doesn't contain any Section. Thus results appear as: "Theorem 1.0.1" or "Lemma 1.0.2". This is annoying, and I would like to see these results as "Theorem 1.1" or "Lemma 1.2" instead.

Is it possible to do that without leaving the "Report" style?

• Weclome. // Sorry, there is little to none we can do without seeing your code (ready for copy&run, minimal, demonstrating your problem). Jun 17 at 13:58

There is no way to do it, in large part because it is impossible to do it consistently. For example how would you name the theorems in the following? Which one of them should be "Theorem 1.1"?

\chapter{Chapter}

\begin{theorem}A\end{theorem}

\subsection{Subsection}

\begin{theorem}B\end{theorem}

\section{Section}

\begin{theorem}C\end{theorem}


There are at least two ways to go about it. Either adopt a numbering scheme where each theorem has an independent sequential unique number. Or if you absolutely must (though discouraged), you can manually number the theorems, like is shown here: https://tex.stackexchange.com/a/53981/97712

• In OP's case there probably aren't any sections or subsections in chapter 1. It's very unlikely they'll have a problem like this. And it's almost certainly possible to do what they want without manual numbering. See my comment to the question. Jun 17 at 15:28
• The question as if it's possible to do so automatically which it isn't. You essentially propose a kind of manual numbering, albeit better than a fixed constant. Jun 17 at 19:50
• I don't understand what you mean. Both my suggestion and egreg's only affect what other numbers are printed alongside the the automatically numbered theorem numbers; there is no manual numbering of anything whatsoever. Jun 17 at 20:39

It's possible. You can redefine \thetheorem to omit the section number if it is zero.

You'd also get “Theorem 2.1” if the theorem is before the first \section command in chapter 2.

\documentclass{report}

\usepackage[a5paper]{geometry} % just to make a smaller picture

\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}

\renewcommand{\thetheorem}{%
\ifnum\value{section}=0
\thechapter.%
\else
\thesection.%
\fi
\arabic{theorem}%
}

\begin{document}

\chapter{Introduction}

This chapter has no sections but it has theorems.

\begin{lemma}
A lemma
\end{lemma}

\begin{theorem}
A theorem
\end{theorem}

\chapter{First}

This chapter has sections.

\section{Test}

\begin{lemma}
A lemma
\end{lemma}

\begin{theorem}
A theorem
\end{theorem}

\section{Again}

\begin{lemma}
A lemma
\end{lemma}

\begin{theorem}
A theorem
\end{theorem}

\end{document}


Note: geometry has been used only to make a smaller picture. Use your own setup.