我想使用 hyperref 包将 PDF 标题添加到 PDF 书签。但是它不起作用。
如图所示,我想在简介上方添加一个标题。
而且,我想把“公式(1)”作为一个整体来做成一个链接,而不只是红色的1,如上图所示。
我该如何实现这些?非常感谢。
这是我的 MWE:
\documentclass[a4paper, 10pt]{article}
\usepackage{amsmath}
\usepackage[backend=biber, style=numeric]{biblatex}
\usepackage[bookmarksnumbered, pdftitle={A PDF Title?}]{hyperref}
\hypersetup{colorlinks=true, citecolor=cyan}
\begin{filecontents*}{\jobname.bib}
@article{Azeez2013,
author = {Azeez, O. S. and Isafiade, A. J. and Fraser, D. M.},
title = {Supply-based superstructure synthesis of heat and mass exchange networks},
journal = {Computers \& Chemical Engineering},
volume = {56},
number = {7},
pages = {184--201},
year = {2013}
}\end{filecontents*}
\addbibresource{\jobname}
\title{A PDF title?}
\begin{document}
\maketitle
\section{Introduction}
This is an example for illustrating the use Hyperref package~\cite{Azeez2013}.
\section{Problem Statement}
What is wrong?
\begin{equation}
\label{eq: mass balance}
\sum_{i} m_{in} = \sum_{j} m_{out}
\end{equation}
This equation~\eqref{eq: mass balance} shows the mass balance of the model.
\section*{Acknowledgements}
\addcontentsline{toc}{section}{Acknowledgements}%
Who would you like to thank?
\addcontentsline{toc}{section}{References}
\printbibliography
\end{document}
答案1
附加书签可以通过以下方式完成\pdfbookmark
:
\pdfbookmark[1]{My Title}{title}
包含“方程式”的链接更加棘手,因为\autoref
没有将数字放在括号中。手动操作如下:
\hyperref[eq: mass balance]{equation~(\ref*{eq: mass balance})}
的星号形式\ref
设置了没有链接的引用,因为 已经设置了链接\hyperref
。
完整示例:
\documentclass[a4paper, 10pt]{article}
\usepackage{amsmath}
\usepackage[bookmarksnumbered, pdftitle={A PDF Title?}]{hyperref}
\hypersetup{colorlinks=true, citecolor=cyan}
\usepackage{bookmark}% faster updated boomkarks
\newcommand*{\myeqref}[2][equation]{%
\hyperref[{#2}]{#1~(\ref*{#2})}%
}
\begin{document}
\pdfbookmark[1]{My Title}{title}% "1" = section level
\section{Introduction}
This is an example for illustrating the use Hyperref package.
\section{Problem Statement}
What is wrong?
\begin{equation}
\label{eq: mass balance}
\sum_{i} m_{in} = \sum_{j} m_{out}
\end{equation}
This \myeqref{eq: mass balance} shows the mass balance of the model.
\section*{Acknowledgements}
\addcontentsline{toc}{section}{Acknowledgements}%
Who would you like to thank?
\end{document}
书签:
将标题的目标移得更接近标题:
书签命令需要夹带在 内部\maketitle
。它取决于使用的类、包、 的定义\maketitle
、放置书签的位置,以使目标更接近标题。在 类中article
,标题参数以垂直模式开始,因此书签可以放在这里:
\title{%
\pdfbookmark[1]{My Title}{title}%
My Title%
}
...
\maketitle
答案2
这bookmark
只是问题的一部分...
\pdfbookmark
例如,可以使用 添加书签。
应该给出相应的级别,这里用article
class 级别0
比较合适,如果标题书签要与其他书签对齐,1
则使用级别。这里我用 however 完成了解决方案0
。
\pdfbookmark[0]{bookmarkentry}{label}
标签是一些链接标记,\title{}
例如给出的。
\documentclass[a4paper, 10pt]{article}
\usepackage{amsmath}
\usepackage[backend=biber, style=numeric]{biblatex}
\newcommand{\mydocumenttitle}{A PDF title}
\usepackage[bookmarksopen=true,bookmarksnumbered, pdftitle={\mydocumenttitle}]{hyperref}
\hypersetup{colorlinks=true, citecolor=cyan}
\begin{filecontents*}{\jobname.bib}
@article{Azeez2013,
author = {Azeez, O. S. and Isafiade, A. J. and Fraser, D. M.},
title = {Supply-based superstructure synthesis of heat and mass exchange networks},
journal = {Computers \& Chemical Engineering},
volume = {56},
number = {7},
pages = {184--201},
year = {2013}
}
\end{filecontents*}
\addbibresource{\jobname}
\author{A. U. Thor}
\title{\hypertarget{title:link}{\mydocumenttitle}}
\begin{document}
\maketitle
\pdfbookmark[0]{A PDF title}{title:link}
\clearpage
\section{Introduction}
This is an example for illustrating the use Hyperref package~\cite{Azeez2013}.
\section{Problem Statement}
What is wrong?
\begin{equation}
\sum_{i} m_{in} = \sum_{j} m_{out}\label{eq: mass balance}
\end{equation}
This equation~\eqref{eq: mass balance} shows the mass balance of the model.
\section*{Acknowledgements}
\addcontentsline{toc}{section}{Acknowledgements}%
Who would you like to thank?
\addcontentsline{toc}{section}{References}
\printbibliography
\end{document}