Analogous to this question, is there a way to show url
s only for those references that do not have pages
?
In my bibliography I have a number of articles or reviews where I keep the url field to know which website I got a given pdf from, but the pdf is a regularly published article, so it has page numbers, hence the url
information is redundant. However, I also have some @article
s from regular online journals and therefore not of the @online
type, but that don't have pages where I would need to keep the url
.
In short, I don't want to eliminate urls globally or per bibtex type, but rather have some if-then function do it for me based on whether or not the pages
field is empty.
EDIT: It would also be great to accomplish the same for doi
and urldate
fields, i.e., suppress these too if page numbers are present.
Following the solution here one could do:
\documentclass{article}
\usepackage{filecontents}
\usepackage{biblatex}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=pages,final]
\step[fieldset=url,null]
}
}
}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{test1,
author = {Antelope, Alfred},
year = {2010},
title = {A Title},
url = {www.url.com},
urldate = {2015-05-05},
journal = {Journal},
volume = {1},
number = {2},
pages = {3--15}
}
@article{test2,
author = {Bee, Ben},
year = {2011},
title = {Best Title},
url = {www.url.com},
urldate = {2015-05-05},
journal = {Journal},
volume = {1},
number = {2}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
... but it still always prints the urldate
and, if present, also the doi
field. Maybe someone knows a better solution?