# biblatex and non-url friendly DOIs

Wiley seems to be assigning DOIs using some semantic schema of their own for some of their journals. E.g. 10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V.

Such DOIs have two unwanted side-effects when processed by biblatex:

1. They include characters that aren't URL-safe. Biblatex doesn't seem to properly process these DOIs. As a results the produced link in the document doesn't work.
2. The DOI itself is very long, which introduces spaces, making it harder to copy it as text.

Here is the output from the example DOI:

The .bbl contains the DOI verbatim:

\verb{doi}
\verb 10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V
\endverb


So I'd guess that the problem occurs later, probably in the biblatex-hyperref interface.

Is there a way to make these DOIs work with biblatex?

# Full Example

## LaTeX source

\documentclass{article}
\usepackage{plex-otf}
\usepackage{filecontents}

\begin{filecontents}[overwrite]{sample.bib}
@article{lynch-jasist01,
author        = {Lynch, Clifford A.},
title         = {When documents deceive: Trust and provenance as new factors for information retrieval in a tangled web},
journal       = {Journal of the American Society for Information Science and Technology},
volume        = {52},
number        = {1},
pages         = {12--17},
month         = {11},
year          = {2000},
doi           = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
}
\end{filecontents}

\usepackage{xpatch}
\usepackage[backend=biber,natbib=true,bibstyle=alphabetic,citestyle=alphabetic]{biblatex}
\ExecuteBibliographyOptions{sorting=nyt, sortlocale=auto}

\begin{document}
\title{BibLaTeX and weird DOIs}
\maketitle

On StackExchange, there's a
whether DOIs with non URL-safe characters (e.g. \autocite{lynch-jasist01})
are properly handled by BibLaTeX.

\printbibliography[title=References]
\end{document}


## Software used

• LaTeX: This is LuaTeX, Version 1.10.0 (TeX Live 2019)
• biber: biber version: 2.14
• Viewers: Preview 10.1(MacOS Mojave), Skim 1.5.11
• escape the < and >: https://doi.org/10.1002/1532-2890(2000)52:1%3C12::AID-ASI1062%3E3.0.CO;2-V Aug 12, 2020 at 16:27
• In my tests DOIs with < and > linked just fine (gist.github.com/moewew/5b002e9d7e3a80c0fe34973abef78004). Can you please share a full example document that reproduces non working links. Please also tell us which PDF viewer and browser you used to test the link. Aug 12, 2020 at 17:14
• In my test document the DOIs also copy-and-paste nicely (with SumatraPDF on Win 10), but it is not inconceivable that worse line breaks cause space to stretch and viewers to copy spaces. In that case it may help to let the DOI break in more places. tex.stackexchange.com/q/134191/35864, Aug 12, 2020 at 17:28
• @moewe I've added a full example. I also tried your gist (with lualatex and pdflatex) but the links are still not working. Could be a viewer problem, but I don't know how two independently developed viewers don't work. Or do Preview/Skim share a rendering engine or something?
– m000
Aug 12, 2020 at 18:16
• Your MWE works fine for me, but since you mention MacOS, there seem to be issues with some PDF readers and browsers on that platform when it comes to special characters in URLs, see tex.stackexchange.com/q/454947/35864 and the more recent github.com/latex3/hyperref/issues/110 Aug 13, 2020 at 5:07

It does not exactly answer your question but you might still be interested in what follows. Indicating explicitly DOI (long or short) is not really useful for the reader. What matters is a clickable link that points to the cited document. The idea is then to have the word "DOI" clickable with the actual DOI as the underlying link. One way to achieve this is to use the addendum field in your .bib entry where you insert the \href{actual link}{clickable term} command:

@article{Clifford2001,
author = {Lynch, Clifford A.},
title = {When documents deceive: Trust and provenance as new factors for information retrieval in a tangled web},
journal = {Journal of the American Society for Information Science and Technology},
volume = {52},
number = {1},
pages = {12-17},
ddoi = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
year = {2001},
}


Note that I have modified the doi field into ddoi so that it is ignored during compilation. An even better solution would be to keep the original .bib entry:

@article{Clifford2001,
author = {Lynch, Clifford A.},
title = {When documents deceive: Trust and provenance as new factors for information retrieval in a tangled web},
journal = {Journal of the American Society for Information Science and Technology},
volume = {52},
number = {1},
pages = {12-17},
doi = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
year = {2001},
}


and ask biblatex to achieve the above during compilation but I do not know how.

• \DeclareFieldFormat{doi}{\href{https://doi.org/#1}{\mkbibacro{DOI}}} may help with the last point. Aug 12, 2020 at 17:39
• A DOI should be not just clickable but retypable for readers working on paper. If your suggestion works the way it seems to, that's not an option. Of course the publisher isn't exactly being helpful in that regard May 19, 2021 at 8:44

In my tests both your entry as well as the entry sigfridsson from biblatex-examples.bib worked well for linking in several PDF Viewers on Windows 10 (Sumatra PDF, Adobe Reader, Firefox, Chrome, Edge, ...) as well as for copy-and-pasting (minus the line break).

\documentclass{article}
\usepackage{plex-otf}

\usepackage[backend=biber, style=alphabetic]{biblatex}

\begin{filecontents}{\jobname.bib}
@article{lynch,
author  = {Lynch, Clifford A.},
title   = {When Documents Deceive:
Trust and Provenance as New Factors
for Information Retrieval in a Tangled Web},
journal = {Journal of the American Society
for Information Science and Technology},
volume  = {52},
number  = {1},
pages   = {12-17},
doi     = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
year    = {2001},
}
\end{filecontents}

\begin{document}
\autocite{lynch, sigfridsson}
\printbibliography[title=References]
\end{document}


There are some known issues with certain viewers on MacOS, see https://github.com/latex3/hyperref/issues/110 and Revtex. Some DOI links broken with longbibliography. As far as I can see the consensus there is that this is a bug in those viewers and not a LaTeX issue.

It may help to escape some of the special characters in DOIs as recommended in https://www.doi.org/doi_handbook/2_Numbering.html.

If you still want to display the unescaped DOI, some trickery is needed.

\documentclass{article}
\usepackage{plex-otf}

\usepackage[backend=biber, style=alphabetic]{biblatex}

\DeclareSourcemap{
\maps{
\map{
\step[fieldsource=doi]
\step[fieldset=verba, origfieldval]
\step[fieldsource=doi, match=\regexp{\x{28}}, replace=\regexp{\x{25}28}]
\step[fieldsource=doi, match=\regexp{\x{29}}, replace=\regexp{\x{25}29}]
\step[fieldsource=doi, match=\regexp{\x{3C}}, replace=\regexp{\x{25}3C}]
\step[fieldsource=doi, match=\regexp{\x{3E}}, replace=\regexp{\x{25}3E}]
}
}
}

\DeclareFieldFormat{doi}{%
\ifhyperref

\begin{filecontents}{\jobname.bib}
@article{lynch,
author  = {Lynch, Clifford A.},
title   = {When Documents Deceive:
Trust and Provenance as New Factors
for Information Retrieval in a Tangled Web},
journal = {Journal of the American Society
for Information Science and Technology},
volume  = {52},
number  = {1},
pages   = {12-17},
doi     = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
year    = {2001},
}
\end{filecontents}

\begin{document}
\autocite{lynch, sigfridsson}
\printbibliography[title=References]
\end{document}


Unpleasant line breaks are of course always an issue. biblatex has some options to tweak URL and DOI line breaking, see Line breaks of long URLs in biblatex bibliography? and BibLaTeX long URL extending into border despite using biburllcpenalty. A simple solution might be loading the xurl package, which allows line breaks in URLs everywhere.

\documentclass{article}
\usepackage{plex-otf}

\usepackage[backend=biber, style=alphabetic]{biblatex}
\usepackage{xurl}

\begin{filecontents}{\jobname.bib}
@article{lynch,
author  = {Lynch, Clifford A.},
title   = {When Documents Deceive:
Trust and Provenance as New Factors
for Information Retrieval in a Tangled Web},
journal = {Journal of the American Society
for Information Science and Technology},
volume  = {52},
number  = {1},
pages   = {12-17},
doi     = {10.1002/1532-2890(2000)52:1<12::AID-ASI1062>3.0.CO;2-V},
year    = {2001},
}
\end{filecontents}