我在网上找到了这个 .cls 模板并对其进行了一些修改(我删除了标题页部分,否则我的帖子会太长):
%%
%% This file is part of the LaTeX2e system.
%% ----------------------------------------
%%
\NeedsTeXFormat{LaTeX2e}
\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
\DeclareOption{10pt}{\renewcommand\docsize{10pt}}
\DeclareOption{11pt}{\renewcommand\docsize{11pt}}
\DeclareOption{12pt}{\renewcommand\docsize{12pt}}
% Prepare to load the standard report class (12pt):
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ExecuteOptions{12pt} % define 12pt as the default doc size
\ProcessOptions
\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)
\def\@removefromreset#1#2{\let\@tempb\@elt
\expandafter\let\expandafter\@tempa\csname c@#1\endcsname
\def\@elt##1{\expandafter\ifx\csname c@##1\endcsname\@tempa\else
\noexpand\@elt{##1}\fi}%
\expandafter\edef\csname cl@#2\endcsname{\csname cl@#2\endcsname}%
\let\@elt\@tempb}
% use the command \@removefromreset to undo the \@addtoreset in report.cls:
\@removefromreset{footnote}{chapter}
%
% define command to allow people to reset footnote counter at will:
\def\resetfootnote{\setcounter{footnote}{0}} % definition to reset footnote
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% PAGE LAYOUT
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SIDE MARGINS:
\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
\fi
\marginparsep 10pt % Horizontal space between outer margin and
% marginal note
\textwidth 5.9in % width of text
% VERTICAL SPACING:
% 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand\chaptersize{\large}
\newcommand\sectionsize{\large}
\newcommand\subsectionsize{\normalsize}
\newcommand\subsubsectionsize{\normalsize}
\newcounter{firstchapter}
\setcounter{firstchapter}{0}
\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:
\ifchap
\renewcommand\@chapapp{\chaptername}
\else
\renewcommand\@chapapp{}
\fi
\def\specialhead#1{% GENERAL HEADING WITHOUT A NUMBER (for abstract, etc.)
\ifx\phantomsection\undefined
\else
\clearpage\phantomsection
\fi
\addcontentsline{toc}{chapter}{#1}
\chapter*{\centering #1 \@mkboth{#1}{#1}}}
\def\@chapter[#1]#2{\ifnum\c@firstchapter=0 % start of rpi added stuff
\if@twoside\cleardoublepage\suppressfloats[t]\fi
\pagenumbering{arabic}
\setcounter{firstchapter}{1}
\fi
\renewcommand{\thepage}{\arabic{page}}
\thispagestyle{plain}
\pagestyle{myheadings} % end of rpi added stuff
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter.}#1}%
\else
\addcontentsline{toc}{chapter}{#1}%
\fi
\chaptermark{#1}%
% \addtocontents{lof}{\protect\addvspace{10\p@}}%
% \addtocontents{lot}{\protect\addvspace{10\p@}}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi}
\def\@makechapterhead#1{%
\vspace*{0\p@}%
{\parindent \z@ \raggedright \centering \normalfont \chaptersize
\ifnum \c@secnumdepth >\m@ne
\ifchap
\bfseries \@chapapp{} \thechapter % print "Chapter" and number
\vskip -3pt %\par\nobreak (original)
\else
\bfseries \thechapter.
\fi
\fi
\interlinepenalty\@M
\bfseries #1\par\nobreak
\vskip 15\p@
}}
\def\@makeschapterhead#1{% heading for chapter* command (no numbering)
\vspace*{0\p@}%
{\parindent \z@ \raggedright \centering
\normalfont \chaptersize
\interlinepenalty\@M
\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}%
{\normalfont\sectionsize\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{\z@}%
{3.25ex\@plus 1ex \@minus .2ex}%
{.3ex \@plus .2ex}%{1.2ex \@plus .2ex}%
{\normalfont\subsectionsize\bfseries}}
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}%
{3.25ex\@plus 1ex \@minus .2ex}%
{.2ex \@plus .1ex}%{1ex \@plus .2ex}%
{\normalfont\subsubsectionsize\bfseries}}
% \paragraph and \subparagraph headings unchanged from report.cls.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% APPENDIX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\appendix{\par
\setcounter{chapter}{0}%
\setcounter{section}{0}%
\chaptrue
\renewcommand\@chapapp{\appendixname}%
\renewcommand\thechapter{\@Alph\c@chapter}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FIGURES and TABLES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%control float placement:
%
\setcounter{topnumber}{2}
\renewcommand\topfraction{.8}
\setcounter{bottomnumber}{2}
\renewcommand\bottomfraction{.8}
\setcounter{totalnumber}{4}
\renewcommand\textfraction{.2}
\renewcommand\floatpagefraction{.8}
\setcounter{dbltopnumber}{2}
\renewcommand\dbltopfraction{.8}
\renewcommand\dblfloatpagefraction{.8}
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{\bfseries#1:~~#2}% Make caption bold
\ifdim \wd\@tempboxa >\hsize
{\bfseries #1:~~#2}\par% Make caption bold
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% TABLE of CONTENTS, LIST OF TABLES, LIST OF FIGURES
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\renewcommand\tableofcontents{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\chapter*{\contentsname
\@mkboth{%
\MakeUppercase\contentsname}{\MakeUppercase\contentsname}}%
\vskip -1em \begin{singlespace} % singlespacing
\@starttoc{toc}%
\if@restonecol\twocolumn\fi
\end{singlespace}
}
\renewcommand*\l@chapter{\pagebreak[3]\vskip 10pt plus 1pt minus 1pt
\@dottedtocline{0}{0em}{1.4em}}
\renewcommand*\l@section{\vskip 6pt plus 1pt minus 1pt
\@dottedtocline{1}{1.5em}{2.3em}}
\renewcommand*\l@subsection{\ifnum\c@tocdepth>1\vskip 4pt minus 1pt \fi
\@dottedtocline{2}{3.8em}{3.2em}}
\renewcommand*\l@subsubsection{\ifnum\c@tocdepth>2 \vskip 3pt minus 1pt \fi
\@dottedtocline{3}{7.0em}{4.1em}}
% 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}
\renewcommand\listoffigures{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\ifx\phantomsection\undefined
\else
\clearpage\phantomsection
\fi
\addcontentsline{toc}{chapter}{\listfigurename} % add lof to toc
\chapter*{\centering\listfigurename % center it
\@mkboth{\MakeUppercase\listfigurename}%
{\MakeUppercase\listfigurename}}%
\vskip -1em \begin{singlespace} % singlespacing
\@starttoc{lof}%
\if@restonecol\twocolumn\fi
\end{singlespace}
}
\renewcommand\listoftables{%
\if@twocolumn
\@restonecoltrue\onecolumn
\else
\@restonecolfalse
\fi
\ifx\phantomsection\undefined
\else
\clearpage\phantomsection
\fi
\addcontentsline{toc}{chapter}{\listtablename} % add lot to toc
\chapter*{\centering\listtablename % center it
\@mkboth{\MakeUppercase\listtablename}%
{\MakeUppercase\listtablename}}%
\vskip -1em \begin{singlespace} % singlespacing
\@starttoc{lot}%
\if@restonecol\twocolumn\fi
\end{singlespace}
}
%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
\@dottedtocline{1}{0em}{2.8em}}
\let\l@table\l@figure
\let\rpicaption\caption
\let\lrpicaption\caption
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% BIBLIOGRAPHY
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% RPI def: for use in making an unnumbered bibliography with hanging indents
\def\bibentry{\vskip10pt\par\noindent\hangindent=40pt\frenchspacing}
% report definition modified for no automatic heading and use ragged right
\newcommand{\bibalign}{\raggedright}
\renewenvironment{thebibliography}[1]
{\bibalign\frenchspacing
\list{\@biblabel{\@arabic\c@enumiv}}%
{\settowidth\labelwidth{\@biblabel{#1}}%
\leftmargin\labelwidth
\advance\leftmargin\labelsep
\@openbib@code
\usecounter{enumiv}%
\let\p@enumiv\@empty
\renewcommand\theenumiv{\@arabic\c@enumiv}}%
\sloppy\clubpenalty4000\widowpenalty4000%
\sfcode`\.=\@m}
{\def\@noitemerr
{\@latex@warning{Empty `thebibliography' environment}}%
\endlist}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SOME INITIALIZATIONS:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% make the following names uppercase:
\renewcommand\contentsname{CONTENTS}
\renewcommand\listfigurename{LIST OF FIGURES}
\renewcommand\listtablename{LIST OF TABLES}
\renewcommand\bibname{BIBLIOGRAPHY}
\renewcommand\indexname{INDEX}
\renewcommand\partname{PART}
\renewcommand\chaptername{CHAPTER}
\renewcommand\appendixname{APPENDIX}
\renewcommand\abstractname{ABSTRACT}
\renewcommand\chaptersize{\large}
\renewcommand\sectionsize{\large}
\renewcommand\subsectionsize{\normalsize}
\renewcommand\subsubsectionsize{\normalsize}
\raggedbottom
\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}{}
\endinput
%%
%% End of file `thesis.cls'.
问题如下:定理的编号如下:1.0.3,其中 1(章节)。0(节)3.(此节中对象的编号)。我想修改 .cls 模板,使该节从 1 开始计数,而不是从 0 开始。我该如何修复此问题,这意味着我必须在此模板中进行哪些更改?感谢您的帮助
数学
答案1
如果您在没有章节的章节中使用定理编号 1.1.1、1.1.2 等,可能会非常混乱。我建议您将此类章节的定理计数器重置为较低的级别,例如 1.1、1.2 等。
我看不到定理定义在哪里,但假设它与amsthm
包中。参见下面的代码
编辑1:移动\setthmtochp
and至命令\setthmtosec
之前\chapter
\documentclass{report}
\usepackage{amsmath,amsthm}
\usepackage{remreset}
\newtheorem{thm}{Theorem}[section]
\renewcommand\thethm{\thesection.\arabic{thm}}
\makeatletter
\newcommand\setthmtochp{%
\@removefromreset{thm}{chapter}% just in case ... (no harm done)
\@removefromreset{thm}{section}%
\@addtoreset{thm}{chapter}%
\renewcommand\thethm{\thechapter.\arabic{thm}}}
\newcommand\setthmtosec{%
\@removefromreset{thm}{chapter}%
\@removefromreset{thm}{section}% just in case ... (no harm done)
\@addtoreset{thm}{section}%
\renewcommand\thethm{\thesection.\arabic{thm}}}
\makeatother
\begin{document}
\setthmtochp%--Edit 1
\chapter{Introduction}
\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}
\end{document}
我发现它\@removefromreset
已经在你的课程中定义了,你可能不需要这个remreset
包。