我可以从文本生成到参考文献的引用链接,并且我也喜欢让参考文献中的内容也成为超链接,这是我的代码,引用自分享乳胶:
\documentclass[oneside,a4paper]{book}
\usepackage[english]{babel}
\usepackage{hyperref}
\hypersetup{
colorlinks = true,
linkcolor = blue,
citecolor = red
}
\begin{document}
Ths document is an example of BibTeX using in bibliography management. Three items
are cited: \textit{The \LaTeX\ Companion} book \cite{latexcompanion}, the Einstein
journal paper \cite{einstein}, and the Donald Knuth's website \cite{knuthwebsite}.
The \LaTeX\ related items are \cite{latexcompanion,knuthwebsite}.
\medskip
\bibliographystyle{unsrt}
\bibliography{test_bib}
\end{document}
在 test_bib.bib 中,我这样写:
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{\"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004"
}
@book{latexcompanion,
author = "Michel Goossens and Frank Mittelbach and Alexander Samarin",
title = "The \LaTeX\ Companion",
year = "1993",
publisher = "Addison-Wesley",
address = "Reading, Massachusetts"
}
@misc{knuthwebsite,
author = "Donald Knuth",
title = "\href{http://www-cs-faculty.stanford.edu/\~{}uno/abcde.htm}{Knuth: Computers and Typesetting}",
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}
但在参考文献本身中,没有超链接(我认为第三个应该是蓝色的):
我的代码有什么问题?如何实现?
答案1
我找到了一种实现该目标的方法,*.bib 的原始代码:
@misc{knuthwebsite,
author = "Donald Knuth",
title = "\href{http://www-cs-faculty.stanford.edu/\~{}uno/abcde.htm}{Knuth: Computers and Typesetting}",
url = "http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html"
}
改成
@misc{knuthwebsite,
author = "Donald Knuth",
title = "\href{http://www-cs-faculty.stanford.edu/\~{}uno/abcde.htm}{Knuth: Computers and Typesetting}",
url = {http://www-cs-faculty.stanford.edu/\~{}uno/abcde.html}
}
然后我可以点击参考链接直接进入该网站。