I prepared my article with elsarticle, using \citep & \citet throughout. I originally used apalike bibliographystyle but now need to change it to elsarticle-num-names for citation formatting requirements (see point #2 below).
Now, I am attempting to make 2 changes:
- add DOIs to the bibliography
- change reference style to
[1]
for \citep andAuthor et al. [1]
for \citet.
I want to keep hyperref and do not want explicit URLs (only DOIs) but cannot make this work!
Thank you for any help you might have!
MWE:
\documentclass[preprint,12pt]{elsarticle}
%\usepackage{hyperref}
\journal{Test Journal}
\begin{document}
\begin{frontmatter}
\title{The Title}
\author{Prof. Big Ol' Wanker}
\address{123 Happy Lane}
\begin{abstract}
TEXT
\end{abstract}
\begin{keyword}
keyword 1 \sep keyword 2 \sep keyword 3
\end{keyword}
\end{frontmatter}
\section{SECTION1TEST}
\noindent cite: \cite{Richards1931} \\
citep: \citep{Richards1931} \\
citet: \citet{Richards1931} \\
\bibliography{library}
\bibliographystyle{elsarticle-num-names}
\end{document}
Here is the reference for Richards1931 from my library.bib file:
@article{Richards1931,
author = {Richards, LA},
doi = {10.1063/1.1745010},
file = {:D$\backslash$:/Papers/Richards - 1931 - Capillary Conduction of Liquids Through Porous Mediums - Journal of Applied Physics.pdf:pdf},
issn = {01486349},
journal = {Journal of Applied Physics},
pages = {318},
title = {{Capillary Conduction of Liquids Through Porous Mediums}},
url = {http://scitation.aip.org/content/aip/journal/jap/1/5/10.1063/1.1745010},
volume = {1},
year = {1931}
}
without hyperref (wanted hyperlinks present, DOI displays correctly, but unwanted URL is present):
with hyperref (hyperlinks not present, DOI displays incorrectly, and unwanted URL is present):
Best Answer
This problem occurs because
elsarticle
does not define a\doi
macro thathyperref
requires.Hyperref
calls\doi{\bibinfo{doi}{XXX}}
to produce the URL for the DOI in the reference XXX. If the\doi
macro is not defined, the resulting output will be something like\let\@tempa\bibinfo@X@doi{XXX}
As a workaround, you can define a
\doi
macro that solve the problem