Hyperref 不会为标题页或目录生成书签

Hyperref 不会为标题页或目录生成书签

如上所述,hyperref 不会在书签标题页或目录中生成。更具体地说,我有 8 个章节,超过 50 个部分,以及大量交叉引用。所有这些都完美无缺地生成。但是,当编译最终 PDF 时,书签从前言开始,而不是像我希望的那样从目录或标题页开始。

\documentclass[leqno, letterpaper, 10 pt]{book}

\usepackage{hyperref}
    \hypersetup{
        pdftitle={Fundamentos de C\'alculo},
        pdfsubject={C\'alculo diferencial},
        bookmarksnumbered=true,
        bookmarksopen=true,
        bookmarksopenlevel=1,
        colorlinks=true,
        citecolor=black,
        filecolor=black,
        linkcolor=black,
        urlcolor=black,
        pdfstartview=Fit,
        pdfpagemode=UseOutlines,
        pdfpagelayout=TwoPageRight
    }

\begin{document}

    \frontmatter

\begin{titlepage}
    \centering
    {\scshape \huge Fundamentos de c\'{a}lculo. \par}
    \vspace{1cm}
    {\scshape \large \textsc{Parte I. Preliminares del c\'{a}lculo.} \par}
    {\scshape Capítulos del 1 al 4. \par}
    {\scshape \large \textsc{Parte II. Desarrollo del c\'{a}lculo diferencial.} \par}
    {\scshape Capítulos del 5 al 8. \par}
    \vspace{2cm}
    \vfill
    {\large Mayo de 2018. \par}
    \rule{4cm}{0.4pt}
\end{titlepage}

\tableofcontents

\end{document}

答案1

我也建议使用包bookmarks。但您必须将超目标设置为书签链接的目标。对于目录,您必须确保目标位于其第一页。

\documentclass[leqno, letterpaper, 10pt]{book}
\usepackage{blindtext}% only for dummy text
\usepackage{bookmark}% loads hyperref too
    \hypersetup{
        pdftitle={Fundamentos de C\'alculo},
        pdfsubject={C\'alculo diferencial},
        bookmarksnumbered=true,
        bookmarksopen=true,
        bookmarksopenlevel=1,
        hidelinks,% remove border and color
        pdfstartview=Fit,
        pdfpagemode=UseOutlines,
        pdfpagelayout=TwoPageRight
    }

\begin{document}
\frontmatter
\begin{titlepage}
    \centering
    \hypertarget{titlepage}{}% set the hypertarget
    \bookmark[dest=titlepage,level=chapter]{Title Page}% add the bookmark
    {\scshape \huge Fundamentos de c\'{a}lculo. \par}
    \vspace{1cm}
    {\scshape \large \textsc{Parte I. Preliminares del c\'{a}lculo.} \par}
    {\scshape Capítulos del 1 al 4. \par}
    {\scshape \large \textsc{Parte II. Desarrollo del c\'{a}lculo diferencial.} \par}
    {\scshape Capítulos del 5 al 8. \par}
    \vspace{2cm}
    \vfill
    {\large Mayo de 2018. \par}
    \rule{4cm}{0.4pt}
\end{titlepage}

\cleardoublepage% ensure that the hypertarget is on the same page as the TOC heading
\hypertarget{toc}{}% set the hypertarget
\bookmark[dest=toc,level=chapter]{\contentsname}% add the bookmark
\tableofcontents

\chapter{Introduction}
\chapter{Bibliographic review}

\mainmatter
\Blinddocument\Blinddocument\Blinddocument
\Blinddocument\Blinddocument\Blinddocument
\end{document}

在此处输入图片描述

答案2

我建议你使用bookmark包裹,因为它确实增加了很多功能。

我的回答基于

标题页和目录书签

\documentclass[leqno, letterpaper, 10 pt]{book}
\usepackage[numbered]{bookmark}
\usepackage{hyperref}
    \hypersetup{
        pdftitle={Fundamentos de C\'alculo},
        pdfsubject={C\'alculo diferencial},
        bookmarksnumbered=true,
        bookmarksopen=true,
        bookmarksopenlevel=1,
        colorlinks=true,
        citecolor=black,
        filecolor=black,
        linkcolor=black,
        urlcolor=black,
        pdfstartview=Fit,
        pdfpagemode=UseOutlines,
        pdfpagelayout=TwoPageRight
    }

\begin{document}

    \frontmatter

\begin{titlepage}
    \centering
    {\scshape \huge Fundamentos de c\'{a}lculo. \par}
    \vspace{1cm}
    {\scshape \large \textsc{Parte I. Preliminares del c\'{a}lculo.} \par}
    {\scshape Capítulos del 1 al 4. \par}
    {\scshape \large \textsc{Parte II. Desarrollo del c\'{a}lculo diferencial.} \par}
    {\scshape Capítulos del 5 al 8. \par}
    \vspace{2cm}
    \vfill
    {\large Mayo de 2018. \par}
    \rule{4cm}{0.4pt}
\bookmark[dest=TitlePage]{Title Page}  
\end{titlepage}

\tableofcontents
\bookmark[dest=tocpage,level=-1]{Contents}

\chapter{Introduction}
\chapter{Bibliographic review}
\end{document}

相关内容