[tex-live] problem with elsarticle.cls and hyperref

Heiko Oberdiek heiko.oberdiek at googlemail.com
Fri Aug 17 10:29:38 CEST 2012

On Thu, Aug 16, 2012 at 09:22:40AM +0200, Robert Jäschke wrote:

> Hash: SHA256
> Hello,
> I am having trouble to typeset a document with the elsarticle class in
> combination with the hyperref package.
> After the first run of pdflatex and a subsequent run of bibtex, a run of
> pdflatex produces the following output:
> > This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)
> [...]
> > Document Class: elsarticle 2009/09/17, 1.2.0: Elsevier Ltd
> [...]
> > (./test.out) (./test.out) (./test.bbl
> > ! Undefined control sequence.
> > <argument> \let \bibinfo at X@doi
> >                                {10.1073/pnas.98.2.404}
> > l.12  \doi{\bibinfo{doi}{10.1073/pnas.98.2.404}}
> >                                                 .
> > ?
> The input files are the following:
> - --- file: test.tex ----------------------------------
> \documentclass{elsarticle}
> \usepackage{hyperref}
> \begin{document}
> \cite{test2012test}
> \bibliographystyle{elsarticle-num-names}
> \bibliography{test}
> \end{document}
> - -----------------------------------------------------
> - --- file: test.bib ----------------------------------
> @article{test2012test,
>   doi = {10.1073/pnas.98.2.404},
> }
> - -----------------------------------------------------
> If I remove the hyperref package, everything works fine. I am assuming
> that this is a TeXLive bug,

TeX Live is a TeX distribution. It would be a TeX Live bug,
if a package is way out of date, files of a package are missing
or sorted wrongly, ...
  But package bugs, incompatibilities between packages are not
bugs of the distribution.

> since a search on the web brought me to
> http://www.latex-community.org/forum/viewtopic.php?f=4&t=14622
> where a similar problem is described and solved by switching to MikTeX:

A different TeX distribution might contain other packages in different
versions. Add \listfiles and compare the version list.

BTW, MiKTeX 2.9 shows the same behaviour.

> Can you confirm that this is a TeXLive bug?

No, it isn't.

The contents of the generated .bbl file:

  \providecommand{\urlprefix}{URL }
  \expandafter\ifx\csname urlstyle\endcsname\relax



* Class elsarticle loads package natbib that defines \bibinfo
  in a non-expandable way.
* Hyperref loads package url, thus \url and \urlstyle are defined.
* \doi is not defined.

Then \doi calls "\bibinfo{doi}{10.1073/pnas.98.2.404}" as url.
If only package url is loaded, then "\bibinfo" will be printed, too.
With package doipubmed that defines \doi, the printed text is also wrong.
If package hyperref or doi is loaded, then the non-expandable \bibinfo
of natbib breaks with an error message. \bibinfo should not be part
of the url/doi. BTW, for a clickable link, a real url is needed, too.
That is not provided by the provided definitions either.

Summary: It is a bug of the bibliography style elsarticle-num-names.bst
that should be fixed there.

> Are there any workarounds besides not using the
> hyperref package?

Workaround, if package hyperref is loaded and \doi is undefined:








Yours sincerely
  Heiko Oberdiek

More information about the tex-live mailing list