1

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.

7
  • 1
    Welcome to TeX.SE.
    – Mico
    May 9, 2020 at 17:02
  • 1
    Off-topic: it should be \bibliography{2_references}, not \bibliography{2_references.bib}.
    – Mico
    May 9, 2020 at 17:03
  • 1
    A general question: Why isn't it good enough to create a hyperlink between an entry's title field and some online depository of the publication? Put differently, what are you trying to achieve by mimicking the appearance of bibliographic entries that's practiced by some journals?
    – Mico
    May 9, 2020 at 17:04
  • 2
    @AlfonsoDiegoGarzaIsla - If each entry has a doi or url field, all you need to do, really, is load the hyperref package with suitably chosen options. You should be confident in your readers' ability to click on a doi field; nobody's going to complain to you that they weren't able to obtain a copy of some reference online because your publication failed to make the entire entry into a hyperlink.
    – Mico
    May 9, 2020 at 18:01
  • 1
    tex.stackexchange.com/q/3802/164050 and tex.stackexchange.com/q/3039/164050 may provide some good answers to that question.
    – mfg
    Oct 16, 2021 at 10:14

1 Answer 1

0

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

You must log in to answer this question.

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