
我想使用 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
、書籤放置位置,以使目標更接近標題。在 class 中article
, title 參數以垂直模式開始,因此書籤可以放置在這裡:
\title{%
\pdfbookmark[1]{My Title}{title}%
My Title%
}
...
\maketitle
答案2
這bookmark
只是問題的一部分......
\pdfbookmark
例如,可以使用 來加書籤。
應給出相關的級別,這裡以article
班級級別0
為宜,如果標題書籤需要與其餘部分對齊,1
則使用級別。在這裡我已經完成了解決方案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}