I've found this .cls template on the web and modified it a little bit (I deleted the title page part, otherwise my post would be to long):

%% This file is part of the LaTeX2e system. 
%% ---------------------------------------- 
\ProvidesClass{thesis}[2009/01/06 Rensselaer Polytechnic Institute]
%  Note that the setspace package is built in (code included near the end of 
%  this file) to provide "line-and-a half spacing" (1.4 by default) and also
%  the singlespace environment. 

% RPI option chap:
\newif\ifchap  % true for chap option
  \chapfalse   % false by default
\DeclareOption{chap}{\chaptrue} % option to print "Chapter" at each new chapter
\newcommand\docsize{}  % to allow 10pt or 11pt to be specified as option
%  Prepare to load the standard report class (12pt):
\ExecuteOptions{12pt}         % define 12pt as the default doc size
\LoadClass[\docsize]{report}  % load report.cls

%  The following sections are revisions or additions to report.cls
%  FOOTNOTES:   make them continuously numbered throughout document
% define command that can undo having footnotes reset with each chapter:
% (taken from removefr.sty by Donald Arseneau) 
   \expandafter\let\expandafter\@tempa\csname c@#1\endcsname
   \def\@elt##1{\expandafter\ifx\csname c@##1\endcsname\@tempa\else
   \expandafter\edef\csname cl@#2\endcsname{\csname cl@#2\endcsname}%
% use the command \@removefromreset to undo the \@addtoreset in report.cls:
% define command to allow people to reset footnote counter at will: 
\def\resetfootnote{\setcounter{footnote}{0}}  % definition to reset footnote

\if@twoside                 % Values for two-sided printing:
   \oddsidemargin .55in     %   Left margin on odd-numbered pages.
   \evensidemargin .05in    %   Left margin on even-numbered pages.
   \marginparwidth 40pt     %   Width of marginal notes.
\else                       % Values for one-sided printing:
   \oddsidemargin 0.55in    %   Note that \oddsidemargin = \evensidemargin
   \evensidemargin 0.55in
   \marginparwidth 40pt
\marginparsep 10pt          % Horizontal space between outer margin and
                            % marginal note
\textwidth 5.9in            % width of text

                         % Top of page:
\topmargin -.5in         %    distance from top of page to running head
\headheight 14pt         %    Height of box containing running head.
\headsep .4in            %    Space between running head and text.
\textheight 8.8in        %    space for text
\footskip 30pt           %    Distance from baseline of box containing foot
                         %    to baseline of last line of text.

%                            SECTION HEADINGS

\setcounter{secnumdepth}{3}    % Number subsubsections in the chapters
\setcounter{tocdepth}{3}       % Put subsubsections in the table of contents

% Print "CHAPTER" if chap option is specified:

\def\specialhead#1{%   GENERAL HEADING WITHOUT A NUMBER (for abstract, etc.)
     \chapter*{\centering #1 \@mkboth{#1}{#1}}}

\def\@chapter[#1]#2{\ifnum\c@firstchapter=0    % start of rpi added stuff
                    \pagestyle{myheadings}      % end of rpi added stuff
                    \ifnum \c@secnumdepth >\m@ne
%                    \addtocontents{lof}{\protect\addvspace{10\p@}}%
%                    \addtocontents{lot}{\protect\addvspace{10\p@}}%
  {\parindent \z@ \raggedright \centering \normalfont \chaptersize
    \ifnum \c@secnumdepth >\m@ne
         \bfseries \@chapapp{} \thechapter    % print "Chapter" and number
         \vskip -3pt           %\par\nobreak (original)
         \bfseries \thechapter. 
    \bfseries #1\par\nobreak
    \vskip 15\p@

\def\@makeschapterhead#1{%    heading for chapter* command (no numbering)
  {\parindent \z@ \raggedright \centering
    \normalfont  \chaptersize 
    \bfseries  #1\par\nobreak
    \vskip 15\p@

\renewcommand\section{\@startsection {section}{1}{\z@}%
                                   {3.5ex \@plus 1ex \@minus .2ex}%
                                   {.5ex \@plus .3ex}%{1.4ex \@plus.2ex}%
                                     {3.25ex\@plus 1ex \@minus .2ex}%
                                     {.3ex \@plus .2ex}%{1.2ex \@plus .2ex}%
                                     {3.25ex\@plus 1ex \@minus .2ex}%
                                     {.2ex \@plus .1ex}%{1ex \@plus .2ex}%
% \paragraph and \subparagraph headings unchanged from report.cls.


%control float placement:

  \sbox\@tempboxa{\bfseries#1:~~#2}%   Make caption bold
  \ifdim \wd\@tempboxa >\hsize
   {\bfseries #1:~~#2}\par%            Make caption bold
    \global \@minipagefalse


    \vskip -1em \begin{singlespace}      % singlespacing

\renewcommand*\l@chapter{\pagebreak[3]\vskip 10pt plus 1pt minus 1pt
\renewcommand*\l@section{\vskip 6pt plus 1pt minus 1pt
\renewcommand*\l@subsection{\ifnum\c@tocdepth>1\vskip 4pt minus 1pt \fi
\renewcommand*\l@subsubsection{\ifnum\c@tocdepth>2 \vskip 3pt minus 1pt \fi

% The following removed because it's not consistent with entries from longtable
%% modify the definition below (taken from latex.ltx) to include 
%% "Table" and "Figure" in entries for lot and lof: 
%\long\def\@caption#1[#2]#3{%\baselineskip 14.5 pt
%  \addcontentsline{\csname ext@#1\endcsname}{#1}%
%  {\protect\numberline{\csname fnum@#1\endcsname}{\ignorespaces #2}}%
%  \begingroup
%    \@parboxrestore
%    \normalsize
%    \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
%  \endgroup}

    \addcontentsline{toc}{chapter}{\listfigurename}  % add lof to toc
    \chapter*{\centering\listfigurename  % center it
    \vskip -1em \begin{singlespace}  % singlespacing

    \addcontentsline{toc}{chapter}{\listtablename}  % add lot to toc
    \chapter*{\centering\listtablename  % center it
        \vskip -1em \begin{singlespace}  % singlespacing

%remove following at same time as remove code to put "Figure" in LOF
%\renewcommand*\l@figure{\vskip 10pt plus 1pt minus 1pt
%                       \@dottedtocline{1}{0em}{5.8em}}

\renewcommand*\l@figure{\vskip 10pt plus 1pt minus 1pt


% RPI def: for use in making an unnumbered bibliography with hanging indents

% report definition modified for no automatic heading and use ragged right

       {\@latex@warning{Empty `thebibliography' environment}}%

% make the following names uppercase:
\renewcommand\listfigurename{LIST OF FIGURES}
\renewcommand\listtablename{LIST OF TABLES}



\setstretch{1.4}        % at 11 or 12pt this is line-and-a-half spacing
\parindent .4in         % Width of paragraph indentation

\markboth{}{}           % Do not include chapter titles in headers;
\pagestyle{myheadings}  % include just page numbers in upper right

\renewcommand{\bibalign}{\raggedright}  %  bibliography is ragged right
% for fully justified bibliography: \renewcommand{\bibalign}{}

%% End of file `thesis.cls'.

The problem is the following: The numbering of the theorem is like this: 1.0.3, where 1 (chapter). 0 (section) 3.(the number of the object in this section). I would like to modify the .cls template in such a way, that section starts counting at 1 instead of 0. How could I fix this, which means what do I have to change in this template? Thanks for your help


  • 1
    The section counter is incremented by the \section command. If you increment the counter manualy with \stepcounter{section} before the first section header then you first section will be numberd 2. The answer is to put a section header before your first theorem. The zero you see is correct because there are no section header yet, – Danie Els Apr 25 '12 at 10:50
  • 1
    It would be helpful if you augmented your posting with a MWE that generates the unwanted behavior. From your description alone, it would appear that you have a \chapter statement and later a \subsubsection statement, but no intermediate \subsection statement. If that's the case, there's nothing wrong with the class file you're working with. – Mico Apr 25 '12 at 10:53
  • Thanks you both for your comments. Sorry if my questions was not that clear. My first chapter is the Introduction. There I do not want to subdivide it into different sections. But I also want that a Theorem is stated like: Theorem 1.1.1 instead of Theorem 1.0.1 – m. th Apr 25 '12 at 11:02
  • So you just need to put \stepcounter{section} immediately after \chapter{Introduction}, and likewise for any other chapters that are not divided into sections. It's a bit odd to have theorems in the introduction, though! – Ian Thompson Apr 25 '12 at 12:06
  • perfect, that's exactly what I wanted! – m. th Apr 25 '12 at 12:52

If you are using a theorem number of 1.1.1, 1.1.2, etc in a chapter without sections it can be very confusing. I recommend that you reset the theorem counter to a lower level for such chapter, e.g. 1.1, 1.2, etc.

I cannot see where the theorem definition is but assume it is with the amsthm package. See code below

Edit 1: Move \setthmtochp and \setthmtosec before \chapter commands



    \@removefromreset{thm}{chapter}% just in case ... (no harm done)
    \@removefromreset{thm}{section}% just in case ... (no harm done)

\setthmtochp%--Edit 1
\begin{thm}[The title]Some statements ... \end{thm}
\begin{thm}[The title]Some statements ... \end{thm}

\setthmtosec%--Edit 1
\chapter{First Chapter}
\section{A section}
\begin{thm}[The title]Some statements ... \end{thm}
\begin{thm}[The title]Some statements ... \end{thm}

\section{A section}
\begin{thm}[The title]Some statements ... \end{thm}
\begin{thm}[The title]Some statements ... \end{thm}

I see that \@removefromreset is already defined in your class and you may not need the remreset package.

  • @math: Please see changes where \setthmtochp and \setthmtosec was moved to be before \chapter commands – Danie Els Apr 25 '12 at 13:49

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.