TransWikia.com

How to add URI to a .bib file with a hyperlink?

TeX - LaTeX Asked by NM_ on November 27, 2020

How to add a URI to a bib file with a hyperlink so that anyone who clicks on it will be directed to the page displaying the thesis.

There does not appear to be a uri tag in the bibliography, so I tried making a custom field by adding the following to the preamble

newcommand{uri}[1]{href{http://hdl.handle.net/#1}{URI: #1}}

but unfortunately it doesn’t do anything.

These are the relevant packages in my preamble

usepackage[square,sort,comma,numbers]{natbib}

Here is the code I’m using to add my bibliography in the document

bibliographystyle{plainnat}
bibliography{References/references.bib}
addcontentsline{toc}{chapter}{Bibliography}

One Answer

If you use natbib with plainnat you can use

documentclass[12pt]{article}
    usepackage[a4paper]{geometry}
    usepackage{natbib,hyperref}
begin{document}
begin{filecontents*}{jobname.bib}
@ARTICLE{Important,
  author       = "Doe, J.",
  title        = "Gnus and Gnats",
  journal      = "Gnus of the world",
  year         = "2020",
  volume       = "2456",
  number       = "1",
  pages        = "123--2567",
  url         = "https://tex.stackexchange.com",
}
end{filecontents*}
citet{Important}
bibliographystyle{plainnat}
bibliography{jobname}
end{document} 

Correct answer by Denis on November 27, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP