1

I intend to submit a manuscript to the Journal of Computational Physics by Elsevier. Although no bibliography formatting requirements have been explicitly specified by the publisher for the initial submission, I am interested in replicating the actual bibliography style of the final PDF of published articles in that journal.

The requirement is that each bibliography item (i.e. the whole line entry) becomes a clickable hyperlink (using the doi field if available, else using the url field of the relevant key in the bib file).

Since I am using elsarticle.cls, I am unable to use biblatex. Hence a natbib/bibtex based solution is required.

Here is a MWE to start with:

\documentclass[number]{elsarticle}
\begin{document}

\begin{frontmatter}

    \title{Dummy document \tnoteref{t1,t2}}

    \tnotetext[t1]{Title footnote 1}
    \tnotetext[t2]{Title footnote 2}
    \author[a]{First Author\fnref{fn1}}
    \ead{firstemail_id@insti_1.edu}
    \author[b]{Second Author\fnref{fn2}}
    \ead{secondemail_id@insti_2.edu}
    \address[a]{Address of author with affiliation `a'}
    \address[b]{Address of author with affiliation `b'}
    \fntext[fn1]{This is a footnote.}
    \fntext[fn2]{Another author footnote}

    \begin{abstract}
        Dummy abstract.
    \end{abstract}

    % Research highlights
    \begin{highlights}
    \item Research highlight 1
    \item Research highlight 2
    \end{highlights}

    \begin{keyword}
        Some \sep keywords
    \end{keyword}

\end{frontmatter}

\section{Introduction}{\label{sec:intro}}
Intro

\section{Next}{\label{sec:blah}}
More blah

\nocite{*}   % Temporary placeholder. Comment out after bib file is populated and \cite commands issued
\bibliographystyle{elsarticle-num} 
\bibliography{manuscript_references.bib}

\end{document}
  • This appears to be possible with some effort (it would most definitely involve modifying the .bst file), but I have my doubts that this would be beneficial for the submission process. If Elsevier wanted a particular format, surely their document class should implement it. Depending on their workflow it may actually be counterproductive to introduce the (unquestionably) required additional markup commands for the links as they may throw off tools that parse the TeX source. It doesn't strike me as a great idea to introduce a large machinery of code into official journal templates. – moewe Mar 26 at 11:16
  • Hopefully available on an Open Archive... – pluton Mar 27 at 4:12
2

As I wrote in my comment under the question I don't necessarily think this is the best idea for submission to Elsevier journals, but it can be done if you modify the .bst file a bit.

I'm sure there are other ways to achieve this, but here is what I did.

elsarticle-num-names.bst already has a way to typeset some parts of the reference as a link to the URL (the titles of @misc entries with a url field are already linked to the URL directly), so we can use this machinery and extend it to extend the link area to the complete article and to consider DOIs as well.

The extensions for DOIs is more or less straightforward. Extending the link area required some shuffling around of macros and functions.

The diff to elsarticle-num-names.bst (v2.1 [2019-04-15], the current version on CTAN) is

--- elsarticle-num.bst  2019-04-05 15:29:24.000000000 +0200
+++ link-elsarticle-num.bst 2020-03-26 21:55:15.423852900 +0100
@@ -114,32 +114,51 @@
 }

 FUNCTION {setup.inlinelink}
-{ makeinlinelink
-    { hrefform #1 = % hypertex
-        { "\special {html:<a href=" quote$ * url * quote$ * "> }{" * 'openinlinelink :=
+{
+  doi empty$
+    {
+      url empty$
+        { "" }
+        { url }
+      if$
+    }
+    { doiurl doi * }
+  if$
+  duplicate$ empty$
+    'pop$
+    { 
+      hrefform #1 = % hypertex
+        { "\special {html:<a href=" quote$ * swap$ * quote$ * "> }" * 'openinlinelink :=
           "\special {html:</a>}" 'closeinlinelink :=
           }
         { hrefform #2 = % hyperref
-            { "\href{" url * "}{" * 'openinlinelink :=
+            { "\href{" swap$ * "}{" * 'openinlinelink :=
               "}" 'closeinlinelink :=
               }
-            'skip$
+            'pop$
           if$ % hrefform #2 =
         }
       if$ % hrefform #1 =
       #0 'makeinlinelink :=
     }
-    'skip$
- if$ % makeinlinelink
+  if$
 }
-FUNCTION {add.inlinelink}
+FUNCTION {add.openinlinelink}
 { openinlinelink empty$
     'skip$
-    { openinlinelink swap$ * closeinlinelink *
+    { openinlinelink write$
       "" 'openinlinelink :=
       }
   if$
 }
+FUNCTION {add.closeinlinelink}
+{ closeinlinelink empty$
+    'skip$
+    { closeinlinelink write$
+      "" 'closeinlinelink :=
+      }
+  if$
+}
 FUNCTION {output.nonnull}
 { % Save the thing we've been asked to output
   's :=
@@ -157,7 +176,6 @@
       % Write out what's currently at the top of the stack, using the
       % original output.nonnull function.
       s
-      add.inlinelink
       output.nonnull.original % invoke the original output.nonnull
     }
     { % Still in brackets.  Add open-bracket or (continuation) comma, add the
@@ -203,12 +221,6 @@
   if$
 }

-FUNCTION {fin.entry.original}
-{ add.period$
-  write$
-  newline$
-}
-
 FUNCTION {new.block}
 { output.state before.all =
     'skip$
@@ -472,7 +484,7 @@
 FUNCTION {write.url}
 { url empty$
     { skip$ }
-    { "\newline\urlprefix\url{" url * "}" * write$ newline$ }
+    { "\newline\urlprefix\nolinkurl{" url * "}" * write$ newline$ }
   if$
 }

@@ -1032,13 +1044,11 @@
 }
 FUNCTION {make.href.hypertex}
 {
-  "\special {html:<a href=" quote$ *
-  swap$ * quote$ * "> }" * swap$ *
-  "\special {html:</a>}" *
+  pop$
 }
 FUNCTION {make.href.hyperref}
 {
-  "\href {" swap$ * "} {\path{" * swap$ * "}}" *
+  pop$ "\path{" swap$ * "}" *
 }
 FUNCTION {make.href}
 { hrefform #2 =
@@ -1054,12 +1064,7 @@
 FUNCTION {format.url}
 { inlinelinks #1 = url empty$ or
    { "" }
-   { hrefform #1 =
-       { % special case -- add HyperTeX specials
-         urlintro "\url{" url * "}" * url make.href.hypertex * }
-       { urlintro "\url{" * url * "}" * }
-     if$
-   }
+   {  urlintro "\nolinkurl{" * url * "}" * }
   if$
 }

@@ -1104,14 +1109,13 @@
 FUNCTION {output.bibitem}
 { outside.brackets 'bracket.state :=
   output.bibitem.original
-  inlinelinks url empty$ not and
-    { #1 'makeinlinelink := }
-    { #0 'makeinlinelink := }
-  if$
+  setup.inlinelink
+  add.openinlinelink
 }

 FUNCTION {fin.entry}
-{ output.web.refs  % urlbst
+{ 
+  output.web.refs  % urlbst
   makeinlinelink       % ooops, it appears we didn't have a title for inlinelink
     { setup.inlinelink % add some artificial link text here, as a fallback
       "[link]" output.nonnull }
@@ -1121,7 +1125,14 @@
     { "]" * }
     'skip$
   if$
-  fin.entry.original
+  add.period$
+  write$
+  type$ "webpage" =
+    'skip$
+    'write.url
+  if$
+  add.closeinlinelink
+  newline$
 }

 FUNCTION {webpage}
@@ -1139,7 +1150,6 @@
     }
   if$
   new.block
-  title empty$ 'skip$ 'setup.inlinelink if$
   format.title "title" output.check
   inbrackets "online" output
   new.block
@@ -1159,7 +1169,6 @@
 FUNCTION {article}
 { output.bibitem
   format.authors "author" output.check
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.title "title" output.check
   crossref missing$
     { journal
@@ -1179,7 +1188,6 @@
     'skip$ 
   if$
   fin.entry
-  write.url
 }

 FUNCTION {book}
@@ -1194,7 +1202,6 @@
       if$
     }
   if$
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.btitle "title" output.check
   crossref missing$
     { format.edition output
@@ -1208,20 +1215,17 @@
   if$
   format.note output
   fin.entry
-  write.url
 }

 FUNCTION {booklet}
 { output.bibitem
   format.authors output
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.title "title" output.check
   howpublished output
   address output
   format.note output
   format.date "year" output.check
   fin.entry
-  write.url
 }

 FUNCTION {inbook}
@@ -1236,7 +1240,6 @@
       if$
     }
   if$
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.btitle "title" output.check
   crossref missing$
     {
@@ -1254,13 +1257,11 @@
   format.pages "pages" output.check
   format.note output
   fin.entry
-  write.url
 }

 FUNCTION {incollection}
 { output.bibitem
   format.authors "author" output.check
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.title "title" output.check
   crossref missing$
     { format.in.ed.booktitle "booktitle" output.check
@@ -1277,13 +1278,11 @@
   format.pages "pages" output.check
   format.note output
   fin.entry
-  write.url
 }

 FUNCTION {inproceedings}
 { output.bibitem
   format.authors "author" output.check
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.title "title" output.check
   crossref missing$
     { format.in.ed.booktitle "booktitle" output.check
@@ -1303,7 +1302,6 @@
   format.pages "pages" output.check
   format.note output
   fin.entry
-  write.url
 }

 FUNCTION {conference} { inproceedings }
@@ -1320,7 +1318,6 @@
     }
     { format.authors output.nonnull }
   if$
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.btitle "title" output.check
   author empty$
     { organization empty$
@@ -1339,13 +1336,11 @@
   format.note output
   format.date "year" output.check
   fin.entry
-  write.url
 }

 FUNCTION {mastersthesis}
 { output.bibitem
   format.authors "author" output.check
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.title "title" output.check
   bbl.mthesis format.thesis.type output.nonnull
   school "school" output.check
@@ -1353,26 +1348,22 @@
   format.note output
   format.date "year" output.check
   fin.entry
-  write.url
 }

 FUNCTION {misc}
 { output.bibitem
   format.authors output
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.title output
   howpublished output
   format.note output
   format.date "year" output.check
   fin.entry
-  write.url
   empty.misc.check
 }

 FUNCTION {phdthesis}
 { output.bibitem
   format.authors "author" output.check
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.title "title" output.check
   bbl.phdthesis format.thesis.type output.nonnull
   school "school" output.check
@@ -1380,7 +1371,6 @@
   format.note output
   format.date "year" output.check
   fin.entry
-  write.url
 }

 FUNCTION {proceedings}
@@ -1389,7 +1379,6 @@
     { organization output }
     { format.editors output.nonnull }
   if$
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.btitle "title" output.check
   format.bvolume output
   format.number.series output
@@ -1413,13 +1402,11 @@
   if$
   format.note output
   fin.entry
-  write.url
 }

 FUNCTION {techreport}
 { output.bibitem
   format.authors "author" output.check
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.title "title" output.check
   format.tr.number output.nonnull
   institution "institution" output.check
@@ -1427,18 +1414,15 @@
   format.note output
   format.date "year" output.check
   fin.entry
-  write.url
 }

 FUNCTION {unpublished}
 { output.bibitem
   format.authors "author" output.check
-  title empty$ 'skip$ 'setup.inlinelink if$ % urlbst
   format.title "title" output.check
   format.note "note" output.check
   format.date "year" output.check
   fin.entry
-  write.url
 }

 FUNCTION {default.type} { misc }
@@ -1487,6 +1471,8 @@
   write$ newline$
   "  \def\href#1#2{#2} \def\path#1{#1}\fi"
   write$ newline$
+  "\providecommand*{\nolinkurl}{\url}"
+  write$ newline$
 }

 EXECUTE {begin.bib}

The modified file link-elsarticle-num.bst can be downloaded from https://gist.github.com/moewew/1519006f9de5500db470bcc4701edeb5 (that page also has a nice diff to the original).

With that link-elsarticle-num.bst the following MWE

\documentclass[number]{elsarticle}
\usepackage[T1]{fontenc}
\usepackage[colorlinks]{hyperref}

\begin{filecontents}{\jobname.bib}
@article{sigfridsson,
  author       = {Sigfridsson, Emma and Ryde, Ulf},
  title        = {Comparison of Methods for Deriving Atomic Charges from the
                  Electrostatic Potential and Moments},
  journal      = {Journal of Computational Chemistry},
  year         = 1998,
  volume       = 19,
  number       = 4,
  pages        = {377-395},
  doi          = {10.1002/(SICI)1096-987X(199803)19:4<377::AID-JCC1>3.0.CO;2-P},
}
@misc{elk,
  author  = {Anne Elk},
  title   = {A Theory on {Brontosauruses}},
  year    = {1971},
  url     = {https://example.edu/~elk/bronto.pdf},
}
@book{nussbaum,
  author       = {Nussbaum, Martha},
  title        = {{Aristotle's} {`De Motu Animalium'}},
  year         = 1978,
  publisher    = {Princeton University Press},
  address      = {Princeton},
}
\end{filecontents}

\begin{document}
\nocite{*}
\bibliographystyle{link-elsarticle-num}
\bibliography{\jobname}
\end{document}

produces

Fully linked bib entries


If you want to suppress the explicit output of URLs and DOIs remove

  output.web.refs  % urlbst

and the

  type$ "webpage" =
    'skip$
    'write.url
  if$

block from FUNCTION {fin.entry} in link-elsarticle-num.bst so that it reads

FUNCTION {fin.entry}
{ 
  makeinlinelink       % ooops, it appears we didn't have a title for inlinelink
    { setup.inlinelink % add some artificial link text here, as a fallback
      "[link]" output.nonnull }
    'skip$
  if$
  bracket.state close.brackets = % urlbst
    { "]" * }
    'skip$
  if$
  add.period$
  write$
  add.closeinlinelink
  newline$
}
|improve this answer|||||
  • This is perfect. Accepted and upvoted. Additionally, can you suppress the explicit printing of doi's and URLs in the bibliography items? – Krishna Mar 27 at 1:31
  • @Krishna Update added at the end. – moewe Mar 27 at 5:47
2

To convert cited bibliography into clickable links with elsarticle class (which implicity uses bibtex ref manager), you can use \usepackage{hyperref}. The second page of the output would be like:

enter image description here

The input tex file is

\documentclass[number]{elsarticle}
\usepackage[hidelinks, colorlinks=true]{hyperref} %% ADDS LINKS TO REFERENCES, YOU CAN IGNORE THE OPTIONS [hidelinks, colorlinks=true] IF YOU LIKE.

\begin{document}

\begin{frontmatter}

\title{Dummy document \tnoteref{t1,t2}}

\tnotetext[t1]{Title footnote 1}
\tnotetext[t2]{Title footnote 2}
\author[a]{First Author\fnref{fn1}}
\ead{firstemail_id@insti_1.edu}
\author[b]{Second Author\fnref{fn2}}
\ead{secondemail_id@insti_2.edu}
\address[a]{Address of author with affiliation `a'}
\address[b]{Address of author with affiliation `b'}
\fntext[fn1]{This is a footnote.}
\fntext[fn2]{Another author footnote}

\begin{abstract}
    Dummy abstract.
\end{abstract}

% Research highlights
\begin{highlights}
    \item Research highlight 1
    \item Research highlight 2
\end{highlights}

\begin{keyword}
    Some \sep keywords
\end{keyword}

\end{frontmatter}

\section{Introduction}{\label{sec:intro}}
Intro

\section{Next}{\label{sec:blah}}
More blah in example of citation here \cite{Tenis_2000}. Another example of citation \cite{kilde}. Here is a third citation for a real article with doi and url \cite{Aalbersberg_2014}.

\nocite{*}   % Temporary placeholder. Comment out after bib file is populated and \cite commands issued
\bibliographystyle{elsarticle-num}
\bibliography{reference} %%% DON’T ADD EXTENSION OF FILE

\end{document}

The reference file used here is reference.bib

@Book{kilde,
  author    = {John Doe},
  publisher = {John Wiley},
  title     = {Differential equations : an introduction to modern methods and applications},
  year      = {2020},
  address   = {New Jersey},
  isbn      = {9780471651413},
  keywords  = {Differential equations},
  language  = {In English},
}

@Article{Tenis_2000,
  author  = {Michael Tenis},
  journal = {Jounal of Energy},
  title   = {New article about something},
  year    = {2000},
  month   = aug,
  number  = {7},
  pages   = {66--88},
  volume  = {2},
}

@Article{Aalbersberg_2014,
  author    = {IJsbrand Jan Aalbersberg and Sophia Atzeni and Hylke Koers and Beate Specker and Elena Zudilova-Seinstra},
  journal   = {{LIBER} Quarterly},
  title     = {Bringing Digital Science Deep Inside the Scientific Article: the Elsevier Article of the Future Project},
  year      = {2014},
  month     = {apr},
  number    = {4},
  pages     = {274},
  volume    = {23},
  doi       = {10.18352/lq.8446},
  publisher = {Uopen Journals},
  url       = {https://doi.org/10.18352/lq.8446},
}

The \usepackage{hyperref} can be used with many options to tweak the links to your linking. e.g. change links color, place underline or box, etc.. You can check this in its manual. That's for linking the citations to the references in the bibliography section.

To link the references in the in the bibliography section to its publishing website, you should use url or doi, or both, fields in your reference.bib file. The website Crossref helps a lot with that as you can copy all the ref information directly from there Actions>Cite including url and doi, into your reference.bib file.

Note that using the \bibliography command should be followed by the name of the bib file without extension like this \bibliography{reference}.

|improve this answer|||||
  • This is not what I am looking for. I mean, to make each line item as a WHOLE formatted by bibtex as a hyperlink. And to get rid of the url: and the doi: fields – Krishna Mar 26 at 2:57
  • @Krishna The WHOLE formatted line (of the third ref) by bibtex is a clickable hyperlink in the output file. Look at the blue part of ref. 3. That's what I got by compiling and you may check it out. – hesham Mar 26 at 3:00
  • Or do you mean not just the title part of the reference? You want everything in the ref entry clickable? – hesham Mar 26 at 3:04
  • Yes. Everything. The whole line. That's what this journal uses. – Krishna Mar 26 at 3:08
  • 1
    @hesham I did understand that the whole entry should be linked, and as I wrote this is easy. You basically only have to insert a startlink at the begin of the entry, and the endlink at the end. – Ulrike Fischer Mar 26 at 10:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.