如何使用回憶錄在文件外部添加帶有頁碼的自訂目錄條目?

如何使用回憶錄在文件外部添加帶有頁碼的自訂目錄條目?

如何新增引用文件最後一頁之後的頁面的自訂目錄條目?列印它的公司要求將附錄作為單獨的 PDF,但我還是希望目錄能夠引用它們。我正在使用回憶錄和 lualatex。

我試過了:

  • 在呼叫之前操作頁面計數器addcontentsline-這會影響目前頁面的其他目錄項目。
  • 使用cftaddtitleline-- 這似乎只適用於數字列表和其他列表,而不適用於目錄?
  • 添加數十個空白頁面並在編譯後使用 pdfarranger 手動刪除它們——我寧願避免手動工作。

微量元素:

\documentclass{memoir}
\begin{document}
\tableofcontents*
\chapter{foo}
\section{bar}
\addcontentsline{toc}{section}{My external section} % I'd like this to be numbered at 5
\addcontentsline{toc}{section}{My second external section} % I'd like this to be numbered at 39
\end{document}

答案1

\documentclass{memoir}
\begin{document}
\tableofcontents*
\chapter{foo}
\section{bar}

\addtocontents{toc}{\protect\contentsline{section}{My external section}{5}{}}
\addtocontents{toc}{\protect\contentsline{section}{My external section}{39}{}}
                     
\end{document}

(如果您有外部目錄文件,您也可以將它們包含在目錄中)。

在此輸入影像描述

相關內容