LaTeX Memoir 類別目錄,「頁面」位於第一個且僅第一個條目之前

LaTeX Memoir 類別目錄,「頁面」位於第一個且僅第一個條目之前

我正在使用 LaTeX 和回憶錄類來排版一本書。圖書出版商(劍橋)要求目錄的章節和標題位於左側,頁碼位於右側,第一個條目包含頁碼,前面帶有單字「page」。

我試過:

\renewcommand*{\cftchapterformatpnum}[1]{\emph{page} \cftchapterpagefont #1}

這允許我添加“頁面”,但它會將其添加到每個條目中。我試過:

\renewcommand*{\cftchapterformatpnum}[1] {\cftchapterpagefont #1}

在我的文件的其他地方將其設定回來,但顯然我根本不明白 LaTeX 的工作原理。似乎它只在以下命令之前尊重此命令:

\開始{文件}

LaTeX 專家可以告訴我實現目標的正確方法嗎?

答案1

這個怎麼樣(少一點拼字錯誤)?

\documentclass{memoir}
\newcommand*{\epage}{\emph{page }} % for convenience
\renewcommand*{\cftchapterformatpnum}[1]{\epage\cftchapterpagefont #1}
\begin{document}
\frontmatter
\tableofcontents* % don't add the ToC reference to the ToC
  %\addtocontents{toc}{\hfill \epage\par} % put page above page numbers
\mainmatter
\chapter{One}
\addtocontents{toc}%
  {\protect\renewcommand*{\protect\epage}{}% nullify printing page
}
\section{one}
\chapter{Two}
\section{one}
\end{document}

幹得好,你已經做到了這一點。訣竅是使用\addtocontents{<file>}{<text>}巨集將命令添加到目錄中適當的位置;請參閱第 9.1 節通用目錄方法手冊中 ( > texdoc memoir)。

相關內容