打開書籤但未開啟所有按鈕?

打開書籤但未開啟所有按鈕?

我只想打開樹的第一個按鈕

在此輸入影像描述

創建級別我用這個

\pdfbookmark[0]{Start}{start}

要關閉其他級別,我使用這個

\hypersetup{
  bookmarksopen=false
}

但我得到這個結果:

在此輸入影像描述

如何只開啟第一個按鈕?

\documentclass{book}
\usepackage[utf8]{inputenc}
\usepackage{imakeidx}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage[pdftex, bookmarksnumbered,  pagebackref, colorlinks=true, citecolor=Blue, linkcolor=DarkBlue!30!Black, urlcolor=Black,bookmarksopen]{hyperref}
\makeindex[columns=3, title=Alphabetical Index, intoc]

\begin{document}

\tableofcontents

\cleardoublepage
\pdfbookmark{Dedicatory}{dedic}
\chapter*{Dedicatory}

   to all my family

\cleardoublepage
\pdfbookmark{Abstract}{abstr}

\chapter*{Abstract}

   hello world


\chapter{chapter}
\section{Introduction}
In this example several keywords\index{keywords} will be
used which are important and deserve to appear in the
Index\index{Index}.
 \subsection{subsection}
Terms like generate\index{generate} and some\index{others}
will also show up. Terms in the index can also be
nested \index{Index!nested}

\clearpage

\section{Second section}
This second section\index{section} may include some special
word, and expand the ones already used\index{keywords!used}.

\printindex
\end{document}

答案1

據我了解您的要求是只打開第一級書籤。使用 MWE,您可以將其bookmarksopenlevel=0作為選項添加到hyperref. (如果您想要開啟更深的級別,可以將 0 變更為 1 或其他值。)

透過對當前 MWE 的修改:

\usepackage[pdftex, bookmarksnumbered,  pagebackref, colorlinks=true, citecolor=Blue, linkcolor=DarkBlue!30!Black, urlcolor=Black,bookmarksopen,bookmarksopenlevel=0]{hyperref}
%

我得到的顯示如下: 在此輸入影像描述

如果我將深度增加到 1,如下所示

\usepackage[pdftex, bookmarksnumbered,  pagebackref, colorlinks=true, citecolor=Blue, linkcolor=DarkBlue!30!Black, urlcolor=Black,bookmarksopen,bookmarksopenlevel=1]{hyperref}
%

然後我得到:

在此輸入影像描述

相關內容