3

I have a Zotero bibliography in Overleaf. I use biblatex.

\usepackage[backend=biber,citestyle=authoryear]{biblatex}
\addbibresource{zoteroALH.bib}

Bibliography entries look like:

@book{de_saint-gervais_uniformization_2016,
    title = {Uniformization of {Riemann} {Surfaces}},
    isbn = {978-3-03719-145-3},
    url = {https://www.ems-ph.org/books/book.php?proj_nr=198&srch=series%7Chem},
    urldate = {2019-02-03},
    author = {de Saint-Gervais, Paul Henri},
    year = {2016},
    doi = {10.4171/145}
}

In the bibliography down the paper the reference shows like this: enter image description here There is the DOI, great, but also the URL which is unnecessary when the DOI is there.

How can I remove the URL when the DOI is present?

1 Answer 1

6

I really thought there would be a duplicate, but I could not find a good one. (Biblatex: use doi only if there is no URL asks for the opposite and has a sourcemap solution. Redundancy in bib file: conditionally suppress url if same as doi? is asking for something slightly different and is not specific to biblatex, but has some biblatex answers, none of them uses a sourcemap, though. Print url only if doi not present is very close, the question additionally asks about eprint, but that could probably be ignored.)

My preferred solution would be to use a Biber sourcemap to completely remove the url and urldate field if the doi is present.

\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}
\usepackage[colorlinks]{hyperref}

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=doi,final]
      \step[fieldset=url,null]
      \step[fieldset=urldate,null]
    }  
  }
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{de_saint-gervais_uniformization_2016,
  title   = {Uniformization of {Riemann} {Surfaces}},
  isbn    = {978-3-03719-145-3},
  url     = {https://www.ems-ph.org/books/book.php?proj_nr=198&srch=series%7Chem},
  urldate = {2019-02-03},
  author  = {de Saint-Gervais, Paul Henri},
  year    = {2016},
  doi     = {10.4171/145}
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\cite{de_saint-gervais_uniformization_2016}
\printbibliography
\end{document}

Saint-Gervais, Paul Henri de (2016). Uniformization of Riemann Surfaces. isbn: 978-3-03719-145-3. doi: 10.4171/145.

You must log in to answer this question.

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