3

I have problem for numbering my theorems and definition as follows:

\documentclass[12pt,a4paper,twoside]{report}
\usepackage{amsthm}
\usepackage{cleveref}

\theoremstyle{definition}
\newtheorem{myde}{Conjecture}[section]
\newtheorem{mydef}{Example}[section]
\newtheorem{mydeg}{Definition}[section]
\newtheorem{myd}{Approach}[section]
\newtheorem{my}{Theorem}[section]
\newtheorem{mydep}{Proof}
\newtheorem*{proof*}{Proof}
\newtheorem{lemma}{Lemma}[section]
\newtheorem{corollary}{Corollary}[section]

\begin{document}

\chapter{Test chapter}
\section{Test section}

\begin{myde}
this is correct
\end{myde}

\begin{mydef}
this one should be Example 1.1.2
\end{mydef}

\begin{myde}
this one should be Conjecture 1.1.3
\end{myde}

\begin{mydeg}
this one should be Definition 1.1.4
\end{mydeg}

\begin{myde}
this one should be Conjecture 1.1.5
\end{myde}

\begin{my}
this one should be Theorem 1.1.6
\end{my}

\end{document}
7

Your main problem here is in the understanding of \newtheorem. Since you're using amsthm, let's look at the documentation (specifically, section 3 Theorem numbering):

In addition to the two mandatory arguments, \newtheorem has two mutually exclusive optional arguments. These govern the sequencing and hierarchy of the numbering. The numbering mechanism can be thought of this way:

\newtheorem{<env name>}{<text>}[<parent counter>]
\newtheorem{<env name>}[<shared counter>]{<text>}

The <parent counter> is comparable to \numberwithin; that is, numbering will restart whenever that sectional level is encountered. If a <shared counter> is specified, numbering will progress sequentially for all theorem elements using this counter.

You should be using the second version if you want a numbering scheme that shares the same counter. But you've been using the first, which creates a unique counter for every theorem style.

enter image description here

\documentclass{report}

\usepackage{amsthm}

\theoremstyle{definition}
\newtheorem{myde}{Conjecture}[section]% Conjecture is numbered within \section
\newtheorem{mydef}[myde]{Example}% Example uses myde's counter
\newtheorem{mydeg}[myde]{Definition}% Definition uses myde's counter
\newtheorem{my}[myde]{Theorem}% Theorem uses myde's counter
\newtheorem{myd}[myde]{Approach}% Approach uses myde's counter
\newtheorem{lemma}{Lemma}% Lemma uses myde's counter
\newtheorem{corollary}[myde]{Corollary}% Corollary uses myde's counter

\begin{document}

\chapter{Test chapter}
\section{Test section}

\begin{myde}
this is correct
\end{myde}

\begin{mydef}
this one should be Example 1.1.2
\end{mydef}

\begin{myde}
this one should be Conjecture 1.1.3
\end{myde}

\begin{mydeg}
this one should be Definition 1.1.4
\end{mydeg}

\begin{myde}
this one should be Conjecture 1.1.5
\end{myde}

\begin{my}
this one should be Theorem 1.1.6
\end{my}

\end{document}
  • Thank you it worked! Great explanation. I manage to play around with it. – shahrina ismail Oct 22 '16 at 8:30

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.