2

I can generate a cite link from text to reference, and I also like to make the content in the reference become a hyper link as well, here is my code, refered from sharelatex:

\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}

in the test_bib.bib, I write like:

@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"
}

hyper link in content has no problem: enter image description here

but in reference itself, no hyper link (I should be blue in 3rd one I think): enter image description here

What is my code problem? how to achieve this?

2
  • 1
    I guess that you are looking for the backref=page option of the hyperref package.
    – Fran
    Commented Jan 14, 2018 at 11:10
  • 1
    @Fran i need in the reference page, link the document to a web site, which can directly open the referenced doc
    – How Chen
    Commented Jan 14, 2018 at 12:04

1 Answer 1

2

I found one way to achcieve that, original code for *.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"
}

change to

@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}
}

enter image description here

Then I can click the link the reference and go to the website directly.

2
  • It does not work for me! I want to do this: stackoverflow.com/questions/62870417/…
    – RFAI
    Commented Jul 13, 2020 at 9:56
  • Would've been useful to highlight that the only difference is the "" changed to {}. Took me a while to spot it lol. And it does not work for me by the way..
    – Luismi98
    Commented Feb 22, 2022 at 20:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .