在 TOC 中间更改 TOC 标题

在 TOC 中间更改 TOC 标题

在我的目录中,在列出章节标题的页面上,页眉需要包含单词“CHAPTER”。但是,在仅列出附录标题的页面上,目录页眉需要显示“APPENDIX”。是否可以像这样在目录中途更改页眉?我正在使用回忆录类。

更新:我应该提到我正在使用学校提供的样式包。我将给出基于该样式文件的 MWE,并给出样式文件中看似相关的段落。首先是 MWE:

\documentclass[oneside,12pt]{memoir}
\setsecnumdepth{subsection}
\maxtocdepth{subsection}
\usepackage{appendix}
\usepackage{pwasu} 

\begin{document}
\DoubleSpacing
\pagestyle{plain}
\frontmatter

\tableofcontents
\listoftables
\listoffigures

\mainmatter

\pagestyle{plain} 

\addtocontents{toc}{\noindent\normalfont{CHAPTER}\par}
\chapter{Chapter the Next} 
\chapter{Chapter the Next} 
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\chapter{Chapter the Next} 
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\chapter{Chapter the Next} 
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\chapter{Chapter the Next} 
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}

\addtocontents{toc}{\noindent\normalfont{APPENDIX}\par}
\appendix
\chapter{Now I have an appendix} 
\chapter{Now I have an appendix} 
\section{Appdx. section }
\section{Appdx. section }
\section{Appdx. section }
\chapter{Now I have an appendix} 
\section{Appdx. section }
\section{Appdx. section }
\section{Appdx. section }
\chapter{Now I have an appendix} 
\section{Appdx. section }
\section{Appdx. section }
\section{Appdx. section }
\chapter{Now I have an appendix} 
\section{Appdx. section }
\section{Appdx. section }
\section{Appdx. section }
\end{document}

以下是样式文件中需要有所不同的部分,对于仅包含附录标题的目录页:

\makepagestyle{toc}
\makeevenfoot{toc}{}{\thepage}{}
\makeoddfoot{toc}{}{\thepage}{}
\makeevenhead{toc}{CHAPTER}{}{Page}
\makeoddhead{toc}{CHAPTER}{}{Page}

因此,当创建此文档时,有问题的区域是目录最后一页的页眉,其应为附录而不是章节(我不知道为什么该页眉与此 MWE 中的目录顶行重叠,但这在我的实际文档中不会发生,所以这可能并不重要)。

答案1

您可以使用 在目录中添加标题开关\addtocontents。例如,如果我们定义标题类型toc并将其应用于目录中,那么您也可以在目录中部分注入\makeevenhead和:\makeoddhead

\documentclass[oneside,12pt]{memoir}
\setsecnumdepth{subsection}
\maxtocdepth{subsection}
\usepackage{appendix}
\makepagestyle{toc}
\makeevenfoot{toc}{}{\thepage}{}
\makeoddfoot{toc}{}{\thepage}{}
\makeevenhead{toc}{CHAPTER}{}{Page}
\makeoddhead{toc}{CHAPTER}{}{Page}

\begin{document}
\DoubleSpacing
\frontmatter
\pagestyle{toc}
\tableofcontents
\listoftables
\listoffigures

\mainmatter

\pagestyle{plain} 

\addtocontents{toc}{\noindent\normalfont{CHAPTER}\par}
\chapter{Chapter the Next} 
\chapter{Chapter the Next} 
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\chapter{Chapter the Next} 
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\chapter{Chapter the Next} 
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\chapter{Chapter the Next} 
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}
\section{My Next Section}
\subsection{And another subsection}
\subsection{And another subsection}
\subsection{And another subsection}

\appendix
\addtocontents{toc}{\noindent\normalfont{APPENDIX}\par}
% Lines added here
\addtocontents{toc}{%
  \protect\makeevenhead{toc}{APPENDIX}{}{Page}
  \protect\makeoddhead{toc}{APPENDIX}{}{Page}%
}
\chapter{Now I have an appendix} 
\chapter{Now I have an appendix} 
\section{Appdx. section }
\section{Appdx. section }
\section{Appdx. section }
\chapter{Now I have an appendix} 
\section{Appdx. section }
\section{Appdx. section }
\section{Appdx. section }
\chapter{Now I have an appendix} 
\section{Appdx. section }
\section{Appdx. section }
\section{Appdx. section }
\chapter{Now I have an appendix} 
\section{Appdx. section }
\section{Appdx. section }
\section{Appdx. section }
\end{document}

唯一的问题是它将从包含任何附录项目的第一个目录页开始应用。但是,问题并没有详细说明这种情况应该发生什么,所以我认为这是一个“后续”问题!

相关内容