我想要使用 Memoir documentclass 编写的文档的标题和页脚采用特定的布局。问题是,除目录外,整个文档都遵循定义的标题和页脚。
下图显示了文档正文偶数页和奇数页所需的标题。
该图显示目录的当前标题,与所需的布局不一致。
MWE代码如下:
\documentclass[letterpaper,12pt,openany,final]{memoir}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[top=4cm,right=2.5cm,left=4cm, bottom=2.5cm]{geometry}
\usepackage{setspace}
\DisemulatePackage{setspace}
\linespread{1.1}
\usepackage[sc]{mathpazo} %Fuente
\renewcommand\familydefault{\rmdefault}
\usepackage[protrusion=true,expansion=true]{microtype} %Alineado óptico
\usepackage[activeacute,spanish] {babel}
\setlength{\footmarksep}{-1.8em}
\setlength{\footmarkwidth}{1.8em}
\setlength{\footmarksep}{0em}
%%=================%%
%%Header and footer%%
%%=================%%
\makepagestyle{TOC}
\makepsmarks{TOC}{%
\createmark{chapter}{left}{nonumber}{}{}
\createmark{section}{right}{nonumber}{}{}
}
\makeevenhead{TOC}{}{}{\bfseries \leftmark}
\makeoddhead{TOC}{}{}{\bfseries \rightmark}
\makeevenfoot{TOC}{}{\thepage}{}
\makeoddfoot{TOC}{}{\thepage}{}
\makefootrule{TOC}{\textwidth}{0.5pt}{0pt}
\makeheadrule{TOC}{\textwidth}{0.5pt}
%%=================%%
%%=================%%
\begin{document}
\setlength{\evensidemargin}{\oddsidemargin}
\setlength{\footskip}{30pt}
\tableofcontents{\pagestyle{TOC}}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\section{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\section{Lorem Ipsum}
\chapter{Lorem Ipsum}
\subsection{Lorem Ipsum}
\subsection{Lorem Ipsum}
\section{Lorem Ipsum}
\end{document}
有没有办法让目录遵循标题定义?
提前致谢。
答案1
MWE 使测试解决方案变得简单(这总是件好事)。如果你将以下行更改为
\tableofcontents{\pagestyle{TOC}}
进入
\pagestyle{TOC}
\tableofcontents
输出应该符合预期。请注意,在memoir
类中有两个\tableofcontents
命令:
\tableofcontents % <-- adds its respective title to the Table of Contents
\tableofcontents* % <-- does not do so; this mimics the behaviour of the standard classes
\listoffigures
对于( *
) 和\listoftables
( ) 命令同样适用*
。