Problem with numbering theorem by section
Actually I have tried the solution of egreg
's, and then find out that you don't need to create the command \spnewtheorem{xx}{XX}[section]
It is the option envcountsect
in the svjour3
class that really helps.
\documentclass[envcountsect]{svjour3}
If you look into the file svjour.cls
, and seach \spnewtheorem{theorem}{Theorem}
, around line 888, you would find things like @envcntsect
is prerequisite of the numbering by section.
And then, you just use
\begin{theorem}
your theorem here.
\end{theorem}
to wrap your theorem. Proof, lemma, definition, case... are likewise.
Theorem-like environments should be defined, with the svjour3
class, by using
\spnewtheorem
and not \newtheorem
. Here's how you should do:
\documentclass[smallextended,referee,envcountsect]{svjour3}
\usepackage{amsmath}
\usepackage{bm}
\smartqed
\journalname{foo}
% Theorem-like environments are defined with \spnewtheorem
%
% Usage:
%
% \spnewtheorem{env_nam}{caption}[within]{cap_font}{body_font}
% or \spnewtheorem{env_nam}[numbered_like]{caption}{cap_font}{body_font}
% or \spnewtheorem*{env_nam}{caption}{cap_font}{body_font}
\spnewtheorem{thm}{Theorem}[section]{\bfseries}{\itshape}
\spnewtheorem{cor}[theorem]{Corollary}{\bfseries}{\itshape}
\spnewtheorem{lem}[theorem]{Lemma}{\bfseries}{\itshape}
\spnewtheorem{ntn}{Notations}[section]{\bfseries}{\itshape}
\spnewtheorem{pro}{Proposition}[section]{\bfseries}{\itshape}
\spnewtheorem{dfn}{Definition}[section]{\bfseries}{\itshape}% maybe \upshape?
\spnewtheorem{as}{Assumption}[section]{\bfseries}{\itshape}
\spnewtheorem{rem}{Remark}[section]{\bfseries}{\itshape}
\spnewtheorem{ob}{Observation}[section]{\bfseries}{\itshape}
\DeclareMathOperator{\Div}{div} % \div is already defined
\DeclareMathOperator{\D}{\mathbf{D}}
\DeclareMathOperator{\FP}{p}
\DeclareMathOperator{\Span}{Span}
\newcommand{\boldalpha}{\bm{\alpha}}
\newcommand{\boldpi}{\bm{\pi}}
\newcommand{\boldzeta}{\bm{\zeta}}
\newcommand\boldtheta{\bm{\theta}}
\begin{document}
\section{Solution}\label{Solution}
\begin{lem}\label{conditions}
Words for lemma
\end{lem}
\begin{thm}\label{mainthm}
Words for theorem
\end{thm}
\begin{rem}\label{remone}
Words for remark
\end{rem}
\section{Analysis}\label{Analysis}
\begin{pro}\label{observation}
Words for proposition
\end{pro}
\begin{rem}\label{remtwo}
Words for remark
\end{rem}
\begin{thm}\label{secondthm}
Words for remark
\end{thm}
\begin{pro}\label{proposition}
Words for proposition
\end{pro}
\end{document}
Note that I left only the packages necessary for the example to run. Note also how I redefined your personal commands, in the correct way: in particular, don't redefine commands you don't know about (\div
, in this case).
About the packages you load in the example:
amsfonts
is already loaded byamssymb
amsthm
is not compatible withsvjour3
epsfig
must not be loaded in new document (it's just for back compatibility)subfigure
has been obsolete for 10+ years, call\usepackage[caption=false]{subfig}
instead; the
\subfigure
command becomes\subfloat
.
About the theorem numbering: having separate counters for all kinds of statements is unnecessarily confusing for the reader, who will have hard times in finding the statements when referenced at: is lemma 1.1 before or after proposition 1.1?