我想知道我们如何在目录、图表列表和术语表上添加页眉和页脚?我们需要更新任何命令吗?或者任何包都可以做到这一点?示例脚本会很有帮助。我还想摆脱术语表页面上的页数。相反,我想从简介页面开始。我还想知道我们是否可以将页眉和页脚放在章节的第一页上?
示例脚本为:
\documentclass{report}
\usepackage{titling}
\usepackage{fancyhdr}
\usepackage{lipsum} % for dummy text only
% Nomenclature
\usepackage{nomencl}
\makeglossary
\makeatletter
\newcommand\ackname{Acknowledgements}
\newenvironment{acknowledgements}{%
\begin{center}%
\bfseries \ackname
\@endparpenalty\@M
\end{center}}%
{\par}
\newcommand\abname{Abstract}
\newenvironment{abstracts}{%
\begin{center}%
\bfseries \abname
\@endparpenalty\@M
\end{center}}%
{\par}
% These commands follow the titling package format for titles
% They define user commands to format the subtitle
\newcommand\presubtitle[1]{\gdef\@presubtitle{#1}}
\newcommand\postsubtitle[1]{\gdef\@postsubtitle{#1}}
% This command takes the subtitle as its argument, and uses the titling command
% \maketitlehookb plus the previously defined formatting commands to insert
% the subtitle into the titlepage. It also generates \thesubtitle for subsequent use
\newcommand\subtitle[1]{%
\renewcommand{\maketitlehookb}{\@presubtitle#1\@postsubtitle}
\newcommand\thesubtitle{#1}}
\makeatother
% Now we define the formatting for the subtitle
\presubtitle{\begin{center}\Large} % change this as needed
\postsubtitle{\end{center}}
% Now enter the regular title information, with the new \subtitle command
\title{My Thesis Title}
\author{A.M. Author}
\subtitle{My subtitle}
\lhead{\begin{tabular}{@{}l}\thetitle\ -- \thesubtitle\\\theauthor\end{tabular}}
\chead{}
\rhead{\begin{tabular}{r@{}}\leftmark\\\today\end{tabular}}
\lfoot{}
\cfoot{\thepage}
\rfoot{}
% Set the width of the header rule. Make 0pt to remove the rule.
\renewcommand{\headrulewidth}{.5pt}
\renewcommand{\footrulewidth}{0.1pt}
% Make the head height match the size of the header
\setlength{\headheight}{24pt}
\pagestyle{fancy}
% Remove "Chapter" from the marks
\renewcommand{\chaptermark}[1]{%
\markboth{\thechapter.\ #1}{}}
% These commands set up the headers. They are set up for even and odd pages the same
% Check the fancyhdr documentation for information on how to set them differently
% for odd and even pages
\begin{document}
\lipsum[1]
\pagenumbering{roman}
\lipsum[1]
\tableofcontents
\listoffigures
\printnomenclature
%% Print the nomenclature
\addcontentsline{toc}{chapter}{Terminology/Notation}
\setcounter{page}{1}
\pagenumbering{arabic}
\lipsum[1]
\appendix
\lipsum[1]
\bibliographystyle{plainnat}
\renewcommand{\bibname}{References} % changes default name Bibliography to References
\end{document}
答案1
\thispagestyle{fancy}
向每个缺少页面样式的页面添加:
\tableofcontents\thispagestyle{fancy}
\listoffigures\thispagestyle{fancy}
\printnomenclature\thispagestyle{fancy}
\thispagestyle
仅影响当前页面的页面样式,而不像\pagestyle
,它为文档的其余部分设置页面样式(除非再次更改)。我假设\pagestyle
不适用于文档中的这些页面,因为每个命令都会触发\thispagestyle{plain}
(即仅页码),这会推翻标准页面样式。我建议的调整\thispagestyle{plain}
再次推翻了这一点并产生了所需的结果。
如果您根本不想要任何页眉和页脚,请使用页面样式empty
,即\thispagestyle{empty}
在您的命名法页面上。