TransWikia.com

Hyperlink each reference entry to its corresponding DOI with natbib

TeX - LaTeX Asked by Alfonso Diego Garza Isla on June 21, 2021

I am writting my Bachelor Thesis using Overleaf and I want to hyperlink each references to its corresponding DOI. I am using natibib package with the following commands.

documentclass[12pt]{report}

usepackage[sort&compress,numbers,square]{natbib}
bibliographystyle{achemso}

.
.
.

newpage
bibliography{2_references.bib}
addcontentsline{toc}{chapter}{References}

I’ve tried many things such as adding title = {href{https://doi.org/10.1515/ntrev-2015-0031}{Improving the tribological behavior of internal combustion engines via the addition of nanoparticles to engine oils}} at the .bib file. It does work and it links me to the corresponding DOI. I’ve tried also repeating this for all the required fields. However, when I place, for example: author = {href{https://doi.org/10.1515/ntrev-2015-0031}{Ali, Mohamed Kamal Ahmed and Xianjun, Hou}}, it is not displayed correctly in the pdf.

Is there a way that can automatically link all the reference entry to the DOI as it can be seen in many papers? Thank you.

This is how it looks using the title = {href{https://doi.org/10.1515/ntrev-2015-0031}{Improving the tribological behavior of internal combustion engines via the addition of nanoparticles to engine oils}} command. It works perfectly and links me to the DOI.

This is how it looks using href{}{} in each entry.

enter image description here

This is what I’m looking for. If you click any section of the reference it’ll guide you to it’s DOI.

One Answer

I found a solution but I needed to change to biblatex

usepackage{csquotes}
usepackage[backend=biber,sorting=none,style=numeric-comp,bibstyle=chem-acs,articletitle=true,biblabel=brackets,doi=false]{biblatex}
bibliography{2_references}
newbibmacro{string+doi}[1]{%
iffieldundef{url}{%
iffieldundef{doi}{#1}{href{http://dx.doi.org/thefield{doi}}{#1}}}
{href{thefield{url}}{#1}}}


DeclareNameWrapperFormat[article,thesis,incollection]{author}{usebibmacro{string+doi}{#1}}
DeclareFieldFormat[article,thesis,incollection]{title}{usebibmacro{string+doi}{#1}}
DeclareFieldFormat[article,thesis,incollection]{volume}{usebibmacro{string+doi}{textit{#1}}}
DeclareFieldFormat[article,thesis,incollection]{journaltitle}{usebibmacro{string+doi}{textit{ #1}}}
DeclareFieldFormat[article,thesis,incollection]{date}{usebibmacro{string+doi}{textbf{#1}}}
DeclareFieldFormat[article,thesis,incollection]{pages}{usebibmacro{string+doi}{#1}}

Correct answer by Alfonso Diego Garza Isla on June 21, 2021

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