我的 LaTeX 论文模板中总共有 7 个章节。前六章的名称和编号正确。但第七章的编号沿用了第六章的编号,而这一新章节的编号尚未更新为 7。
%% =====================================================
%% THESIS DOCUMENT SETUP
%% =====================================================
\documentclass[a4paper, 12pt, twoside]{PThesis}
\usepackage{titlesec}
%\usepackage[T1]{fontenc}
\titlespacing*{\chapter}{0pt}{-5pt}{5pt}
%\titleformat{\chapter}[display]{\normalfont\Large\bfseries}{\chaptertitlename\ \thechapter}{18pt}{Large}
%\renewcommand{\chaptername}{CHAPTER}
\titleformat{\chapter}[display]
{\normalfont\Large\bfseries}
{\filleft\textls{\chaptertitlename} \Huge\thechapter}
{0.5ex}
{\titlerule[3pt]\vspace{0.5ex}\filleft}
\renewcommand{\chaptername}{CHAPTER}
% [\vspace{0.5ex}\titlerule]
\usepackage{epsfig}
\usepackage{epstopdf}
\usepackage{multirow}% http://ctan.org/pkg/multirow
\usepackage[numbers,sort&compress]{natbib}
\usepackage{changepage}
\usepackage[ruled,vlined,linesnumbered,algo2e,resetcount,algochapter]{algorithm2e}
\usepackage{algorithm}
%........TO MAKE ALGORITHM LABELS CHAPTERWISE
\makeatletter
\renewcommand\thealgorithm{\thechapter.\arabic{algorithm}}
\@addtoreset{algorithm}{chapter}
\makeatother
%.....................END...................
\usepackage{algpseudocode}
\usepackage{algcompatible}
\usepackage{bigstrut}
\usepackage{rotating}
\usepackage{multirow}
\newcommand{\blap}[1]{\smash{\begin{tabular}[t]{@{}l@{}}#1\end{tabular}}}
%................FOR LANDSCAPE TABLE
\usepackage{float,lscape}
\usepackage{longtable} %.............LONG TABLE
\titlespacing\section{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\titlespacing\subsubsection{0pt}{12pt plus 4pt minus 2pt}{0pt plus 2pt minus 2pt}
\usepackage{setspace}
\titleformat{\section}{\normalfont\large\bfseries}{\thesection}{1em}{\setstretch{0.2}}
\usepackage{rotating}
\renewcommand{\thesubfigure}{(\alph{subfigure})}
\usepackage{lipsum} % just to generate text for the example
\usepackage[tracking=smallcaps]{microtype}
\usepackage{tabularx}
\usepackage{xcolor}
\usepackage{multirow}
\usepackage{url}
\usepackage{caption}
\captionsetup{labelfont={sf}, labelsep=colon, singlelinecheck = false, textfont=sf, skip = 2pt,figurename=Fig}
\usepackage{parskip}
\usepackage{indentfirst}
\setlength{\parindent}{30pt}% Allows "\bvec{}" and "\buvec{}" for "blackboard" style bold vectors in maths
\usepackage{makeidx} % To make Index at the end
\hypersetup{
colorlinks,
citecolor=black,
linkcolor=black,
urlcolor=black}
\usepackage{url}
\usepackage{array} %.........Centering values in table
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}} %......Centering values in tables
\newcolumntype{M}[1]{>{\centering\arraybackslash}m{#1}} %...vertical centering
\makeindex
\begin{document}
\frontmatter % Begin Roman style (i, ii, iii, iv...) page numbering
%% =====================================================
%% TITLE PAGE
%% =====================================================
\subject {}
\title {{\textbf{\large THESIS TITLE}}
{\textbf{\large }}}
\degree {\textbf{\large DOCTOR OF PHILOSOPHY}}
\guides {\large ABC}
\student {\large ABC}
\department {DEPARTMENT OF ABC}
\college {ABC UNI}{XYZ (X)}
\university {ABC UNI}{XYZ (X)}{}
\date{{\textbf{\large \monthyear}}}
\maketitle
%% ----------------------------------------------------------------
\setstretch{1.6} % It is better to have smaller font and larger line spacing than the other way round
% Define the page headers using the FancyHdr package and set up for one-s1ided printing
\fancyhead{} % Clears all page headers and footers
\rhead{\thepage} % Sets the right side header to show the page number
\lhead{} % Clears the left side page header
\pagestyle{fancy} % Finally, use the "fancy" page style to implement the FancyHdr headers
\setstretch{1.6} % Reset the line-spacing to 1.3 for body text (if it has changed)
%%%=====================================================================================================================================
%%% Inner Page
%%% %%=====================================================================================================================================
%%\addtotoc{CERTIFICATE} % Add the "Index" page entry to the Contents
%\input{./FrontMatter/Innerpage} % Author's Declaration
%\cleardoublepage
%% =====================================================================================================================================
%% COPYRIGHT
%% =====================================================================================================================================
\Copyright{\addtocontents{toc}{\vspace{1em}}
\thispagestyle{empty}
\input{./FrontMatter/Copyright}}
\clearpage
%% %%=====================================================================================================================================
%% CERTIFICATE
%% %%=====================================================================================================================================
\addtotoc{\textit{Candidate's Declaration}} % Add the "Index" page entry to the Contents
\input{./FrontMatter/CERTIFICATE} % Author's Declaration
\pagenumbering{roman}
\cleardoublepage
%%=====================================================================================================================================
%% ACKNOWLEDGEMENTS
%% %%=====================================================================================================================================
\addtotoc{\textit{Acknowledgement}}
\setstretch{1.6} % Add the "Index" page entry to the Contents
\input{./FrontMatter/Acknowledgement} % Acknowledgement
\cleardoublepage
%% %%=====================================================================================================================================
%% ABSTRACT
%% %%=====================================================================================================================================
\addtotoc{\textit{Abstract}} % Add the "Index"} page entry to the Contents
\setstretch{1.45} % Set the line spacing to 1.5, this makes the following tables easier to read
\input{./FrontMatter/Abstract} % Thesis Abstractrtgbhn
\cleardoublepage
\setstretch{1.5}
%%
%=====================================================================================================================================
% TABLE OF CONTENTS
% %%=====================================================================================================================================
\addtotoc{\textit{Contents}} % Add the "Abstract"} page entry to the Contents
\tableofcontents % Write out the Table of Contents
\clearpage % Declaration ended, now start a new page
%%=====================================================================================================================================
%% LIST OF TABLES
%% %%=====================================================================================================================================
\listoftables % Write out the List of Tables
\clearpage % Start a new page
%%
%%=====================================================================================================================================
%% LIST OF FIGURES
%% %%=====================================================================================================================================
\listoffigures % Write out the List of Figures
\clearpage % Declaration ended, now start a new page
%%=====================================================================================================================================
%% ABBREVIATIONS
%% %%=====================================================================================================================================
\addtotoc{\textit{Abbreviations}} % Add the "Abstract" page entry to the Contents
\input{./FrontMatter/Abbreviations} % List of Abbreviations
\clearpage % Declaration ended, now start a new page
%% %%=====================================================================================================================================
%% NOTATIONS
%% %%=====================================================================================================================================
%\addtotoc{NOTATIONS} % Include a list of Abbreviations (a table of %two columns)
%\input{./FrontMatter/Notations} % List of Abbreviations
%\clearpage % Declaration ended, now start a new page
%%
%% =====================================================
%% THESIS CHAPTERS
%% =====================================================
\setstretch{1.5} % Reset the line-spacing to 1.3 for body text (if it has changed)
\mainmatter % Begin normal, numeric (1,2,3...) page numbering
\pagestyle{fancy} % Return the page headers back to the "fancy" style
\input{./Chapter1/Chapter1} % INTRODUCTION
\input{./Chapter2/Chapter2} % LITERATURE
\input{./Chapter3/Chapter3} % EXEFGH
\input{./Chapter4/Chapter4} % CABCD
\input{./Chapter5/Chapter5} % ABCD
\input{./Chapter6/Chapter6} % ABC
\input{./Chapter7/Chapter7} % CONCLUSIONS
\clearpage
%% =====================================================
%% APPENDICES
%% =====================================================
%\appendix % Cue to tell LaTeX that the following 'chapters' are Appendices
%\input{./Appendices/AppendixA} % Appendix Title
%%\input{./Appendices/AppendixB} % Appendix Title
%%\input{./Appendices/AppendixC} % Appendix Title
%\addtocontents{toc}{\vspace{2em}} % Add a gap in the Contents, for aesthetics
%\clearpage % Appendices ended, now start a new page
%%=====================================================================================================================================
%% ABBREVIATIONS
%% %%=====================================================================================================================================
\addtotoc{Publications} % Add the "Abstract" page entry to the Contents
\input{./FrontMatter/Publications} % List of Abbreviations
\clearpage % Declaration ended, now start a new page
%% =====================================================
%% REFERENCES
%% =====================================================
\clearpage
\addcontentsline{toc}{chapter}{REFERENCES} % adds References to contents page
\label{Refer}
\lhead{\emph{REFERENCES}} % Change the left side page header to "Bibliography"
\bibliographystyle{elsarticle-num} % bibliography style
\renewcommand{\bibname}{References} % changes default name Bibliography to References
\bibliography{References} % References file
\clearpage % Declaration ended, now start a new page
%% =====================================================
%% INDEX
%% =====================================================
\label{Index}
\lhead{\emph{INDEX}} % Change the left side page header to "Bibliography"
\addcontentsline{toc}{chapter}{INDEX} % adds References to contents page
\printindex
\renewcommand{\printindex}{INDEX} % changes default name Bibliography to References
%% =====================================================
%% THESIS END
%% =====================================================
\end{document}
答案1
现在,我找到了这个问题的答案。这是因为上一章(第 6 章)中不必要地使用了 } 括号。请正确验证文本,以避免不必要地使用 { 或 } 括号。