0
\documentclass{article}
%\documentclass[16pt]{report}
\usepackage[a4paper,text={16.5cm,25.2cm},centering]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{amsfonts}
\usepackage{hyperref}
\usepackage{amssymb}

\usepackage{mdframed}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{nccmath}
\usepackage{dsfont}
\usepackage{cancel}
\usepackage{mathtools}
\usepackage{setspace}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\onehalfspacing
%\doublespacing

\newcommand{\RN}[1]{%
  \textup{\uppercase\expandafter{\romannumeral#1}}%
}

\newmdtheoremenv{theo}{Theorem}

%\newenvironment{claim}[1]{\par\noindent\underline{Claim:}\space#1}{}
%\newenvironment{claimproof}[1]{\par\noindent\underline{Proof:}\space#1}{\hfill $\blacksquare$}

\newtheorem*{remark}{Remark}
\newtheorem{theorem}{Theorem}
\newtheorem{lemma}{Lemma}
\newtheorem{claim}{Claim}
\newtheorem{corollary}{Corollary}

\usepackage{graphicx}
\newcommand\smallO{
  \mathchoice
    {{\scriptstyle\mathcal{O}}}% \displaystyle
    {{\scriptstyle\mathcal{O}}}% \textstyle
    {{\scriptscriptstyle\mathcal{O}}}% \scriptstyle
    {\scalebox{.7}{$\scriptscriptstyle\mathcal{O}$}}%\scriptscriptstyle
  }

\title{}
\author{}
\date{}

\begin{document}

\maketitle
\large

\begin{theo}
 1+1=2
\end{theo}

\begin{theorem}
\label{generalversion}
   1+1=2
\end{theorem}

\end{document}

Here is the code of my file. If you compile you'll see that both Theorems have the same numeration. Is it possible to change it?

2
  • Try \newtheorem{theorem}[theo]{Theorem} instead of \newtheorem{theorem}{Theorem}. Aug 4, 2023 at 7:16
  • I would probably recommend using tcolorbox instead of mdframed. Among other things it allows you to frame an existing \newtheorem. BTW: no need to load amsfonts manually, amssymb already does that.
    – daleif
    Aug 4, 2023 at 7:52

1 Answer 1

3
  1. Don't do \large at the beginning of the document
  2. Don't use preambles handed out by somebody
  3. Don't pile up preambles

Why 1? Because it's wrong. Use the 12pt option instead.

Why 2? Because most of the times, those preambles suffer from point 3.

Why 3? Because you're likely to get duplications and wrong order of package loading.

Now let's get to the problem. With your code, you're reserving different and independent counters for

theo  theorem  lemma  claim  corollary

Some (bad) styles choose this, with the consequence that readers won't know whether corollary 6 comes earlier or later than theorem 3 or lemma 2.

For a short paper this might be a small problem; in a longer paper or a memoir it would.

How do you reserve just one counter for all theorem-like environments? By defining a main one and by linking all the others to this counter.

\documentclass[12pt]{article}
\usepackage[a4paper,text={16.5cm,25.2cm},centering]{geometry}
%\usepackage[utf8]{inputenc} % no longer needed
%\usepackage[english]{babel} % not actually needed

%\usepackage{amsmath}
\usepackage{mathtools}% also loads amsmath
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage{dsfont}
\usepackage{nccmath}
\usepackage{cancel}

\usepackage{mdframed}
\usepackage{graphicx}

\usepackage{setspace}

% for mock text, not needed in a real document
\usepackage{lipsum}

% must be last almost all the times
\usepackage{hyperref}

\onehalfspacing
%\doublespacing

\newcommand{\RN}[1]{%
  \textup{\uppercase\expandafter{\romannumeral#1}}%
}

\newtheorem{theorem}{Theorem}
\newmdtheoremenv{theo}[theorem]{Theorem}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{claim}[theorem]{Claim}
\newtheorem{corollary}[theorem]{Corollary}

\newtheorem*{remark}{Remark}

\newcommand\smallO{%
  \mathchoice
    {{\scriptstyle\mathcal{O}}}% \displaystyle
    {{\scriptstyle\mathcal{O}}}% \textstyle
    {{\scriptscriptstyle\mathcal{O}}}% \scriptstyle
    {\scalebox{.7}{$\scriptscriptstyle\mathcal{O}$}}%\scriptscriptstyle
  }

\title{}
\author{}
\date{}

\begin{document}

\maketitle

\begin{theo}
 1+1=2
\end{theo}

\begin{theorem}
\label{generalversion}
   1+1=2
\end{theorem}

\end{document}

You probably want to fix the parameters for the framed theorems.

enter image description here

3
  • Thank you! But there is one issue: if I add lemma and claim in between it changes the numeration of theorems? I am wondering how to make enumeration for each environment independent?
    – RFZ
    Aug 4, 2023 at 21:20
  • @RFZ I tried to explain why this isn't good style. Anyway, if you really want to have independent numbering for lemmas and claims, just remove [theorem] from their definition.
    – egreg
    Aug 4, 2023 at 21:23
  • Thanks a lot! It worked!
    – RFZ
    Aug 4, 2023 at 21:23

You must log in to answer this question.

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