34

Edited to include complete code, as suggested:

Here is what the preamble of my main file looks like:

\documentclass[12pt]{report}
\usepackage{epsfig}
\usepackage{upmathgrad2}  
\usepackage{UPnotations}
\usepackage{amssymb, graphicx, amsmath, amsthm}
\RequirePackage{graphicx}
\RequirePackage{hyperref}
\theoremstyle{definition}
\newtheorem{thm}{Theorem}[chapter]
\newtheorem{defn}[thm]{Definition}
\newtheorem{lem}{Lemma}[thm]
\newtheorem{cor}{Corollary}[thm]
\newtheorem{prop}{Proposition}[thm]
\newtheorem{rem}{Remark}[thm]
\newtheorem{ill}{Illustration}[thm]

I've been trying to tinker on ways to change the above code however I still get the following numbering:

Chapter 1
1.1 Section A
Definition 1.0.1
Theorem 1.0.2
Theorem 1.0.3

The definitions, theorems, lemmas, etc. are numbered continuously as I wanted. However, I wanted to get rid of the 0's. How do I do this?

I tried to use the suggestions in this thread however things just got worse.

For example, when I tried:

\newcounter{dummy} \numberwithin{dummy}{section}
\newtheorem{defn}{Definition}[dummy]
\newtheorem{thm}{Theorem}[dummy]

I got Definition 1.1.0.1 instead.

2
  • 1
    Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}). Jul 27, 2012 at 15:41
  • I've upadated my answer. Is it something like that what you want? If not, please explain clearly the desired numbering scheme. Jul 27, 2012 at 15:58

1 Answer 1

50

The \newtheorem command has two mutually exlusive optional arguments:

Using

\newtheorem{<name>}{<heading>}[<counter>]

will create an environment <name> for a theorem-like structure; the counter for this structure will be subordinated to <counter>. On the other hand, using

\newtheorem{<name>}[<counter>]{<heading>}

will create an environment <name> for a theorem-like structure; the counter for this structure will share the previously defined <counter> counter.

In the definition of defn you need to use the first optional argument of \newtheorem to indicate that this environment shares the counter of the previously defined thm environment.

If the counters need to be subordinate to the section counter, use section for the second optional argument of \newtheorem in the definition of thm. A little example:

\documentclass[12pt]{report}
\usepackage{amsthm}

\newtheorem{thm}{Theorem}[section]
\newtheorem{defn}[thm]{Definition}

\begin{document}

\chapter{Test}
\section{Test}
\begin{defn}test\end{defn}
\begin{thm}test\end{thm}
\begin{thm}test\end{thm}

\end{document}

enter image description here

On the other hand, if the counters need to be subordinate to the chapter counter, use chapter for the second optional argument of \newtheorem in the definition of thm. A little example:

\documentclass[12pt]{report}
\usepackage{amsthm}

\newtheorem{thm}{Theorem}[chapter]
\newtheorem{defn}[thm]{Definition}

\begin{document}

\chapter{Test}
\section{Test}
\begin{defn}test\end{defn}
\begin{thm}test\end{thm}
\begin{thm}test\end{thm}

\end{document}

enter image description here

A similar remark applies to the other structures; so instead of

\newtheorem{lem}{Lemma}[thm]
\newtheorem{cor}{Corollary}[thm]
\newtheorem{prop}{Proposition}[thm]
...

you probablly want

\newtheorem{defn}[thm]{Definition}
\newtheorem{lem}[thm]{Lemma}
\newtheorem{cor}[thm]{Corollary}
\newtheorem{prop}[thm]{Proposition}
\newtheorem{rem}[thm]{Remark}
\newtheorem{ill}[thm]{Illustration}
7
  • Thanks. But now I get the following: 1.1 Test Definition 1.1 Theorem 1.1.1 Instead of Definition 1.1.1. Jul 27, 2012 at 15:49
  • @Kenjo please see my updated answer. Jul 27, 2012 at 15:53
  • I just edited the file just as you wrote. Here's what I get. 1.1 Test Denition 1.1.Test Lemma 1.1.1.Test Theorem 1.2.Test Remark 1.2.1.Test Illustration 1.2.1. Test Corollary 1.2.1.Test Something is Jul 27, 2012 at 16:01
  • @Kenjo as I mentioned in the last part of my answer, you have to change all the other theorem structures as well. Jul 27, 2012 at 16:07
  • 1
    Just for reference: See also Barbara Beeton’s great answer: Understanding the arguments in newtheorem e.g. \newtheorem{theorem}{Theorem}[section].
    – Speravir
    Jan 24, 2014 at 18:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .