![回忆录中的章节在目录中无法正确显示](https://linux22.com/image/266193/%E5%9B%9E%E5%BF%86%E5%BD%95%E4%B8%AD%E7%9A%84%E7%AB%A0%E8%8A%82%E5%9C%A8%E7%9B%AE%E5%BD%95%E4%B8%AD%E6%97%A0%E6%B3%95%E6%AD%A3%E7%A1%AE%E6%98%BE%E7%A4%BA.png)
我在回忆录类中自定义章节样式时遇到了一点问题。我想让章节标题表现得像部分一样,即让标题放在单独的页面上。
我可以这样做:
\makechapterstyle{emmanuel}{%
\chapterstyle{ger}
\renewcommand{\afterchaptertitle}{\cleardoublepage}
}
问题是,在目录中,显示的章节页码是下一页的页码。我认为这是因为章节实际上从第 (n+2) 页之前开始,但我希望它从页面标题(即第 n 页)开始
我希望这足够清楚。
答案1
您可以重新定义内部\@chapter
命令以将命令包含\cleardoublepage
在适当的位置(如果您执行得太早,则会为目录选择错误的页码):
\documentclass{memoir}
\usepackage{hyperref}
\usepackage{lipsum}% just to generate text for the example
\makeatletter
\newcommand\chapterclear{
\gdef\@chapter[##1]##2{%
\m@mpn@new@chaptrue%
\m@mpn@new@schapfalse%
\def\f@rbdy{##2}%
\ifx\ch@pt@c\@empty % no optional args
\def\f@rtoc{##2}%
\def\f@rhdr{##2}%
\else % at least one opt arg
\let\f@rtoc\ch@pt@c
\ifx\@empty##1\@empty
\let\f@rhdr\ch@pt@c
\else
\def\f@rhdr{##1}%
\fi
\fi
\m@m@Andfalse
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\m@m@Andtrue
\fi
\fi
\ifm@m@And
\refstepcounter{chapter}%
\fi
\ifartopt
\@makechapterhead{##2}%
\@afterheading
\chaptermark{\f@rhdr}%
\else
\chaptermark{\f@rhdr}
\insertchapterspace
\if@twocolumn
\@topnewpage[\@makechapterhead{##2}]%
\else
\@makechapterhead{##2}%
\fi
\@afterheading
\fi
\ifm@m@And
\ifanappendix
\addcontentsline{toc}{appendix}{%
\protect\chapternumberline{\thechapter}\f@rtoc}%
\memappchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{##2}%
\else
\addcontentsline{toc}{chapter}{%
\protect\chapternumberline{\thechapter}\f@rtoc}%
\memchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{##2}%
\fi
\else
\addcontentsline{toc}{chapter}{\f@rtoc}%
\ifanappendix
\memappchapinfo{}{\f@rtoc}{\f@rhdr}{##2}%
\else
\memchapinfo{}{\f@rtoc}{\f@rhdr}{##2}%
\fi
\fi
\ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi
\cleardoublepage}%
}
\makeatother
\makechapterstyle{emmanuel}{
\chapterstyle{ger}
\chapterclear
}
\begin{document}
\tableofcontents
\chapterstyle{emmanuel}
\chapter{Test}
\lipsum[1-10]
\chapter{Test}
\lipsum[1-10]
\end{document}