我正在使用 natbib 和 unsrtnat 样式通过 hyperref 包进行数字引用。
\documentclass{article}
\usepackage[square, super, sort]{natbib}
\usepackage[dvips,
bookmarks,
bookmarksopen = true,
bookmarksnumbered = true,
breaklinks = true,
linktocpage,
pagebackref,
colorlinks = true,
linkcolor = blue,
urlcolor = blue,
citecolor = red,
anchorcolor = green,
hyperindex = true,
hyperfigures]{hyperref}
\begin{document}
\bibliographystyle{unsrtnat}
some text...\citet{ref1}
other text
\end{document}
% some bibliography file
% test.bib
@Article {ref1, author = Author1, title = Title1, year = 2010}
\citet{ref1}
结果为 Author1 et al. [1],其中只有 [1] 超链接到参考文献。我希望引用 (Author1 et al.) 的名称部分也超链接。如何实现?
答案1
在数字引用标签下,使用 中定义的命令natbib
设置名称。您可以使用 patch用附加超链接标记名称列表。\NAT@test
natbib.sty
etoolbox
\NAT@test
\documentclass{article}
\usepackage[square,super,sort]{natbib}
\usepackage[colorlinks]{hyperref}
\usepackage{etoolbox}
\makeatletter
\patchcmd{\NAT@test}{\else \NAT@nm}{\else \NAT@hyper@{\NAT@nm}}{}{}
\makeatother
\begin{filecontents}{\jobname.bib}
@Book{companion,
author = {Goossens, Michel and Mittelbach, Frank and Samarin, Alexander},
title = {The LaTeX Companion},
edition = {1},
publisher = {Addison-Wesley},
location = {Reading, Mass.},
year = {1994}}
@Book{adams,
title = {The Restaurant at the End of the Universe},
author = {Douglas Adams},
series = {The Hitchhiker's Guide to the Galaxy},
publisher = {Pan Macmillan},
year = {1980}}
\end{filecontents}
\begin{document}
\citet{adams}, \citet{companion}, \citet{adams,companion}
\bibliographystyle{unsrtnat}
\bibliography{\jobname}
\end{document}