更改附录的模板标题

更改附录的模板标题

我正在使用经过修改的BYU 论文模板作为我的论文。

我希望能够将附录的页眉更改为“附录 A 数据和显示”而不是“第 A 章数据和显示”,其中“数据和显示”是我的附录之一的名称。

以下是类文件中的相关代码:

% The fancyhdr package allows you to easily customize the page header.
% The settings below produce a nice, well separated header.
\usepackage{fancyhdr}
  \fancyhead{}
  \fancyhead[LO]{\slshape \rightmark}
  \fancyhead[RO,LE]{\textbf{\thepage}}
  \fancyhead[RE]{\slshape \leftmark}
  \fancyfoot{}
  \pagestyle{fancy}
  \renewcommand{\chaptermark}[1]{\markboth{\chaptername \ \thechapter \ \ #1}{}}
  \renewcommand{\sectionmark}[1]{\markright{\thesection \ \ #1}}

我想我应该使用 if 语句,但我的附录(在它们各自的 tex 文件中)以\chapter{Data \& Display}

答案1

线路

\renewcommand{\chaptermark}[1]{\markboth{\chaptername \ \thechapter \ \ #1}{}}

应该

\renewcommand{\chaptermark}[1]{\markboth{\@chapapp \ \thechapter \ \ #1}{}}

处理名称从“Cahpter”自动更改为“Appendix”的问题。修改文档前言中的页面样式:

\documentclass{BYUPhys}
\usepackage{lipsum}% just to generate text for the example

\makeatletter
\usepackage{fancyhdr}
  \fancyhead{}
  \fancyhead[LO]{\slshape \rightmark}
  \fancyhead[RO,LE]{\textbf{\thepage}}
  \fancyhead[RE]{\slshape \leftmark}
  \fancyfoot{}
  \pagestyle{fancy}
  \renewcommand{\chaptermark}[1]{\markboth{\@chapapp \ \thechapter \ \ #1}{}}
  \renewcommand{\sectionmark}[1]{\markright{\thesection \ \ #1}}
\makeatother

\begin{document}

\chapter{Regular Chapter}
\lipsum[1-40]
\appendix
\chapter{Appendix One}
\lipsum[1-40]

\end{document}

相关内容