3

I am new to TeX and I am using a template to type something. And I want to do the following change of the format:

  1. I want to use the same counter for all the Theorem, Propostion, Corollary, etc.
  2. I want the counter counts to section (like 1.1.1) instead of to chapter (like 1.1).

I know how to do this in a blank file, just use the code

\newtheorem{theoremname}[counter]{Theoremname}[section]

But in this template it does not work.

The relevant code in the .cls file is the following:

% initialize theorem environment

\if@envcntshowhiercnt % show hierarchy counter
   \def\@thmcountersep{.}
   \spnewtheorem{theorem}{Theorem}[\envankh]{\bfseries}{\itshape}
   \@addtoreset{theorem}{chapter}
\else          % theorem counter only
   \spnewtheorem{theorem}{Theorem}{\bfseries}{\itshape}
   \if@envcntreset
      \@addtoreset{theorem}{chapter}
      \if@envcntresetsect
         \@addtoreset{theorem}{section}
      \fi
   \fi
\fi

%definition of divers theorem environments
\spnewtheorem*{claim}{Claim}{\itshape}{\rmfamily}
\spnewtheorem*{proof}{Proof}{\itshape}{\rmfamily}
%
\if@envcntsame % all environments like "Theorem" - using its counter
   \def\spn@wtheorem#1#2#3#4{\@spothm{#1}[theorem]{#2}{#3}{#4}}
\else % all environments with their own counter
   \if@envcntshowhiercnt % show hierarchy counter
      \def\spn@wtheorem#1#2#3#4{\@spxnthm{#1}{#2}[\envankh]{#3}{#4}}
   \else          % environment counter only
      \if@envcntreset % environment counter is reset each section
         \if@envcntresetsect
            \def\spn@wtheorem#1#2#3#4{\@spynthm{#1}{#2}{#3}{#4}
             \@addtoreset{#1}{chapter}\@addtoreset{#1}{section}}
         \else
            \def\spn@wtheorem#1#2#3#4{\@spynthm{#1}{#2}{#3}{#4}
                                      \@addtoreset{#1}{chapter}}
         \fi
      \else
         \let\spn@wtheorem=\@spynthm
      \fi
   \fi
\fi
%
\let\spdefaulttheorem=\spn@wtheorem
%
\spn@wtheorem{case}{Case}{\itshape}{\rmfamily}
\spn@wtheorem{conjecture}{Conjecture}{\itshape}{\rmfamily}
\spn@wtheorem{corollary}{Corollary}{\bfseries}{\itshape}
\spn@wtheorem{definition}{Definition}{\bfseries}{\rmfamily}
\spn@wtheorem{example}{Example}{\itshape}{\rmfamily}
\spn@wtheorem{exercise}{Exercise}{\bfseries}{\rmfamily}
\spn@wtheorem{lemma}{Lemma}{\bfseries}{\itshape}
\spn@wtheorem{note}{Note}{\itshape}{\rmfamily}
\spn@wtheorem{problem}{Problem}{\bfseries}{\rmfamily}
\spn@wtheorem{property}{Property}{\itshape}{\rmfamily}
\spn@wtheorem{proposition}{Proposition}{\bfseries}{\itshape}
\spn@wtheorem{question}{Question}{\itshape}{\rmfamily}
\spn@wtheorem{solution}{Solution}{\bfseries}{\rmfamily}
\spn@wtheorem{remark}{Remark}{\itshape}{\rmfamily}

Which is quite unreadable to me. Could someone tell me how to do it? Thanks in advance.

3
  • texdoc amsthm for the rescue? Commented Jul 18, 2018 at 21:01
  • Springer classes have a different way of defining theorem-like environment, using \spnewtheorem.
    – egreg
    Commented Jul 18, 2018 at 21:01
  • @egreg But my question is, he defined it by some \spn@wtheorem which I don't understand?
    – Akatsuki
    Commented Jul 18, 2018 at 22:00

1 Answer 1

2

If you want the theorem-like environments to share the counter, use the appropriate option to svmult:

\documentclass[envcountsame]{svmult}

% these are already defined
%\spnewtheorem{theorem}{Theorem}{\bfseries}{\itshape}
%\spnewtheorem{lemma}{Lemma}{\bfseries}{\itshape}
%\spnewtheorem{definition}{Definition}{\bfseries}{\upshape}

\begin{document}

\begin{lemma}
This is a lemma.
\end{lemma}

\begin{theorem}
This is a theorem.
\end{theorem}

\begin{definition}
This is a \emph{definition}
\end{definition}

\end{document}

enter image description here

If you prefer numbering by section:

\documentclass[envcountsame,envcountsect]{svmult}

% these are already defined
%\spnewtheorem{theorem}{Theorem}{\bfseries}{\itshape}
%\spnewtheorem{lemma}{Lemma}{\bfseries}{\itshape}
%\spnewtheorem{definition}{Definition}{\bfseries}{\upshape}

\begin{document}

\section{Title}

\begin{lemma}
This is a lemma.
\end{lemma}

\begin{theorem}
This is a theorem.
\end{theorem}

\begin{definition}
This is a \emph{definition}
\end{definition}

\end{document}

enter image description here

You can also use the LaTeX generic method with the nospthms option.

\documentclass[nospthms]{svmult}

\usepackage{amsthm}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}

\begin{document}

\section{Title}

\begin{lemma}
This is a lemma.
\end{lemma}

\begin{theorem}
This is a theorem.
\end{theorem}

\begin{definition}
This is a \emph{definition}
\end{definition}

\end{document}

The output is similar to the previous one.

0

You must log in to answer this question.

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