我使用了以下内容作为标题,就像我一样\chapter*
。效果很好,唯一的问题是参考书目,其中标题显示为“第 4 章。参考书目”,因为第 4 章是最后一章。
\documentclass[12pt,a4paper,oneside]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyhf{} % clear the headers
\fancyhead[R]{%
% We want italics
\itshape
% The chapter number only if it's greater than 0
\ifnum\value{chapter}>0 \chaptername\ \thechapter. \fi
% The chapter title
\leftmark}
\fancyfoot[C]{\thepage}
\fancypagestyle{plain}{
\renewcommand{\headrulewidth}{0pt}
\fancyhf{}
\fancyfoot[C]{\thepage}
}
\setlength{\headheight}{14.5pt}
\usepackage{kantlipsum} % for the mock text
\begin{document}
\frontmatter
\chapter{Introduction}
\kant
\mainmatter
\chapter*{Another introduction}
\chaptermark{Another introduction}
\kant
\chapter{Title}
\kant
\end{document}
答案1
简单定义一个新风格bib
\fancypagestyle{bib}{%
\fancyhf{}
\fancyhead[R]{%
% We want italics
\itshape
% The chapter title
Bibliography}
}
并发布
\pagestyle{bib}
就在你的参考书目之前。
梅威瑟:
\documentclass[12pt,a4paper,oneside]{book}
\usepackage{fancyhdr}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\markboth{#1}{}}
\fancyhf{} % clear the headers
\fancyhead[R]{%
% We want italics
\itshape
% The chapter number only if it's greater than 0
\ifnum\value{chapter}>0 \chaptername\ \thechapter. \fi
% The chapter title
\leftmark}
\fancyfoot[C]{\thepage}
\fancypagestyle{bib}{%
\fancyhf{}
\fancyhead[R]{%
% We want italics
\itshape
% The chapter title
Bibliography}
}
\setlength{\headheight}{14.5pt}
\usepackage{kantlipsum} % for the mock text
\begin{document}
\frontmatter
\chapter{Introduction}
\kant
\mainmatter
\chapter*{Another introduction}
\chaptermark{Another introduction}
\kant
\chapter{Title}
\kant
\backmatter
\nocite{*}
\pagestyle{bib}
\bibliographystyle{plain}
\bibliography{test}
\end{document}
输出:
一些评论:
如果你的书目不在
\backmatter
本期\clearpage
在它之前。
我已删除
plain
页面样式:\fancypagestyle{plain}{ \renewcommand{\headrulewidth}{0pt} \fancyhf{} \fancyfoot[C]{\thepage} }
因为它不会改变默认值。
答案2
也许您可以使用该包scrlayer-scrpage
:
\usepackage[markcase=noupper,headsepline,automark]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\leftmark}
\cfoot*{\pagemark}% \cfoot* needs KOMA version 3.14 or newer
%\cfoot[\pagemark]{\pagemark}% with KOMA version 3.12 or 3.13
并定义一个新命令\unnumberedchaptermark
,而不是重新定义\chaptermark
\newcommand*{\unnumberedchaptermark}[1]{\markboth{#1}{}}
为了获得\chaptername
标题,我重新定义了\chaptermarkformat
\renewcommand*{\chaptermarkformat}{\chaptername\ \thechapter. }
如果文档末尾有目录、图表列表或其他带星号的章节,这种方法也同样有效。
例子:
\documentclass[12pt,a4paper,oneside]{book}
\usepackage[markcase=noupper,headsepline,automark]{scrlayer-scrpage}
\clearpairofpagestyles
\ohead{\leftmark}
\cfoot*{\pagemark}% \cfoot* needs KOMA version 3.14 or newer
%\cfoot[\pagemark]{\pagemark}% with KOMA version 3.12 or 3.13
\renewcommand*{\chaptermarkformat}{\chaptername\ \thechapter. }
\newcommand*\unnumberedchaptermark[1]{\markboth{#1}{}}
\setlength{\headheight}{14.5pt}
\usepackage{kantlipsum} % for the mock text
\begin{document}
\frontmatter
\chapter{Introduction}
\kant
\mainmatter
\chapter*{Another introduction}
\unnumberedchaptermark{Another introduction}
\kant
\chapter{Title}
\kant
\chapter*{Summary}
\unnumberedchaptermark{Summary}
\kant
\nocite{*}
\bibliographystyle{plain}
\bibliography{test}
\end{document}