更改手動新增的目錄條目的頁碼而不添加空白頁

更改手動新增的目錄條目的頁碼而不添加空白頁

我有一個主要的 LaTeX 文件和一個外部 PDF,我曾經將其包含在其中pdfpages(看起來很棒!)。但是,現在我想插入目錄條目來引用外部.pdf.我這樣做是這樣的:

\newcounter{page-backup}
\setcounter{page-backup}{\value{page}}
% begin to fake-numerate
\setcounter{page}{106}
% increment chapter counter and reset section and subsection
\addtocounter{chapter}{1}
\setcounter{section}{1}
\setcounter{subsection}{1}
% add chapter
\addcontentsline{toc}{chapter}{\numberline{\thechapter} CHAPTER}
% add section
\addcontentsline{toc}{section}{\numberline{\thesection} Section}
% add more...    
\setcounter{page}{125}
\addcontentsline{toc}{section}{\numberline{\thesection} Section}
% add some stuff
\addtocounter{tottables}{42}
\addtocounter{totfigures}{3}
% restore main page numeration
\setcounter{page}{\value{page-backup}}

但是,在目錄中,我得到了第 106 頁(假枚舉的第一頁)上的所有條目。如何手動變更插入的目錄條目的頁碼?據我所知,有一個,\addtocontents但它是非常手動的。我必須手動格式化每個條目......

答案1

這只是問題的部分答案

在類似的情況下,我使用以下內容將各個部分分開:

...
\tableofcontents
... initial part (with no tricks)

\addcontentsline{toc}{section}{...ext sec title 1}    
\includepdf[pages={1-20}]{external.pdf}
\addcontentsline{toc}{section}{...ext sec title 2}
\includepdf[pages={21-30}]{external.pdf}

... for all the external pdf units

...continuation (no tricks)

這樣 LaTeX 就可以完成工作(不需要假分頁)。

我喜歡對外部 pdf 進行未編號,並在 includepdf 指令中添加以下內容:

\includepdf[pages=...,pagecommand={\thispagestyle{fancy}}]{...}

(需要進行調整)以便將頁碼新增至外部 pdf 。

(建議:寫一個新指令\externalPDFunit{type}{pages}{title}{file}

相關內容