20

I've read through alot of entries here with a similar topic (like here or here). The solution does not work for me and I'm kind of deperate now.

That's why I'm asking this question again: How do I suppress the urldate field in biblatex.

I am using Miktex with Biber 2.2.

My MCE (adopted from here):

\documentclass{article}

\usepackage[style=authoryear-icomp]{biblatex}

\AtEveryBibitem{%
\ifentrytype{book}{
    \clearfield{url}%
    \clearfield{urldate}%
}{}
\ifentrytype{collection}{
    \clearfield{url}%
    \clearfield{urldate}%
}{}
\ifentrytype{incollection}{
    \clearfield{url}%
    \clearfield{urldate}%
}{}
}

\usepackage{filecontents}

\begin{filecontents}{test-lit.bib}
@book{Abook,
  author = {AAAAbook, A.},
  year = {2001},
  title = {Alpha},
  url = {tex.stackexchange.com},
}
@online{Bonline,
  author = {BBBBonline, B.},
  year = {2002},
  title = {Bravo},
  url = {tex.stackexchange.com},
}
@collection{Ccollection,
    editor = {CCCCColletionEditor, C.},
    year = {2002},
    title = {Charlie},
    url = {tex.stackexchange.com},
    urldate = {2010-01-01},
}
@incollection{Dincollection,
    author = {DDDDincollection, D.},
    year = {2002},
    crossref = {Ccollection},
    title = {Delta},
    url = {tex.stackexchange.com},
}
\end{filecontents}

\addbibresource{test-lit.bib}

\nocite{*}

\listfiles

\begin{document}

Abc.

\printbibliography

\end{document}

My Document looks like this:

Picture
(source: ahschulz.de)

I am also confused that the urldate is mentioned in the last entry, but there is no urldate in the bib-File.

ahs85
  • 471

2 Answers2

17

According to the comments of moewe, urldate is split up into urlyear, urlmonth and urlday. Removing urlyear solves the problem.

This MCE works:

\documentclass{article}

\usepackage[style=authoryear-icomp]{biblatex}

\AtEveryBibitem{%
\ifentrytype{book}{
    \clearfield{url}%
    \clearfield{urlyear}%
}{}
\ifentrytype{collection}{
    \clearfield{url}%
    \clearfield{urlyear}%
}{}
\ifentrytype{incollection}{
    \clearfield{url}%
    \clearfield{urlyear}%
}{}
}

\usepackage{filecontents}

\begin{filecontents}{test-lit.bib}
@book{Abook,
  author = {AAAAbook, A.},
  year = {2001},
  title = {Alpha},
  url = {tex.stackexchange.com},
}
@online{Bonline,
  author = {BBBBonline, B.},
  year = {2002},
  title = {Bravo},
  url = {tex.stackexchange.com},
}
@collection{Ccollection,
    editor = {CCCCColletionEditor, C.},
    year = {2002},
    title = {Charlie},
    url = {tex.stackexchange.com},
    urldate = {2010-01-01},
}
@incollection{Dincollection,
    author = {DDDDincollection, D.},
    year = {2002},
    crossref = {Ccollection},
    title = {Delta},
    url = {tex.stackexchange.com},
}
\end{filecontents}

\addbibresource{test-lit.bib}

\nocite{*}

\listfiles

\begin{document}

Abc.

\printbibliography

\end{document}
ahs85
  • 471
  • You could also write it shorter (by removing url and urlyear if entry type is not online): \AtEveryBibitem{\ifentrytype{online}{}{\clearfield{url}\clearfield{urlyear}}}. – dexteritas Aug 31 '23 at 10:00
7

Here is a simple solution: use the url=false option of biblatex package.

Citation from biblatex documentation:

url=true,false (default: true)

This option controls whether the url field and the access date is printed. The option only affects entry types whose url information is optional. The url field of @online entries is always printed.

Result:

enter image description here

Code:

\documentclass{article}

\usepackage[style=authoryear-icomp,url=false]{biblatex}

\usepackage{filecontents} \pagestyle{empty}

\begin{filecontents}{test-lit.bib} @book{Abook, author = {AAAAbook, A.}, year = {2001}, title = {Alpha}, url = {tex.stackexchange.com}, } @online{Bonline, author = {BBBBonline, B.}, year = {2002}, title = {Bravo}, url = {tex.stackexchange.com}, } @collection{Ccollection, editor = {CCCCColletionEditor, C.}, year = {2002}, title = {Charlie}, url = {tex.stackexchange.com}, urldate = {2010-01-01}, } @incollection{Dincollection, author = {DDDDincollection, D.}, year = {2002}, crossref = {Ccollection}, title = {Delta}, url = {tex.stackexchange.com}, } \end{filecontents}

\addbibresource{test-lit.bib}

\nocite{*}

\listfiles

\begin{document}

Abc.

\printbibliography

\end{document}

Paul Gaborit
  • 70,770
  • 10
  • 176
  • 283
  • 4
    This will of course remove URLs for everything except @online. For a more fine-grained control one needs either \AtEveryBibitem{\ifentrytype{article}{\clearfield{url}\clearfield{urlyear}}{}} or some version of \AtEveryBibitem{\ifentrytype{article}{\togglefalse{bbx:url}}{}}. – moewe Nov 21 '15 at 13:47