Math & ScienceChange the Numbering for a Theorem Style Environment

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

Change the Numbering for a Theorem Style Environment

Post by thedoctor818 »

I am using the following (amongst others) theorem-style enviornemnt:

Code: Select all

\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
and

Code: Select all

\theoremstyle{definition}
\newtheorem{exc}{Exercise}[section]
Here is my MWE:

Code: Select all

\documentclass[12pt,a4paper,oneside]{report}
\pagestyle{myheadings}
\usepackage{amsmath,amssymb,amscd,amsthm,amstext}

\begin{document}
\title{Real Analysis Notes.}
\author{The Doctor.}
\date{\today}
\maketitle

\begin{exc}
Let $A=\{1,2,3\}$ and let $B=\{3,4,5\}$ Then $A\cupB=\{1,2,3,4\}$ and $a\capB=\{3\}.$
\end{exc}

\end{document}
And then I have many more exercises to come. What I would like to do is to have the numbering of these exercises begin with 1.1.13 to match the homework assignment our Professor has given us from textbook. Thanks for any help.
Last edited by thedoctor818 on Sat Sep 03, 2011 5:20 am, edited 1 time in total.
-Michael D

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Change the Numbering for a Theorem Style Environment

Post by frabjous »

You can set the counters manually.

Code: Select all

\setcounter{chapter}{1}
\setcounter{section}{1}
\setcounter{exc}{12}
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

Change the Numbering for a Theorem Style Environment

Post by thedoctor818 »

When I do that, I ge the following error message:

Code: Select all

LaTeX Error: No counter 'exc' defined.
-Michael D
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Change the Numbering for a Theorem Style Environment

Post by frabjous »

Did you remember to put the:

Code: Select all

\theoremstyle{definition}
\newtheorem{exc}{Exercise}[section]
lines back in? (They were missing from your mwe). I also had to fix \capA and \cupB to \cap A and \cup B.

Try this mwe:

Code: Select all

\documentclass[12pt,a4paper,oneside]{report}
\pagestyle{myheadings}
\usepackage{amsmath,amssymb,amscd,amsthm,amstext}
\theoremstyle{plain}
\newtheorem{thm}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{exc}{Exercise}[section]
\begin{document}
\title{Real Analysis Notes.}
\author{The Doctor.}
\date{\today}
\maketitle

\setcounter{chapter}{1}
\setcounter{section}{1}
\setcounter{exc}{12}

\begin{exc}
Let $A=\{1,2,3\}$ and let $B=\{3,4,5\}$ Then $A\cup B=\{1,2,3,4\}$ and $a\cap B=\{3\}.$
\end{exc}

\end{document}
Compiles fine for me.
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

Re: Change the Numbering for a Theorem Style Environment

Post by thedoctor818 »

Just one more question. That is, how would I get the first example to be Example 1.1.13? Thanks for all your help. -MD
-Michael D
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Change the Numbering for a Theorem Style Environment

Post by frabjous »

Do you mean Example, or Exercise? My sample already starts at Exercise 1.1.13. If you mean Example, then give us a mwe code that provides/uses this environment.
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

Re: Change the Numbering for a Theorem Style Environment

Post by thedoctor818 »

Thanks a lot. Now, I need to stop the list at some Excercise num, then restart at Excercise num 1.2.7 - how can I accomplish this. Thanks a lot, again. -MD
-Michael D
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Re: Change the Numbering for a Theorem Style Environment

Post by frabjous »

Either insert a \section{...} command, or \stepcounter{section} to advance the section number, and \setcounter{exc}{6} to push the exercise number back to 6 (so that the next one is 7).
thedoctor818
Posts: 92
Joined: Fri Apr 24, 2009 8:02 pm

Re: Change the Numbering for a Theorem Style Environment

Post by thedoctor818 »

OK, thanks that has solved my problem. I appreciate it a lot. -MD
-Michael D
Post Reply