Closed hestehle closed 4 years ago
I'd want to look at the problem with the debug log separately, but as to escaping the DOI, are you exporting as bibtex or biblatex?
Hi!
I am exporting as bibtex.
Thanks for looking into the issue.
Do you have an MWE that exhibits the problem? I tried the sample below and I didn't get any errors. Unfortunately, the bibtex docs don't say whether doi
should be verbatim or not -- for biblatex it is verbatim.
\documentclass[a4paper, 12pt]{article}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@article{paper,
author={name},
title="{title}",
journal={J. Phys. Conf. Ser.},
volume={67},
number={},
pages={23},
doi = {10.1007/978-3-531-19121-8_8},
year={2007}
}
\end{filecontents*}
\begin{document}
\title{Autumn Term Report}
\author{myself}
\date{\today}
\maketitle
HI \cite{paper}
\bibliographystyle{unsrt}
\bibliography{\jobname}
\end{document}
Are you behind a proxy by any chance?
No proxy, no.
The exported bib entry looks like this:
@incollection{hoffjann_diskurs_2013,
address = {{Wiesbaden}},
title = {{Der Diskurs {\"u}ber PR-Geschichte und PR-Historiographie in Deutschland und international}},
isbn = {978-3-531-18576-7 978-3-531-19121-8},
shorttitle = {{Der Diskurs ?}},
language = {de},
booktitle = {{UnVergessene Diskurse. 20 Jahre PR- und Organisationskommunikationsforschung}},
publisher = {{Springer VS}},
author = {Bentele, G{\"u}nter},
editor = {Hoffjann, Olaf and {Huck-Sandhu}, Simone},
year = {2013},
pages = {197-235},
file = {/Users/Hele/Zotero/storage/6A37PNZ7/Bentele_2013.pdf},
doi = {10.1007/978-3-531-19121-8_8}
}
Btw. I am using the apacite package and the bibliography style apacite.
That's reproducable, working on it. For my own future reference: the MWE for this is:
\documentclass{article}
\usepackage[english]{babel}
\usepackage[utf8x]{inputenc}
\usepackage{apacite}
\title{Package Example: apacite}
\author{writeLaTeX}
\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@incollection{hoffjann_diskurs_2013,
address = {{Wiesbaden}},
title = {{Der Diskurs {\"u}ber PR-Geschichte und PR-Historiographie in Deutschland und international}},
isbn = {978-3-531-18576-7 978-3-531-19121-8},
shorttitle = {{Der Diskurs ?}},
language = {de},
booktitle = {{UnVergessene Diskurse. 20 Jahre PR- und Organisationskommunikationsforschung}},
publisher = {{Springer VS}},
author = {Bentele, G{\"u}nter},
editor = {Hoffjann, Olaf and {Huck-Sandhu}, Simone},
year = {2013},
pages = {197-235},
file = {/Users/Hele/Zotero/storage/6A37PNZ7/Bentele_2013.pdf},
doi = {10.1007/978-3-531-19121-8\_8}
}
\end{filecontents*}
\begin{document}
\maketitle
Here is an example citation: \cite{hoffjann_diskurs_2013}.
\bibliographystyle{apacite}
\bibliography{\jobname}
\end{document}
@njbart any opinions on this? If I compile the sample above without the escape, it fails, but I have multiple test cases in my suite that have the DOI in verbatim mode in bibtex and those users at least did not complain about this. Could of course be a different style being in use by them.
:robot: this is your friendly neighborhood build bot announcing test build 5.1.164.5195 ("adjust tests for #1336")
Install in Zotero by downloading test build 5.1.164.5195, opening the Zotero "Tools" menu, selecting "Add-ons", open the gear menu in the top right, and select "Install Add-on From File...".
Well, my view is, it’s not BBT’s job to start fiddling with special characters in DOIs.
By rights, it’s those bibtex styles that claim to be able to deal with doi
fields but don’t do it properly that need to be fixed. That’s certainly possible, as some of your test cases seem to show.
Until the bibtex style maintainers in question have done their homework, adding \usepackage{uri}
(or possibly \usepackage[doipre={}]{uri}
) to a latex document’s preamble – after hyperref
, but before the bib package – seems to work tolerably well, too – even with really nasty DOIs such as 10.1002/1521-4001(200209)82:9<579::AID-ZAMM579>3.0.CO;2-V
.
Thanks. It's also possible to leave fixing to a postscript. But the samples I have aren't definitive proof that those authors didn't have problems - if I use the unsrt style I get no errors with this doi, and I can't find docs on whether in bibtex the doi field should be verbatim, or a more general rule that says which fields should be treated as verbatim by bibtex.
Is it safe to export those as a preamble in the bibtex file?
I don’t think you’ll ever find anything definitive on DOI fields in bibtex in general. Still, there’s the following:
The apacite manual (apacite.pdf from texlive) says “Also note that in the url
field, special characters like ‘%
’ and ‘#
’ should be entered without a backslash …” In the absence of anything to the contrary being said on the DOI field, I’d argue it should be treated analogously.
The natbib manual is silent on the question of escaping characters.
apacite itself does not load url.sty
(nor hyperref.sty
, which would in turn load url.sty
) – and fails when encountering a url
field with %
or #
.
So url.sty
obviously is a prerequisite for apacite.sty
to function properly. There’s no reason I’m aware of not to load it, and if loaded, both urls and DOIs, even the weird ones, come out properly. (Same for natbib/plainnat; the only combo I have been testing so far.)
Hence I think there is no reason at all for BBT to fiddle with escaping characters, it’s just that users need to be made aware of the fact they should load either url.sty
or hyperref.sty
(or hyperref.sty
and (!) uri.sty
to get actual functioning hyperlinks from a DOI).
Is it safe to export those as a preamble in the bibtex file?
What’s “those”?
The usepackage statements.
You could try that for yourself – what I found is that statements in a bibtex file preamble are loaded only in the document body, so anything that needs to be loaded in the latex document’s preamble won’t work.
That's no good. @hestehle, does loading that package solve the problem with the standard BBT output?
(verified BTW that adding the @preamble
doesn't work)
So @hestehle, that leaves either loading the url
package, or fixing it in a postscript:
if (Translator.BetterBibTeX && reference.has.doi) {
reference.add({ name: 'doi', value: reference.has.doi.value, enc: 'latex' })
}
To clarify: There’s a url
and there’s a uri
package. The former is in widespread use (including the default pandoc latex templates), I’m using it all the time, and I’m pretty sure there’s no reason not to load it in any document. I’m less familiar with the other one, uri
, but in combination with hyperref
this one generates actual clickable links from DOIs. There’s probably no reason not to try the latter either (with the option to switch back to url
in case anything problematic crops up.)
Yeah sorry I meant url
(another option, of which I don't know whether it's available to you, is to switch to biblatex of course)
@retorquere, @njbart: Thanks for your investigations. We can live with the addition of \usepackage{url}
.
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
I have a special DOI in the "Extra"-field of my reference of type "Book Section" which contains an underscore. In my example its "DOI: 10.1007/978-3-531-19121-8_8" (yes, that's an official DOI). The underscore in the DOI is not escaped properly such that Latex interprets the "8" as a subscript. Pain!
Report ID: Sorry, not available. Using "Better BibTex Debug Report" yields an error during submission. The error says "Request timed out (ACURV6H-euc, references: true)".