1

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?

2
  • 1
    Weclome. // Sorry, there is little to none we can do without seeing your code (ready for copy&run, minimal, demonstrating your problem).
    – MS-SPO
    Jun 17 at 13:58
  • Hard to know for sure without seeing any code. If you're using amsthm with something like \newtheorem{theorem}{Theorem}[section] you could try putting \renewcommand{\thetheorem}{\thechapter.\arabic{theorem}} at the start of the first chapter, and \renewcommand{\thetheorem}{\thesection.\arabic{theorem}} at the start of the first chapter with sections. If that doesn't do what you want we need a minimal working example.
    – frabjous
    Jun 17 at 15:25

2 Answers 2

0

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

3
  • 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.
    – frabjous
    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.
    – frabjous
    Jun 17 at 20:39
0

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.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.