4

I am trying to make IEEEtranbib work with bibentry and hyperref, but I am stuck.

MWE

\documentclass[conference]{IEEEtran/IEEEtran}

\usepackage{bibentry}
\makeatletter\let\saved@bibitem\@bibitem\makeatother
\usepackage{hyperref}
\makeatletter\let\@bibitem\saved@bibitem\makeatother
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@IEEEtranBSTCTL{IEEEexample:BSTcontrol,
  CTLuse_forced_etal       = "yes",
  CTLmax_names_forced_etal = "4",
  CTLnames_show_etal       = "2",
  CTLdash_repeated_names   = "no"
}
@article{myentry,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    url     = "https://dwqdhqwjkdhqkjdhqd.dwqdq/djkqwb",
    pages   = "342--351"
}
\end{filecontents}
\newcommand{\fullcite}[1]{\begin{NoHyper}\bibentry{#1}\end{NoHyper}}

\begin{document}

\bstctlcite{IEEEexample:BSTcontrol}

\nobibliography*

A citation: \cite{myentry}

Inline entry: \begin{NoHyper}\bibentry{myentry}\end{NoHyper}

\bibliographystyle{IEEEtranbib/IEEEtran}
\bibliography{IEEEtranbib/IEEEabrv,\jobname}{}

\end{document}

Error when compiling:

Runaway argument?
\BIBentryALTinterwordspacing G.~D. Greenwade, ``The {C}omprehensive {\ETC.
! Paragraph ended before \BR@c@bibitem was complete.
<to be read again> 
                   \par 
l.30 

I have tried tons of combinations of extra renewcommand or makeatletter, such as:

\makeatletter
\renewcommand\bibentry[1]{\nocite{#1}{\frenchspacing
     \@nameuse{BR@r@#1\@extra@b@citeb}}}
\makeatother

Could someone provide a simple example on how to make IEEEtranbib work with bibentry and hyperref when bib entries have url fields?

4
  • 1
    What exactly are you trying to achieve by setting up a macro called \fullcite that invokes \bibentry? What's wrong about "ordinary" \cite-type commands?
    – Mico
    Commented Mar 15, 2017 at 17:58
  • 1
    @Mico I want a full citation in the text, which is what bibentry does, and the NoHyper environment is to avoid hyperref linking to the bibentry instead of the reference (found on another question here). I am open to any suggestion!
    – Holt
    Commented Mar 15, 2017 at 18:05
  • I suspect it's due to the fact that the URL is too long and it cannot hyphenate it. Moreover, it seems that bibentry does not care whether the URL is enclosed in \href, \hyperlink, \url, \hyperref.
    – Sussch
    Commented May 26, 2019 at 16:55
  • Found a discussion about the issue at sourceforge.net/p/bibdesk/mailman/message/9168466
    – Sussch
    Commented May 26, 2019 at 17:02

1 Answer 1

0

I don't really exactly know all of the implications of the following change, but this is working for me at least:

\documentclass{scrartcl}

\makeatletter
% this is necessary to allow external control of IEEEtran.bst; for IEEEtran.cls document class, it is included and not necessary
\def\bstctlcite{\@ifnextchar[{\@bstctlcite}{\@bstctlcite[@auxout]}}
\def\@bstctlcite[#1]#2{\@bsphack
\@for\@citeb:=#2\do{%
\edef\@citeb{\expandafter\@firstofone\@citeb}%
\if@filesw\immediate\write\csname #1\endcsname{\string\citation{\@citeb}}\fi}%
\@esphack}

% this forces filecontents to overwrite for reflecting any change
\let\oldfilec@ntents\filec@ntents
\gdef\filec@ntents{\filec@ntents@overwrite\oldfilec@ntents}
\makeatother

\usepackage[square, sort, comma, numbers]{natbib}
\usepackage{bibentry}
\nobibliography*
\usepackage{hyperref}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@IEEEtranBSTCTL{IEEEexample:BSTcontrol,
CTLuse_alt_spacing = "no"
}
% <================= change this to "yes" and it won't work anymore ============>

@article{myentry,
    author  = "George D. Greenwade",
    title   = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
    year    = "1993",
    journal = "TUGBoat",
    volume  = "14",
    number  = "3",
    url     = "https://dwqdhqwjkdhqkjdhqd.dwqdq/djkqwb",
    pages   = "342--351"
}
\end{filecontents}
\newcommand{\fullcite}[1]{\begin{NoHyper}\bibentry{#1}\end{NoHyper}}

\begin{document}
\bstctlcite{IEEEexample:BSTcontrol}

A citation: \cite{myentry}

Inline entry: \fullcite{myentry}

\bibliographystyle{IEEEtran}
\bibliography{\jobname}

\end{document}

This BSTCTL way is one way to get the desired behavior without changing the IEEEtran.bst. If it is ok to change it, you can also change the line

FUNCTION {default.is.use.alt.interword.spacing} { #1 }

to

FUNCTION {default.is.use.alt.interword.spacing} { #0 }

to achieve the same. Both would stop putting a \BIBentryALTinterwordspacing and \BIBentrySTDinterwordspacing around the entry in the .bbl file. Omitting those is enabling a successful compilation.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .