自定义模板中的章节和节未编号

自定义模板中的章节和节未编号

我有一个撰写硕士论文的模板,但章节和部分没有编号(应该编号)。

下面是我的类文件的一部分(不是整个文件,因为它太大):

\def\@maketitle{
  \newpage
  \null
  \vskip 2em
  \begin{center}
  \let \footnote \thanks
    {\LARGE \@title \par}
    \vskip 1.5em
    {\large
    \lineskip .5em
      \begin{tabular}[t]{c}
        \@author
      \end{tabular}\par}
    \vskip 1em
    {\large \@date}
  \end{center}
  \par
  \vskip 1.5em}
\fi
\newcommand*\chaptermark[1]{}
\setcounter{secnumdepth}{2}
\newcounter {part}
\newcounter {chapter}
\newcounter {section}[chapter]
\newcounter {subsection}[section]
\newcounter {subsubsection}[subsection]
\newcounter {paragraph}[subsubsection]
\newcounter {subparagraph}[paragraph]
\renewcommand \thepart {\@Roman\c@part}
\renewcommand \thechapter {\@arabic\c@chapter}
\renewcommand \thesection {\thechapter.\@arabic\c@section}
\renewcommand\thesubsection   {\thesection.\@arabic\c@subsection}
\renewcommand\thesubsubsection{\thesubsection .\@arabic\c@subsubsection}
\renewcommand\theparagraph    {\thesubsubsection.\@arabic\c@paragraph}
\renewcommand\thesubparagraph {\theparagraph.\@arabic\c@subparagraph}
\newcommand\@chapapp{\chaptername}
\newcommand\frontmatter{
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \@mainmatterfalse
  \@backmatterfalse
  \pagenumbering{roman}}
\newcommand\mainmatter{
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \@mainmattertrue
  \@backmatterfalse
  \pagenumbering{arabic}}
\newcommand\backmatter{
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \@mainmatterfalse
  \@backmattertrue
  }
\newcommand\part{
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \if@twocolumn
    \onecolumn
    \@tempswatrue
  \else
    \@tempswafalse
  \fi
  \null\vfil
  \secdef\@part\@spart}

\def\@part[#1]#2{
    \ifnum \c@secnumdepth >-2\relax
      \refstepcounter{part}
      \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}
    \else
      \addcontentsline{toc}{part}{#1}
    \fi
    \markboth{}{}
    {\centering
     \interlinepenalty \@M
     \normalfont
     \ifnum \c@secnumdepth >-2\relax
       \normalsize\bfseries \partname~\thepart
      \par
       \vskip 20\p@
     \fi
     \normalsize \bfseries #2\par}
    \@endpart}
\def\@spart#1{
    {\centering
     \interlinepenalty \@M
     \normalfont
     \normalsize \bfseries #1\par}
    \@endpart}
\def\@endpart{\vfil\newpage
              \if@twoside
                \null
                \thispagestyle{empty}
                \newpage
              \fi
              \if@tempswa
                \twocolumn
              \fi}
\newcommand\chapter{\if@openright\cleardoublepage\else\clearpage\fi
                    \global\@topnum\z@
                    \@afterindentfalse
                    \secdef\@chapter\@schapter}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                       \if@mainmatter
                         \refstepcounter{chapter}
                         \typeout{\@chapapp\space \thechapter.}
                         \addcontentsline{toc}{chapter}
                                   {\protect\numberline{\thechapter}#1}
                       \else
                         \addcontentsline{toc}{chapter}{ \uppercase #1}
                       \fi
                    \else
                      \addcontentsline{toc}{chapter}{ \uppercase #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\@makehead#1{
% \def\@makechapterhead#1{
  \vspace*{0\p@}
  {\parindent 
   \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
     \if@mainmatter
      \large \bfseries \thechapter  \uppercase{#1} \par\nobreak 
       \par\nobreak
      \vskip 20\p@
     \fi
     \if@backmatter
       \large \bfseries \thechapter   \par\nobreak 
          \par\nobreak
        \vskip 20\p@
      \fi
    \fi
   \interlinepenalty\@M
  } }
%no chapter numbering
  \def\@schapter#1{\if@twocolumn
                   \@topnewpage[\@makeschapterhead{#1}]
                 \else
                   \@makeschapterhead{#1}
                   \@afterheading
                 \fi}

\def\@makeschapterhead#1{
  \vspace*{0\p@}
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \normalsize \bfseries { \uppercase #1 } \par\nobreak%
    \vskip 40\p@
  }}

\newcommand\section{\@startsection {section}{1}{\z@}
                                   {-3.5ex \@plus -1ex \@minus -.2ex}
                                   {2.3ex \@plus.2ex}
                                   {\normalfont\normalsize\bfseries}}
\newcommand\subsection{\@startsection{subsection}{2}{\z@}
                                     {-3.25ex\@plus -1ex \@minus -.2ex}
                                     {2.3ex  \@plus .2ex}
                                     {\normalfont\normalsize\bfseries}}
\newcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}
                                     {-3.25ex\@plus -1ex \@minus -.2ex}
                                     {2.3ex \@plus .2ex}
                                     {\normalfont\normalsize\bfseries}}
\newcommand\paragraph{\@startsection{paragraph}{4}{\z@}
                                    {3.25ex \@plus1ex \@minus.2ex}
                                    {-1em}
                                    {\normalfont\normalsize\bfseries}}
\newcommand\subparagraph{\@startsection{subparagraph}{5}{\parindent}
                                       {3.25ex \@plus1ex \@minus .2ex}
                                       {-1em}
                                      {\normalfont\normalsize\bfseries}}                          
\if@twocolumn
  \setlength\leftmargini  {2em}
\else
  \setlength\leftmargini  {2.5em}
\fi \leftmargin  \leftmargini \setlength\leftmarginii  {2.2em}
\setlength\leftmarginiii {1.87em} \setlength\leftmarginiv  {1.7em}
\if@twocolumn
  \setlength\leftmarginv  {.5em}
  \setlength\leftmarginvi {.5em}
\else
  \setlength\leftmarginv  {1em}
  \setlength\leftmarginvi {1em}
\fi \setlength  \labelsep  {.5em} \setlength  \labelwidth{\leftmargini}
\addtolength\labelwidth{-\labelsep} \@beginparpenalty -\@lowpenalty
\@endparpenalty   -\@lowpenalty \@itempenalty     -\@lowpenalty
\renewcommand\theenumi{\@arabic\c@enumi}
\renewcommand\theenumii{\@alph\c@enumii}
\renewcommand\theenumiii{\@roman\c@enumiii}
\renewcommand\theenumiv{\@Alph\c@enumiv}
\newcommand\labelenumi{\theenumi.}
\newcommand\labelenumii{(\theenumii)}
\newcommand\labelenumiii{\theenumiii.}
\newcommand\labelenumiv{\theenumiv.}
\renewcommand\p@enumii{\theenumi}
\renewcommand\p@enumiii{\theenumi(\theenumii)}
\renewcommand\p@enumiv{\p@enumiii\theenumiii}
\newcommand\labelitemi{\textbullet}
\newcommand\labelitemii{\normalfont\bfseries \textendash}
\newcommand\labelitemiii{\textasteriskcentered}
\newcommand\labelitemiv{\textperiodcentered}
\newenvironment{description}
               {\list{}{\labelwidth\z@ \itemindent-\leftmargin
                        \let\makelabel\descriptionlabel}}
               {\endlist}
\newcommand*\descriptionlabel[1]{\hspace\labelsep
                                \normalfont\bfseries #1}
\newenvironment{verse}
               {\let\\\@centercr
                \list{}{\itemsep      \z@
                        \itemindent   -1.5em
                        \listparindent\itemindent
                        \rightmargin  \leftmargin
                        \advance\leftmargin 1.5em}
                \item\relax}
               {\endlist}
\newenvironment{quotation}
               {\list{}{\listparindent 1.5em
                        \itemindent    \listparindent
                        \rightmargin   \leftmargin
                        \parsep        \z@ \@plus\p@}
                \item\relax}
               {\endlist}
\newenvironment{quote}
               {\list{}{\rightmargin\leftmargin}
                \item\relax}
               {\endlist}

\if@compatibility
    \newenvironment{titlepage}
        {
          \cleardoublepage
          \if@twocolumn
            \@restonecoltrue\onecolumn
          \else
            \@restonecolfalse\newpage
          \fi
          \thispagestyle{empty}
          \setcounter{page}\z@
        }
        {\if@restonecol\twocolumn \else \newpage \fi
        }
\else
    \newenvironment{titlepage}
        {
          \cleardoublepage
          \if@twocolumn
            \@restonecoltrue\onecolumn
          \else
            \@restonecolfalse\newpage
          \fi
          \thispagestyle{empty}
          \setcounter{page}\@ne
        }
        {\if@restonecol\twocolumn \else \newpage \fi
         \if@twoside\else
            \setcounter{page}\@ne
         \fi
        }
\fi
\setlength\arraycolsep{5\p@} \setlength\tabcolsep{6\p@}
\setlength\arrayrulewidth{.4\p@} \setlength\doublerulesep{2\p@}
\setlength\tabbingsep{\labelsep} \skip\@mpfootins = \skip\footins
\setlength\fboxsep{3\p@} \setlength\fboxrule{.4\p@} \@addtoreset
{equation}{chapter}
\renewcommand\theequation
  {\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@equation}
\newcounter{figure}[chapter]
\renewcommand \thefigure
     {\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@figure}
\def\fps@figure{tbp}
\def\ftype@figure{1}
\def\ext@figure{lof}
\def\fnum@figure{\figurename~\thefigure}
\newenvironment{figure}
               {\@float{figure}}
               {\end@float}
\newenvironment{figure*}
               {\@dblfloat{figure}}
               {\end@dblfloat}
\newcounter{table}[chapter]
\renewcommand \thetable
     {\ifnum \c@chapter>\z@ \thechapter.\fi \@arabic\c@table}
\def\fps@table{tbp}
\def\ftype@table{2}
\def\ext@table{lot}
\def\fnum@table{\tablename~\thetable}
\newenvironment{table}
               {\@float{table}}
               {\end@float}
\newenvironment{table*}
               {\@dblfloat{table}}
               {\end@dblfloat}
\newlength\abovecaptionskip
\newlength\belowcaptionskip
\setlength\abovecaptionskip{10\p@} \setlength\belowcaptionskip{10\p@}
\long\def\@makecaption#1#2{
  \vskip\abovecaptionskip
 %% ----------------------------------------
 %\caption set up
\sbox \@tempboxa{\begin{center} \begin{minipage} [t]{14cm}
\begin{center} #1 {\bf --}  #2 \end{center} \end{minipage}
\end{center}}
  \ifdim \wd\@tempboxa >\hsize
    #1 {\bf --} #2\par
  \else
    \global \@minipagefalse
    \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
  \fi
  \vskip\belowcaptionskip}
\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
\DeclareRobustCommand*\cal{\@fontswitch\relax\mathcal}
\DeclareRobustCommand*\mit{\@fontswitch\relax\mathnormal}
\newcommand\@pnumwidth{1.25cm}
\newcommand\@tocrmarg{2.5cm}
\newcommand\@dotsep{1.8}
\setcounter{tocdepth}{2}
\newcommand\tableofcontents{
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{   \centering\contentsname 
        \@mkboth{
            \uppercase\contentsname}{ \uppercase\contentsname}}
    \@starttoc{toc}
    \if@restonecol\twocolumn\fi
    }
\newcommand*\l@part[2]{
  \ifnum \c@tocdepth >-2\relax
    \addpenalty{-\@highpenalty}
    \addvspace{2.25em \@plus\p@}
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      {\leavevmode
      \normalsize \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
      \nobreak
         \global\@nobreaktrue
         \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}
\newcommand*\l@chapter[2]{  \uppercase{
  \ifnum \c@tocdepth >\m@ne
    \addpenalty{-\@highpenalty}
    \vskip 1.0em \@plus\p@
    \setlength\@tempdima{1.25cm}
    \begingroup
      \parindent \z@ \rightskip \@pnumwidth
      \parfillskip -\@pnumwidth
      \leavevmode \bfseries
      \advance\leftskip\@tempdima
      \hskip -\leftskip
      #1\nobreak{\normalfont\dotfill}\nobreak\hb@xt@\@pnumwidth{\hss #2}\par
      \penalty\@highpenalty
    \endgroup
  \fi} }
 %% ----------------------------------------
 %list of figures
\newcommand*\l@section{\@dottedtocline{1}{1.5em}{2.3em}}
\newcommand*\l@subsection{\@dottedtocline{2}{3.8em}{3.2em}}
\newcommand*\l@subsubsection{\@dottedtocline{3}{7.0em}{4.1em}}
\newcommand*\l@paragraph{\@dottedtocline{4}{10em}{5em}}
\newcommand*\l@subparagraph{\@dottedtocline{5}{12em}{6em}}
\newcommand\listoffigures{%                             
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{ \hfill {\MakeUppercase{\listfigurename} } \hfill }
    \@starttoc{lof}
    \if@restonecol\twocolumn\fi
    }
\newcommand*\l@figure{\@dottedtocline{1}{0cm}{0cm}}
 %% ----------------------------------------
 %list of tables
\newcommand\listoftables{%                          
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\hfill{ \MakeUppercase{\listtablename} }\hfill
      \@mkboth{ \uppercase\listtablename}{ \uppercase\listtablename}}
    \@starttoc{lot}
    \if@restonecol\twocolumn\fi
    }
\let\l@table\l@figure
\newdimen\bibindent
\xdef\@tempa{\@nameuse{b@#1}}
 %% ----------------------------------------
 %bibliography 
\setlength\bibindent{1.25cm}
\newenvironment{thebibliography}[1]
    {\newpage\chapter*{\bibname
      \@mkboth{ \uppercase\bibname}{ \uppercase\bibname}}
      \list{\@biblabel{\@arabic\c@enumiv}}
           {\settowidth\labelwidth{\@biblabel{#1}}
            \setlength{\leftmargin}{0em}
            \setlength{\itemindent}{1cm}
            \advance\leftmargin\labelsep
            \@openbib@code
            \usecounter{enumiv}
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}
     \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000
      \sfcode`\.\@m}
     {\def\@noitemerr
     {\@latex@warning{Empty `thebibliography' environment}}%
     \endlist}
 %% ----------------------------------------
 %biblabel modifier
\renewcommand{\@biblabel}[1]{\hfill}
\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}
\let\@openbib@code\@empty
 %% ----------------------------------------
 %renaming
\newenvironment{theindex}
               {\if@twocolumn
                  \@restonecolfalse
                \else
                  \@restonecoltrue
                \fi
                \columnseprule \z@
                \columnsep 35\p@
                \twocolumn[\@makeschapterhead{\indexname}]
                \@mkboth{ \uppercase\indexname}
                        { \uppercase\indexname}
                \thispagestyle{plain}\parindent\z@
                \parskip\z@ \@plus .3\p@\relax
                \let\item\@idxitem}
               {\if@restonecol\onecolumn\else\clearpage\fi}    
\newcommand\@idxitem{\par\hangindent 40\p@}
\newcommand\subitem{\@idxitem \hspace*{20\p@}}
\newcommand\subsubitem{\@idxitem \hspace*{30\p@}}
\newcommand\indexspace{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax}
\renewcommand\footnoterule{
  \kern-3\p@
  \hrule\@width.4\columnwidth
  \kern2.6\p@}
\@addtoreset{footnote}{chapter}
\newcommand\@makefntext[1]{
    \parindent 1em
    \noindent
    \hb@[email protected]{\hss\@makefnmark}#1}
\newcommand\contentsname{INDEX}
\newcommand\listfigurename{List of Figures}
\newcommand\listtablename{List of Tables}
\newcommand\bibname{Bibliography}
\newcommand\indexname{Index}
\newcommand\figurename{Figure}
\newcommand\tablename{Table}
\newcommand\partname{Part}
\newcommand\chaptername{Chapter}
\newcommand\appendixname{Appendix}
\newcommand\annexname{Annex}
% \newcommand{\listsymbolname}{{\normalsize\bf LIST OF SYMBOLS} }
% \renewcommand{\contentsname}{\normalsize\bf \'{I}NDICE}
% \renewcommand{\listfigurename}{\centering{\normalsize\bfseries LISTA DE FIGURAS}}
% \renewcommand{\listtablename}{\normalsize\bf LISTA DE TABELAS}
% \renewcommand{\bibname}{\normalsize\bf REFER\^{E}NCIAS BIBLIOGR\'{A}FICAS}
% \renewcommand{\indexname}{\normalsize\bf \'{I}NDICE}
% \renewcommand{\figurename}{Figura}
% \renewcommand{\tablename}{Tabela}
% \renewcommand{\partname}{Parte}
% \renewcommand{\chaptername}{CAP\'{I}TULO}
% \renewcommand{\appendixname}{AP\^{E}NDICE}
% \renewcommand{\annexname}{ANEXO}
\def\today{\number\day\space de\space\ifcase\month\or
  Janeiro\or Fevereiro\or Mar\c{c}o\or Abril\or Maio\or Junho\or
  Julho\or Agosto\or Setembro\or Outubro\or Novembro\or Dezembro\fi
  \space de\space \number\year}
\setlength\columnsep{10\p@} \setlength\columnseprule{0\p@}
\pagestyle{headings} \pagenumbering{arabic} \if@twoside \else
  \raggedbottom
\fi \if@twocolumn
  \twocolumn
  \sloppy
  \flushbottom
\else
  \onecolumn
\fi
 %% -----

提前致谢!!

利桑德罗

相关内容