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.

  • 1
    Welcome to TeX.SE. – Mico May 09 '20 at 17:02
  • 1
    Off-topic: it should be \bibliography{2_references}, not \bibliography{2_references.bib}. – Mico May 09 '20 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 09 '20 at 17:04
  • Thanks I'll change to \bibliography{2_references}. It is good enough, the thing is I'll be managing above 50 references, therefore I was looking for an automatized solution, and I don't want to add manually each DOI, but to read it directly from the doi = {} or url = {} field. – Alfonso Diego Garza Isla May 09 '20 at 17:47
  • with biblatex/biber this sort of linking is rather easily implemented. With natbib and some older bibliography style this is often either rather hard or not possible. – Ulrike Fischer May 09 '20 at 17:53
  • 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 09 '20 at 18:01
  • 1
    https://tex.stackexchange.com/q/3802/164050 and https://tex.stackexchange.com/q/3039/164050 may provide some good answers to that question. – mfg Oct 16 '21 at 10:14

1 Answers1

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}}
  • @Mario correctly commented that in https://tex.stackexchange.com/q/3802/164050 they provide good answers. And indeed https://tex.stackexchange.com/a/3803/192743 helps. In my case I just needed to do \uspackage{doi}. – Paloha Apr 13 '23 at 12:04