使用 \frontmatter 但仍然收到“第 0 章”的致谢

使用 \frontmatter 但仍然收到“第 0 章”的致谢

我正在使用文档类book,其中\frontermatter有摘要、致谢和目录。

我的问题是,致谢部分在标题中有一个“Chapter0”,但其他部分都没有。我该怎么办?

代码如下:

%SDG

% For an intro on LaTeX:  http://ctan.uib.no/info/lshort/english/lshort.pdf

\documentclass[a4paper,twoside,openright]{book}

%------------------------------------------------------------------------------

\renewcommand{\baselinestretch}{1.25} % 1.25 i radavstånd.
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}  % https://www.sharelatex.com/learn/International_language_support
\usepackage{float}
\usepackage{graphicx}
\usepackage[final]{pdfpages} %For the appendices.
\usepackage{hyperref}
\usepackage{array}
\usepackage{fancyhdr}
%\usepackage[round]{natbib}
%\usepackage[
%backend=biber,
%style=alphabetic,
%sorting=ynt
%]{biblatex}

%\addbibresource{mybib.bib} %Imports bibliography file

%The following info should be updated by the authors.
\hypersetup{
    bookmarks=true,     % show bookmarks bar?
    unicode=false,      % non-Latin characters in Acrobat's bookmarks
    pdftoolbar=true,    % show Acrobat's toolbar?
    pdfmenubar=true,    % show Acrobat's menu?
    pdffitwindow=false, % window fit to page when opened
    pdfstartview={FitH},% fits the width of the page to the window
    pdfauthor={xx},
    pdfsubject={Thesis},
    pdftitle={xxx},
    pdfkeywords={xx}{xx} {xx}{xxx}{xxx}{xx} {xx} {xx} {xx}, 
    pdfnewwindow=true,  % links in new window
    colorlinks=true,    % false: boxed links; true: colored links
    linkcolor=black,        % color of internal links (change box color with linkbordercolor)
    citecolor=black,    % color of links to bibliography
    filecolor=magenta,  % color of file links
    urlcolor=blue       % color of external links
}

\usepackage{memhfixc}    % remove conflict between the memoir class & hyperref
\usepackage[activate]{pdfcprot}  % Turn on margin kerning (not in gwTeX)

%------------------------------------------------------------------------------

\begin{document}

\newcolumntype{L}{>{\centering\arraybackslash}m{1.7cm}}
\raggedbottom

%------------------------------------------------------------------------------

\begin{titlepage}

\raggedleft % Right-align all text

\vspace*{\baselineskip} % Whitespace at the top of the page

{\Large xx}\\[0.167\textheight] % Author name

{\LARGE\bfseries M}\\[\baselineskip] % First part of the title, if it is unimportant consider making the font size smaller to accentuate the main title

{\Huge \color{red} xx}\\[\baselineskip] % Main title which draws the focus of the reader

{\Large \textit{xx}}\par % Tagline or further description

\vfill % Whitespace between the title block and the publisher

\begin{figure}[htbp]
\begin{center}
\includegraphics[width=\columnwidth, draft=false]{harvester.jpg}
\label{fig:cover}
\end{center}
\end{figure}

{Spring 2018}\par

\vspace*{2\baselineskip} % Whitespace at the bottom of the page
\thispagestyle{empty}
\end{titlepage}
\thispagestyle{empty}
%-----------------------------------------------------------------------------
\frontmatter

\chapter[{Abstract}]{ \medskip
\sc {Abstract} \medskip \hrule} \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\label{ch:Abstract}
\input{Abstract}

\chapter[{Acknowledgements}]{\medskip
\sc {Acknowledgements} \medskip \hrule} \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\label{ch:Acknowledgements}
\input{acknowledgements}

\tableofcontents


%-----------------------------------------------------------------------------

\mainmatter

\chapter[{Introduction}]{\medskip
\sc {Introduction} \medskip \hrule} \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\label{ch:Intro}
\input{Introduction}

\chapter[{Theory}]{\medskip
\sc {Theory} \medskip \hrule} \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\label{ch:Theory}
\input{Theory}



\chapter[\sc{Methodology}]{\medskip
\sc {Methodology} \medskip \hrule} \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\label{ch:Methodology}
\input{Methodology}

\chapter[\sc{Results}]{\medskip
\sc {Results} \medskip \hrule} \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\label{ch:Results}
\input{Result}

\chapter[\sc{Discussion}]{\medskip
\sc {Discussion} \medskip \hrule} \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\label{ch:Discussion}
\input{Discussion}

\chapter[\sc{Conclusions}]{\medskip
\sc{Conclusions} \medskip \hrule} \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\label{ch:Conclusions}
\input{conclusion} 
%-----------------------------------------------------------------------------


%\includepdf[pages={1-15}]{Appendices/ABS.pdf}

%------------------------------------------------------------------------------


\addcontentsline{toc}{chapter}{Bibliography} % This line add the word to "Bibliography" to the table of contents.
\input{references.bib}
\bibliographystyle{unsrt}
\bibliography{references}


\appendix
\chapter{Appendix}
\input{Appendix}
% https://www.sharelatex.com/learn/Bibliography_management_in_LaTeX

\end{document}

答案1

让我把我的评论转换成答案。在前面你有

%-----------------------------------------------------------------------------
\frontmatter

\chapter[{Abstract}]{ \medskip
\sc {Abstract} \medskip \hrule} \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\label{ch:Abstract}
\input{Abstract}

\chapter[{Acknowledgements}]{\medskip
\sc {Acknowledgements} \medskip \hrule} \pagestyle{fancy}
\renewcommand{\headrulewidth}{0pt}
\label{ch:Acknowledgements}
\input{acknowledgements}

\tableofcontents
%-----------------------------------------------------------------------------
\mainmatter

章节的格式不正常。正确的方法是删除章节标题的格式:

%-----------------------------------------------------------------------------
\frontmatter

\pagestyle{fancy} 
\renewcommand{\headrulewidth}{0pt} 
 \chapter[Abstract]{\textsc{Abstract}} 
 \medskip 
 \hrule 
 \label{ch:Abstract} 
 \input{Abstract} 

  \chapter[Acknowledgements]{\textsc{Acknowledgements}} 
  \medskip 
  \hrule 
  \label{ch:Acknowledgements} 
  \input{acknowledgements} 
%-----------------------------------------------------------------------------
\frontmatter

您在所有章节中也遇到了同样的问题mainmatter。如果您希望为带有章节标题的页面使用不同的页面样式,则需要使用章节样式进行定义。

相关内容