我已经设置了 PDF,以便生成目录和 PDF 书签。
但是,我想从目录中删除“前言”部分(但不删除此部分下的章节),同时仍在 PDF 书签中生成“前言”部分。我该怎么做?
PDF 的屏幕截图也许可以最好地解释这一点:
代码:
\documentclass{article}
\usepackage{tocloft}
\usepackage{bookmark}
\usepackage{refcount}
\bookmarksetup{numbered}
\begin{document}
\phantomsection \addcontentsline{toc}{part}{Front Matter}
\phantomsection \addcontentsline{toc}{section}{Cover}
Cover Art inserted here.
\phantomsection \addcontentsline{toc}{section}{Contents} \tableofcontents
\textbf{\LARGE{}About This Book}
\phantomsection \addcontentsline{toc}{section}{About This Book}
\part{The First Part}
\section{The First Chapter}
\end{document}
答案1
您可以使用\bookmark[level=part,dest=frontmatter]{Front Matter}
:
\documentclass{article}
\usepackage{tocloft}
\usepackage{bookmark}
\usepackage{refcount}
\bookmarksetup{numbered}
\begin{document}
\bookmark[level=part,dest=frontmatter]{Front Matter}
\phantomsection \addcontentsline{toc}{section}{Cover}
Cover Art inserted here.
\clearpage
\phantomsection \addcontentsline{toc}{section}{Contents}
\tableofcontents
\setcounter{secnumdepth}{-2}
\section{About This Book}
\setcounter{secnumdepth}{3}
\part{The First Part}
\section{The First Chapter}
\end{document}