# Problem in TexLive with bibentry for entries with ISBN and URL fields

I've a problem when using \bibentry for bibliographic entries that include an ISBN or URL field. My document works fine with MikTex on Win7 x64, but breaks with TexLive 2013 (from Ubuntu 14 repositories), or TexLive 2015 (from the TexLive page). Although my main workflow uses MikTex, I'm curious about the reason of the problem with TexLive and a possible workaround.

I've isolated the problem to the use of \bibentry and the creation of additional macros by the bibtex version of TexLive in the bbl file. The following are my MWE files and the output of both MikTex and TexLive 2015:

mwe.tex:

\documentclass[final]{scrbook}

\usepackage{bibentry}
\nobibliography*        % Tells bibentry to (re)use the bibliographic data from the standard BibTeX setup by \bibliography{} at the end

\begin{document}
This is working fine~\cite{p:thepaper}.

This fails: \bibentry{p:thepaper}.

\bibliographystyle{is-alpha}
\bibliography{mwe}

\end{document}


mwe.bib:

@inproceedings{p:thepaper,
author = {Me, Myself and Myself, I},
title = {The Title},
year = {2015},
isbn = {123-1-123-12345-1},
publisher = "The publisher",
url = {http://dx.doi.org/12.1234/123-1-123-12345-1_23},
doi = {12.1234/123-1-123-12345-1_23},
pages = {123--321}
}


OUTPUT TexLive 2015 (Ubuntu 14):

*

)) (/usr/local/texlive/2015/texmf-dist/tex/latex/natbib/bibentry.sty)
(./mwe.bbl (/usr/local/texlive/2015/texmf-dist/tex/generic/path/path.sty
This is path.sty, Version 3.05 <7-Apr-2011>
)) (./mwe.aux)
LaTeX Warning: Citation p:thepaper' on page 1 undefined on input line 7.
LaTeX Warning: Citation p:thepaper' undefined on input line 9.
! Undefined control sequence.
<argument> ...ublisher, 2015. \newblock \showISBN
{123-1-123-12345-1}. \newb...
l.9 This fails: \bibentry{p:thepaper}
.
?


*

mwe.bbl (produced by TexLive 2015, which fails):

\begin{thebibliography}{MM15}
\ifx \showCODEN  \undefined \def \showCODEN #1{CODEN #1}  \fi
\ifx \showISBN   \undefined \def \showISBN  #1{ISBN #1}   \fi
\ifx \showISSN   \undefined \def \showISSN  #1{ISSN #1}   \fi
\ifx \showLCCN   \undefined \def \showLCCN  #1{LCCN #1}   \fi
\ifx \showPRICE  \undefined \def \showPRICE #1{#1}        \fi
\ifx \showURL    \undefined \def \showURL {URL }          \fi
\ifx \path       \undefined \input path.sty               \fi
\ifx \ifshowURL \undefined
\newif \ifshowURL
\showURLtrue
\fi

\bibitem[MM15]{p:thepaper}
Myself Me and I~Myself.
\newblock The title.
\newblock pages 123--321. The publisher, 2015.
\newblock \showISBN{123-1-123-12345-1}.
\newblock \ifshowURL {\showURL
\path|http://dx.doi.org/12.1234/123-1-123-12345-1_23|}\fi.

\end{thebibliography}


mwe.bbl (produced by MikTex, which works fine):

\begin{thebibliography}{MM15}

\bibitem[MM15]{p:thepaper}
Myself Me and I~Myself.
\newblock The title.
\newblock pages 123--321. The publisher, 2015.
\newblock ISBN 123-1-123-12345-1.

\end{thebibliography}


I've tried including some of the macros of the bbl file in mwe.tex, just before using the package bibentry, so that their definitions are available before it is used:

\global\def \showISBN  #1{ISBN #1}
\global\def \showURL {URL }
\input path.sty
\ifx \ifshowURL \undefined
\newif \ifshowURL
\showURLtrue
\fi


However, I keep getting the following error:

) (/usr/local/texlive/2015/texmf-dist/tex/latex/natbib/bibentry.sty) (./mwe.bbl
)
! Incomplete \ifx; all text was ignored after line 9.
<inserted text>
\fi
l.12 \nobibliography*
% Tells bibentry to (re)use the bibliographic data fr...

? q


PS: On Miktex:

bibtex --version
MiKTeX-BibTeX 2.9.5700 (0.99d) (MiKTeX 2.9 64-bit)


On TexLive 2015:

bibtex --version
BibTeX 0.99d (TeX Live 2015)
kpathsea version 6.2.1


bibentry is part of natbib and I take it that it is designed in that context. While it may work with arbitrary bibliography styles, I suspect this depends very much on the particular style. Since is-alpha.bst is not part of natbib, you cannot count on it working with bibentry.

If you use a natbib-compatible style, such as bog-standard alpha, everything works fine:

\begin{filecontents}{\jobname.bib}
@inproceedings{p:thepaper,
author = {Me, Myself and Myself, I},
title = {The Title},
booktitle = {The Title},
year = {2015},
isbn = {123-1-123-12345-1},
publisher = "The publisher",
url = {http://dx.doi.org/12.1234/123-1-123-12345-1_23},
doi = {12.1234/123-1-123-12345-1_23},
pages = {123--321}
}
\end{filecontents}

\documentclass{article}
\usepackage{natbib}
\usepackage{bibentry}
\nobibliography*        % Tells bibentry to (re)use the bibliographic data from the standard BibTeX setup by \bibliography{} at the end

\begin{document}
This is working fine~\cite{p:thepaper}.

This works fine when you use a \verb|natbib|-compatible style: \bibentry{p:thepaper}.

\bibliographystyle{alpha}
\bibliography{\jobname}

\end{document}


However, I'm not sure why it would work with MikTeX given that none of the files seem to have been updated recently. Unless it is a change in the LaTeX kernel...?

• Thanks! You actually put me on track. I didn't realize that bibentry was part of natbib. Checking the is-alpha.bst file I saw that the TexLive version is far more recent (2.03 from 1996, versus the 1.05 from 1994 in Miktex). The comments in the file explicitly state the inclusion of the \showISBN, \showISSN, etc. macros. I guess the older version of the style file did not clash with bibentry, but the newer version does. Now, what if I wanted to produce output similar to \bibentry without loading the natbib package and sticking to is-alpha style? Any suggestions?
– Mike
Oct 12 '15 at 19:34
• Bizarre that MikTeX would not have an update from 1996 ;). Is Biblatex/Biber an option? I figured out it was part of natbib by saying texdoc bibentry, by the way. That opens the natbib documentation.
– cfr
Oct 12 '15 at 22:03

With the current MiKTeX 2.9 I can compile your given code without an error or warning after I added a missing booktitle={Book Title}, into your bib entry.

I changed your document class to scrartcl to show you the text and the bibliography on one page (The result does not change if I use scrbook).

I used package filecontents to have the bib file and the tex code in one compilable file. \jobname is changed to the file name mwe if you named the file mwe.tex.

I added command \listfile to get a list of the used packages and versions in the log file. Please compare this list with the result on your computer. I guess you are using one or more outdated versions ...

MWE:

\listfiles % creates list of used packages and versions in log file
\RequirePackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@inproceedings{p:thepaper,
author    = {Me, Myself and Myself, I},
title     = {The Title},
booktitle = {The Book Title},
year      = {2015},
isbn      = {123-1-123-12345-1},
publisher = "The publisher",
url       = {http://dx.doi.org/12.1234/123-1-123-12345-1_23},
doi       = {12.1234/123-1-123-12345-1_23},
pages     = {123--321},
}
\end{filecontents*}

\documentclass[final]{scrartcl}%scrbook scrartcl

\usepackage{bibentry}
\nobibliography*        % Tells bibentry to (re)use the bibliographic data from the standard BibTeX setup by \bibliography{} at the end

\begin{document}
This is working fine~\cite{p:thepaper}.

This fails: \bibentry{p:thepaper}.

\bibliographystyle{is-alpha}
\bibliography{\jobname}

\end{document}


List of used packages and versions:

 *File List*
filecontents.sty    2011/10/08 v1.3 Create an external file from within a LaTeX document
scrartcl.cls    2015/07/02 v3.18 KOMA-Script document class (article)
scrkbase.sty    2015/07/02 v3.18 KOMA-Script package (KOMA-Script-dependent basics and keyval usage)
scrbase.sty    2015/07/02 v3.18 KOMA-Script package (KOMA-Script-independent basics and keyval usage)
keyval.sty    2014/10/28 v1.15 key=value parser (DPC)
tocbasic.sty    2015/07/02 v3.18 KOMA-Script package (handling toc-files)
scrsize11pt.clo    2015/07/02 v3.18 KOMA-Script font size class option (11pt)
typearea.sty    2015/07/02 v3.18 KOMA-Script package (type area)
bibentry.sty    2007/10/30 1.5 (PWD)


And the result:

• I'm sorry about this missunderstanding... My code DOES work on MikTex. The problem is under Texlive 2015 (or 2013). ALthough my workflow uses Miktex, I would like to know why it fails with TexLive. Anyways, thanks a lot for your prompt answer!
– Mike
Oct 7 '15 at 12:52
• Check the versions of the used packages with TeX Live. I think there is a difference! Oct 7 '15 at 12:58
• I was checking package versions and they seemed to be the same for the relevant ones. However, I didn't think about the is-alpha.bst file itself. After reading cfr's answer below, I realized that bibentry is part of natbib and probably not compatible with is-alpha. Apparently, the bst version in Miktex is older and works with bibentry, whereas the newer version included in TexLive probably broke something when adding the \showISBN family of macros. Thanks a lot for your comments!
– Mike
Oct 12 '15 at 19:38