# How to get bibliography with DOI instead of URL in elsarticle?

I'm using

\documentclass[final,3p,twocolumn,number, sort&compress]{elsarticle}

\bibliographystyle{elsarticle-harv}

\begin{document}

Text citing an article \cite{Andersen20132}.

\bibliography{references}

\end{document}


My bibtex-file references.bib contains this entry:

@Article{Andersen20132,
Title                    = {Long term forecasting of hourly electricity consumption in local areas in Denmark },
Author                   = {F.M. Andersen and H.V. Larsen and R.B. Gaardestrup},
Journal                  = {Applied Energy },
Year                     = {2013},
Number                   = {0},
Pages                    = {147 - 162},
Volume                   = {110},
Doi                      = {http://dx.doi.org/10.1016/j.apenergy.2013.04.046},
ISSN                     = {0306-2619},
Keywords                 = {Long term electricity consumption},
Owner                    = {aki},
Timestamp                = {2014.05.07},
Url                      = {http://www.sciencedirect.com/science/article/pii/S0306261913003413}
}


Elsevier recommends to use DOI in bibliography entries. However, URL is printed instead of DOI.

How can I change this?

• BTW: Nobody has welcomed you here yet. So: Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Jan 14, 2015 at 13:28

The elsarticle-harv.bst style file does not provide any support for DOIs.

What you can do is to use the url field to set the DOI

Url                      = {http://dx.doi.org/10.1016/j.apenergy.2013.04.046}


and put this line in the preamble:

\def\urlprefix{DOI }


MWE

\begin{filecontents*}{references.bib}
@Article{Andersen20132,
Title                    = {Long term forecasting of hourly electricity consumption in local areas in Denmark },
Author                   = {F.M. Andersen and H.V. Larsen and R.B. Gaardestrup},
Journal                  = {Applied Energy },
Year                     = {2013},
Number                   = {0},
Pages                    = {147 - 162},
Volume                   = {110},
ISSN                     = {0306-2619},
Keywords                 = {Long term electricity consumption},
Owner                    = {aki},
Timestamp                = {2014.05.07},
Url                      = {http://dx.doi.org/10.1016/j.apenergy.2013.04.046}
}
\end{filecontents*}

\documentclass[final,3p,twocolumn,number, sort&compress]{elsarticle}

\usepackage{url} % just for breaking urls

\def\urlprefix{DOI }

\begin{document}

Text citing an article \cite{Andersen20132}.

\bibliographystyle{elsarticle-harv}
\raggedright
\bibliography{references}

\end{document}


Output

• not sure the http://dx.doi.org/ should be included in the DOI reference even though you use the url entry. Something like \href{http://dx.doi.org/10.1016/j.apenergy.2013.04.046}{10.1016/j.apenergy.2013.04.046} would be more appropriate, don't you think? Jan 14, 2015 at 14:03
• @pluton I don't know... Jan 14, 2015 at 14:05
• @karlkoeller: Thank you for this solution. I feel it is strange that Elsevier recommends to include DOI and at the same time a bibliography style that does not support it. I wonder how authors deal with this normally. Most references can be downloaded directly as bibtex entry. However, changing the URL of each entry manually can be time consuming...
– Aki
Jan 14, 2015 at 19:47
• @Aki You can switch from elsarticle-harv to elsarticle-num which has support for DOIs. It prints both the DOIs and the URLs. Jan 14, 2015 at 20:01
• @karlkoeller: Is there really no way to manually control for which details are printed in the bibliography? In case I don't want to print URLs but only DOIs, for example.
– Aki
Jan 15, 2015 at 7:18

There is an updated version of the elsarticle-harv.bst which has support for printing the DOI.

http://support.river-valley.com/wiki/index.php?title=Model-wise_bibliographic_style_files

unfortunately they do not push this to CTAN :(