将 \pdfbookmark 树子项拆分为独立的级别

将 \pdfbookmark 树子项拆分为独立的级别

我找不到一种简单的方法来拆分树形视图,将其拆分成独立的书签。我知道我可以手动\pdfbookmark[0]{section}{section}拆分每个书签,但有没有更巧妙的方法?

问题: 在此处输入图片描述

乳胶:

\documentclass[a4paper,svgnames,11pt]{article}
\usepackage{hyperref}
\usepackage[numbered]{bookmark}

% Do not change
\textheight = 220mm
\textwidth = 150mm
\topmargin = 10mm
\oddsidemargin = 5.0mm
\evensidemargin = 5.0mm
\unitlength = 1mm

\begin{document}
\thispagestyle{empty}
\phantomsection
%\hypertarget{cover}{}
\bookmark[page=\thepage,view={XYZ null \calc{\paperheight} null},level=0]{Cover}
\section*{Cover Page}

\cleardoublepage
\ifodd\value{page}\else\mbox{}\newpage\fi
\thispagestyle{empty}
{
\hypersetup{linkcolor=black}
\cleardoublepage
\phantomsection
\renewcommand{\contentsname}{Table of Contents}
\pdfbookmark[0]{\contentsname}{toc}
\tableofcontents
}

\cleardoublepage
\listoffigures
\listoftables

\cleardoublepage
\section{Section 1.1}
\subsection{Subsection 1.1.1}
\subsection{Subsection 1.1.2}

\cleardoublepage
\section{Section 1.2}
\subsection{Subsection 1.2.1}
\subsection{Subsection 1.2.2}

\cleardoublepage
\section{Section 2.1}
\subsection{Subsection 2.1.1}
\subsection{Subsection 2.1.2}

\cleardoublepage
\section{Section 2.2}
\subsection{Subsection 2.2.1}
\subsection{Subsection 2.2.2}

\end{document}

答案1

使用

\bookmarksetup{startatroot}在以下部分之前:

\documentclass[a4paper,svgnames,11pt]{article}
\usepackage{hyperref}
\usepackage[numbered]{bookmark}

% Do not change
\textheight = 220mm
\textwidth = 150mm
\topmargin = 10mm
\oddsidemargin = 5.0mm
\evensidemargin = 5.0mm
\unitlength = 1mm

\begin{document}
\thispagestyle{empty}
\phantomsection
%\hypertarget{cover}{}
\bookmark[page=\thepage,view={XYZ null \calc{\paperheight} null},level=0]{Cover}
\section*{Cover Page}

\cleardoublepage
\ifodd\value{page}\else\mbox{}\newpage\fi
\thispagestyle{empty}
{
\hypersetup{linkcolor=black}
\cleardoublepage
\phantomsection
\renewcommand{\contentsname}{Table of Contents}
\pdfbookmark[0]{\contentsname}{toc}
\tableofcontents
}

\cleardoublepage
\listoffigures
\listoftables

\bookmarksetup{startatroot}
\cleardoublepage
\section{Section 1.1}
\subsection{Subsection 1.1.1}
\subsection{Subsection 1.1.2}

\cleardoublepage
\section{Section 1.2}
\subsection{Subsection 1.2.1}
\subsection{Subsection 1.2.2}

\cleardoublepage
\section{Section 2.1}
\subsection{Subsection 2.1.1}
\subsection{Subsection 2.1.2}

\cleardoublepage
\section{Section 2.2}
\subsection{Subsection 2.2.1}
\subsection{Subsection 2.2.2}

\end{document}

在此处输入图片描述

相关内容