回憶錄中的章節在目錄中無法正確顯示

回憶錄中的章節在目錄中無法正確顯示

我在回憶錄類別中的自訂章節樣式遇到了一些問題。我想讓章節標題表現得像部分,即標題位於單獨的頁面上。

我可以這樣做:

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

相關內容