Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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 ({}). –  Claudio Fiandrino Jul 27 '12 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. –  Gonzalo Medina Jul 27 '12 at 15:58
add comment

1 Answer

up vote 6 down vote accepted

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}
share|improve this answer
    
Thanks. But now I get the following: 1.1 Test Definition 1.1 Theorem 1.1.1 Instead of Definition 1.1.1. –  Kenjo Jul 27 '12 at 15:49
    
@Kenjo please see my updated answer. –  Gonzalo Medina Jul 27 '12 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 –  Kenjo Jul 27 '12 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. –  Gonzalo Medina Jul 27 '12 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 at 18:20
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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