回忆录中的章节在目录中无法正确显示

回忆录中的章节在目录中无法正确显示

我在回忆录类中自定义章节样式时遇到了一点问题。我想让章节标题表现得像部分一样,即让标题放在单独的页面上。

我可以这样做:

\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}

相关内容