![ToC 標題出現在下一章](https://rvso.com/image/391712/ToC%20%E6%A8%99%E9%A1%8C%E5%87%BA%E7%8F%BE%E5%9C%A8%E4%B8%8B%E4%B8%80%E7%AB%A0.png)
我正在寫一份文件,我想在其中包含目錄,然後我將寫一個序言。
關於如何添加正確的標題有什麼想法嗎?
範例程式碼如下
\documentclass{book}
\usepackage[Conny]{fncychap}%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
\UCTfalse
\usepackage{blindtext}
\begin{document}
\tableofcontents
\chapter*{Prologue}
\blindtext[5]
\end{document}
答案1
抑制章節名稱會\chapter*{}
導致標題不更新。您可以透過新增來更改它\markboth{Prologue}{}
。
\documentclass{book}
\usepackage[Conny]{fncychap}%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
\UCTfalse
\usepackage{blindtext}
\begin{document}
\tableofcontents
\chapter*{Prologue}
\addcontentsline{toc}{chapter}{Prologue} % if you want to add the Prologue to TOC
\markboth{Prologue}{} % to change the header despite \chapter*{} command
\blindtext[5]
\end{document}
希望這可以幫助 :)
*
編輯:請注意,如果您希望它更改標題,而不僅僅是在目錄之後,則必須對使用 抑制的每一章執行此操作。
答案2
您可以使用\frontmatter
,\mainmatter
和\backmatter
命令,並將整個 frontmatter 放在一個「群組」(\begingroup
和\endgroup
命令)中,並\pagestyle{plain}
在 後面加上一個命令\frontmatter
:
\documentclass{book}
\usepackage[Conny]{fncychap}%Options: Sonny, Lenny, Glenn, Conny, Rejne, Bjarne, Bjornstrup
\UCTfalse
\usepackage{blindtext}
\title{Test}
\begin{document}
\maketitle
\begingroup
\pagestyle{plain}
\frontmatter
\tableofcontents
\chapter*{Prologue}
\blindtext[5]
\endgroup
\mainmatter
\chapter{Introduction}
\blindtext[5]
\backmatter
\appendix
\chapter{App1}
\blindtext[5]
\end{document}
檢查上述程式碼結果中的頁首和頁腳,看看一切是否符合您的預期。