1

Here is what I got from the following tex file: enter image description here

What I want is the following:

   1. Introduction

Theorem 1.1 theorem 1.1

Theorem 1.2 theorem 1.2

Lemma 1.3   lemma 1.3

Remark 1.4  remark 1.4 

In theorem [1.1], lemma [1.3], and remark [1.3], we obtained...

          2. Implementation

Corollary 2.1 corollary 2.1

Corollary 2.2 corollary 2.2

Definition 2.3 definition 2.3

Conjecture 2.4 conjecture 2.4

In corollary [2.1], definition23 [2.3], and conjecture [2.4], we obtained... 

I have studied several examples posted before and was not able to find one solution which will allow me to correctly define these theorem/remarks and correct reference them later.

Thanks a lot for the help- mike

mimimum working example

%--------------------------
\documentclass[a4paper,12pt,reqno,twoside]{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{color}
\usepackage{ifpdf}
\usepackage{array}

\usepackage{url}
\usepackage{graphicx}
\usepackage{float}
\usepackage{multirow,bigdelim}




\addtolength{\textheight}{2cm}
\addtolength{\topmargin}{-1.5cm}
\addtolength{\textwidth}{2cm}
\addtolength{\oddsidemargin}{-1cm}
\addtolength{\evensidemargin}{-1cm}




\numberwithin{equation}{section}
\newtheorem{definition}{Definition}[section]
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}{Lemma}[section]
\newtheorem{proposition}{Proposition}[section]
\newtheorem{corollary}{Corollary}[section]
\newtheorem{remark}{Remark}[section]
\newtheorem{conjecture}{Conjecture}[section]

\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\usepackage{cleveref}% http://ctan.org/pkg/cleveref
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{chngcntr}% http://ctan.org/pkg/lipsum

\newcommand*{\C}{\mathbb{C}}%.............................C
\newcommand*{\R}{\mathbb{R}}%.............................R
\newcommand*{\Q}{\mathbb{Q}}%.............................Q
\newcommand*{\Z}{\mathbb{Z}}%.............................Z
\newcommand*{\N}{\mathbb{N}}%.............................N

\newcommand{\comment}[1]{}
%................................
%\def\baselinestretch{2}%.espacement des lignes
%................................
\title[title]%
      {title} 
\author[A. Author]{Author AUTHOR}
%
\date{Version of \today}
%................................
\subjclass[2000]{11M26, 11M50, 11N64 }
\keywords{}
%
\AtBeginDocument{%
%\mathtoolsset{showonlyrefs,mathic = true}
\begin{abstract}

\end{abstract}
\maketitle
%\tableofcontents % Table of Contents
}
%..........................................
\begin{document}
%..........................................
%

\section{Introduction}
\counterwithin{equation}{section}

\begin{theorem}\label{theorem11}
theorem 1.1
\end{theorem}

\begin{theorem}\label{theorem12}
theorem 1.2
\end{theorem}

\begin{lemma}\label{lemma13}
lemma 1.3
\end{lemma}

\begin{remark}\label{remark14}
remark 1.4
\end{remark}

In \cref{theorem11}, \cref{lemma13}, and \cref{remark14}, we obtained...

\section{Implementation}
\counterwithin{equation}{section}

\begin{corollary}\label{corollary21}
corollary 2.1
\end{corollary}

\begin{corollary}\label{corollary22}
corollary 2.2
\end{corollary}

\begin{definition}\label{definition23}
definition 2.3
\end{definition}

\begin{conjecture}\label{conjecture24}
conjecture 2.4
\end{conjecture}

In \cref{corollary21}, \cref{definition23}, and \cref{conjecture24}, we obtained...
%---------------------------------------
\end{document}

Update I modified the tex file as suggested by the answer by @Eric. The numbers look OK now. But at the referencing part, the naming is incorrect. I would expect tot see "In theorem 1.1", but it displayed "In definition 1.1". Please see figure 2 below. enter image description here

1
  • 1
    you are using amsthm. what you want is explained in the package documentation -- texdoc amsthm. (this manual was rewritten about a year ago, and is much improved compared to what was there before.) Nov 20, 2016 at 22:18

1 Answer 1

1

Use the first optional argument for all theorem environments but the first one.

\documentclass[a4paper,12pt,reqno,twoside]{amsart}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{color}
\usepackage{ifpdf}
\usepackage{array}

\usepackage{url}
\usepackage{graphicx}
\usepackage{float}
\usepackage{multirow,bigdelim}

\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\usepackage{cleveref}% http://ctan.org/pkg/cleveref
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\usepackage{chngcntr}% http://ctan.org/pkg/lipsum

\addtolength{\textheight}{2cm}
\addtolength{\topmargin}{-1.5cm}
\addtolength{\textwidth}{2cm}
\addtolength{\oddsidemargin}{-1cm}
\addtolength{\evensidemargin}{-1cm}

\numberwithin{equation}{section}
\newtheorem{definition}{Definition}[section]
\newtheorem{theorem}[definition]{Theorem}
\newtheorem{lemma}[definition]{Lemma}
\newtheorem{proposition}[definition]{Proposition}
\newtheorem{corollary}[definition]{Corollary}
\newtheorem{remark}[definition]{Remark}
\newtheorem{conjecture}[definition]{Conjecture}

\newcommand*{\C}{\mathbb{C}}%.............................C
\newcommand*{\R}{\mathbb{R}}%.............................R
\newcommand*{\Q}{\mathbb{Q}}%.............................Q
\newcommand*{\Z}{\mathbb{Z}}%.............................Z
\newcommand*{\N}{\mathbb{N}}%.............................N

\newcommand{\comment}[1]{}
%................................
%\def\baselinestretch{2}%.espacement des lignes
%................................
\title[title]%
      {title} 
\author[A. Author]{Author AUTHOR}
%
\date{Version of \today}
%................................
\subjclass[2000]{11M26, 11M50, 11N64 }
\keywords{}
%
\AtBeginDocument{%
%\mathtoolsset{showonlyrefs,mathic = true}
\begin{abstract}

\end{abstract}
\maketitle
%\tableofcontents % Table of Contents
}
%..........................................
\begin{document}
%..........................................
%

\section{Introduction}
\counterwithin{equation}{section}

\begin{theorem}\label{theorem11}
theorem 1.1
\end{theorem}

\begin{theorem}\label{theorem12}
theorem 1.2
\end{theorem}

\begin{lemma}\label{lemma13}
lemma 1.3
\end{lemma}

\begin{remark}\label{remark14}
remark 1.4
\end{remark}

In \cref{theorem11}, \cref{lemma13}, and \cref{remark14}, we obtained...

\section{Implementation}
\counterwithin{equation}{section}

\begin{corollary}\label{corollary21}
corollary 2.1
\end{corollary}

\begin{corollary}\label{corollary22}
corollary 2.2
\end{corollary}

\begin{definition}\label{definition23}
definition 2.3
\end{definition}

\begin{conjecture}\label{conjecture24}
conjecture 2.4
\end{conjecture}

In \cref{corollary21}, \cref{definition23}, and \cref{conjecture24}, we obtained...
%---------------------------------------
\end{document}

enter image description here

5
  • 1
    Does this work with cref as intended?
    – cmhughes
    Nov 20, 2016 at 20:59
  • 1
    @cmhughes It works if you move the package inclusion before the definition of your theorem definitions. Nov 20, 2016 at 21:24
  • @EricDomenjoud. Thanks for the answer. I replaced 7 lines in my tex file with the 7 lines in your answer above. It did not work in the cref part. Please see figure 2 above.
    – mike
    Nov 20, 2016 at 23:21
  • 1
    @cmhughes. As I said in my previous comment, you have to move all your package inclusions BEFORE the theorem environments definitions. I updated the answer. Nov 21, 2016 at 0:43
  • @EricDomenjoud. It worked fine now. Best regards-
    – mike
    Nov 21, 2016 at 2:45

You must log in to answer this question.

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