隐藏目录中的子部分,但使用 Beamer 保留 PDF 书签

隐藏目录中的子部分,但使用 Beamer 保留 PDF 书签

是的,我意识到了小节是邪恶的。然而,我使用它们的唯一原因是为了我自己,为了构建演示文稿,并能够在必要时有效地跳转。

我使用的 beamer 主题不会在每张幻灯片上显示当前部分,所以这没什么问题。向查看者显示部分的唯一位置是在目录中。我想隐藏目录中的子部分,但将它们保留为 PDF 书签。我可以使用选项将它们从目录中删除,但这也会将它们subsubsectionstyle=hide从 PDF 书签中删除。

同样,使用\subsubsection*{A subsubsection},子小节也不会添加到 PDF 书签中。

我可以手动\belowpdfbookmark{A subsubsection}添加书签,但这会带来大量重复工作,而且我的 LaTeX 编辑器仍然使用子部分来显示文档结构,因此我仍然需要子部分。

我也尝试过将bookmarksdepth=3选项传递给 hyperref,按照这个问题,但似乎没有任何效果。子小节仍然未添加到书签中。

有没有办法我可以简单地使用\subsubsection{A subsubsection}它们并将其隐藏在目录中?

这是一个 MWE,使用以下subsubsectionstyle=hide选项可以隐藏目录中的子部分:

\documentclass[]{beamer}

\title{Title}
\author{Author}

\AtBeginSection
{
    \begin{frame}
        \tableofcontents[currentsection,subsubsectionstyle=hide]
    \end{frame}
}

\begin{document}

\begin{frame}
    \titlepage
\end{frame}

\begin{frame}
    \tableofcontents[subsubsectionstyle=hide]
\end{frame}

\section{Introduction}
\section{Experiments}
\subsection{Small scale experiments}
\subsubsection{Experiment 1}
\subsubsection{Experiment 2}
\subsubsection{Experiment 3}
\subsection{Large scale experiments}
\subsubsection{Experiment 4}
\subsubsection{Experiment 5}
\subsubsection{Experiment 6}
\section{Problems}
\section{Further suggestions for improvements}
\section{Conclusion}

% Enforce entries in TOC
\begin{frame}
    \frametitle{Delete me}
\end{frame}

\end{document}

答案1

计数器值tocdepth还决定书签中出现的内容,而不仅仅是目录中出现的内容。由于subsubsections处于第 4 级,因此目录深度必须设置为 4。

\documentclass[]{beamer}

\hypersetup{bookmarksopen=true,bookmarksopenlevel=4}
\setcounter{tocdepth}{4}

\title{Title}
\author{Author}

\AtBeginSection
{
    \begin{frame}
        \tableofcontents[currentsection,subsubsectionstyle=hide]
    \end{frame}
}

\begin{document}

\begin{frame}
    \titlepage
\end{frame}

\begin{frame}
    \tableofcontents[subsubsectionstyle=hide]
\end{frame}

\section{Introduction}
\section{Experiments}
\subsection{Small scale experiments}
\subsubsection{Experiment 1}
\subsubsection{Experiment 2}
\subsubsection{Experiment 3}
\subsection{Large scale experiments}
\subsubsection{Experiment 4}
\subsubsection{Experiment 5}
\subsubsection{Experiment 6}
\section{Problems}
\section{Further suggestions for improvements}
\section{Conclusion}

% Enforce entries in TOC
\begin{frame}
    \frametitle{Delete me}
\end{frame}

\end{document}

在此处输入图片描述

相关内容