11

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.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Reinstate Monica - M. Schröder Nov 18 '15 at 17:52
  • 1
    \clearfield{urlyear} should do it (date fields are broken apart internally, at which point only the date parts exists). The urldate in Dincollection is inherited from Ccollection via the crossref feature. – moewe Nov 18 '15 at 17:56
  • You can use \AtEveryBibitem{% \ifboolexpr{ test {\ifentrytype{book}} or test {\ifentrytype{collection}} or test {\ifentrytype{incollection}} } {\clearfield{url}% \clearfield{urlyear}} {}} (modulo line breaks) – moewe Nov 18 '15 at 17:56
  • Note that Marco Daniel's answer (here) uses the correct urlyear while the other answer uses urldate, the fact that there are quite some (accepted) answers out here that use urldate makes me think that this once worked, but doesn't any more. – moewe Nov 18 '15 at 17:59
8

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}
  • Please note that urldate is not deprecated, it is just that internally, at a biblatex level, there is no such field as urldate, there are only urlyear, urlmonth, urldate. (In the .bib file you still should use urldate = {2015-10-10}) You will also find that the code still doesn't work, because it uses \clearfield{urldate} and not \clearfield{urlyear}. – moewe Nov 19 '15 at 8:41
  • Ah, ok! I'll edit the answer. – ahs85 Nov 19 '15 at 10:22
  • The code still doesn't work though. You need \clearfield{urlyear}, \clearfield{urldate} will not do. – moewe Nov 19 '15 at 10:35
  • My bad! Edited! – ahs85 Nov 19 '15 at 15:24
6

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}
  • 1
    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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.