\subsubsection 书签级别与情况相关

\subsubsection 书签级别与情况相关

是否可以让\subsubsection用户在不同的级别添加书签?就我而言,有趣的功能在最低级别可见,但这些级别(绝对而言)不是同一级别

\documentclass{report}
\usepackage{hyperref}
\setcounter{tocdepth}{4}

\begin{document}

\chapter{Sample One}
\subsubsection{Characteristic One}
\subsubsection{Characteristic Two}
\subsubsection{Characteristic Three}
\subsubsection{Characteristic Four}

\chapter{Sample Two}
\section{Subsample One}
\subsubsection{Characteristic One}
\subsubsection{Characteristic Two}
\subsubsection{Characteristic Three}
\subsubsection{Characteristic Four}
\section{Subsample Two}
\subsubsection{Characteristic One}
\subsubsection{Characteristic Two}
\subsubsection{Characteristic Three}
\subsubsection{Characteristic Four}

\chapter{Sample Three}
\section{Subsample One}
\subsection{Subsubsample One}
\subsubsection{Characteristic One}
\subsubsection{Characteristic Two}
\subsubsection{Characteristic Three}
\subsubsection{Characteristic Four}
\subsection{Subsubsample Two}
\subsubsection{Characteristic One}
\subsubsection{Characteristic Two}
\subsubsection{Characteristic Three}
\subsubsection{Characteristic Four}

\end{document}

我之所以希望将所有内容都放在\subsections 中,是因为我想通过醒目的章节标题排版来强调相似之处,

\titleformat{\subsubsection}[<shape>]{<format>}{<label>}{<sep>}{<before-code>}[<after-code>]

但书签树看起来很不幸,在此处输入图片描述

我的想法是解决这个问题,\subsubsection使用\belowpdfbookmark{text}{name}而不是\pdfbookmark[level]{text}{name},但我该怎么做呢? 或者有更好的方法吗?

答案1

软件包hyperref要求存在中间部分级别。因此您会收到一些警告。

该软件包使用更强大的算法bookmark重新实现了hyperref的书签管理,因此可以处理缺少中间部分级别的情况:

\documentclass{report}
\usepackage{hyperref}
\setcounter{tocdepth}{4}

\usepackage{bookmark}
\bookmarksetup{
  open,
  numbered
}

\begin{document}

\chapter{Sample One}
\subsubsection{Characteristic One}
\subsubsection{Characteristic Two}
\subsubsection{Characteristic Three}
\subsubsection{Characteristic Four}

\chapter{Sample Two}
\section{Subsample One}
\subsubsection{Characteristic One}
\subsubsection{Characteristic Two}
\subsubsection{Characteristic Three}
\subsubsection{Characteristic Four}
\section{Subsample Two}
\subsubsection{Characteristic One}
\subsubsection{Characteristic Two}
\subsubsection{Characteristic Three}
\subsubsection{Characteristic Four}

\chapter{Sample Three}
\section{Subsample One}
\subsection{Subsubsample One}
\subsubsection{Characteristic One}
\subsubsection{Characteristic Two}
\subsubsection{Characteristic Three}
\subsubsection{Characteristic Four}
\subsection{Subsubsample Two}
\subsubsection{Characteristic One}
\subsubsection{Characteristic Two}
\subsubsection{Characteristic Three}
\subsubsection{Characteristic Four}

\end{document}

结果

相关内容