2

In my bibliography, which is created using biblatex, I want to write the full date on which I have accessed the URL. For some reason only the year is shown, but not the full date. "urldate=long" is not working. Could you please help?

I have the following entry in my quellen.bib-file:

@Online{      MyOnline,
  Title       = {Title of Page},
  URL         = {http://www.somesite.com},
  URLDate     = {2016-06-15}
}

In my main.tex document I have:

\documentclass[twoside,a4paper,draft=true]{scrbook}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[backend=biber,bibstyle=nature,citestyle=nature]{biblatex}
\ExecuteBibliographyOptions{
    sorting=none, 
    bibwarn=true,
    isbn=true,
    url=true,
    urldate=long,
    maxnames=20
}
\addbibresource{quellen.bib}
\begin{document}

\cite{MyOnline}

\printbibliography

\end{document}
  • Can you give us code we can compile to reproduce, using the standard .bbx if possible? – cfr Sep 12 '16 at 22:59
  • @cfr : I modified the question so that the code could can be run. I replaced the bbx to the standard bbx, as well. – anemal Sep 13 '16 at 0:21
  • It appears the option is not supported by the nature style. It works in the standard case. – cfr Sep 13 '16 at 1:17
  • 1
    Note that your \DeclareNameFormat{default} code is going to break with biblatex versions >= 3.3 (see Biblatex 3.3 name formatting). I suspect you could get close to what you want with \DeclareNameAlias{default}{given-family} and the giveninits=true option. Alternatively, the code should probably look like \DeclareNameFormat{default}{% \usebibmacro{name:given-family} {\namepartfamily} {\namepartgiveni} {\namepartprefix} {\namepartsuffix}% \usebibmacro{name:andothers}%} (mod line breaks) – moewe Sep 13 '16 at 7:35
  • I'll update the style on CTAN shortly to address this: I think the option post-dates writing the style! – Joseph Wright Sep 13 '16 at 8:04
2

The nature style defines @online to only typeset the year, regardless of options. To get long dates in this entry type without changing the style, therefore, we need to redefine the relevant Biblatex 'driver' and replace Biblatex's standard formatting for the URL and date.

For example,

\documentclass[twoside,a4paper,draft=true]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[ngerman]{babel}
\usepackage[babel,german=quotes]{csquotes}
\usepackage[backend=biber,bibstyle=nature,citestyle=nature,sorting=none,bibwarn=true,isbn=true,url=true,maxnames=20,urldate=long]{biblatex}
\DeclareBibliographyDriver{online}{% modified from biblatex-nature's bbx
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\labelnamepunct}\newblock
  \usebibmacro{title}%
  \newunit
  \printlist{language}%
  \newunit\newblock
  \usebibmacro{byauthor}%
  \newunit\newblock
  \usebibmacro{byeditor+others}%
  \newunit\newblock
  \printfield{version}%
  \newunit
  \printfield{note}%
  \newunit\newblock
  \printlist{organization}%
  \newunit\newblock
  \iftoggle{bbx:eprint}
    {\usebibmacro{eprint}}
    {}%
  \newunit\newblock
  \usebibmacro{url+urldate}% from Biblatex's standard.bbx
  \newunit\newblock
  \usebibmacro{addendum+pubstate}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \usebibmacro{related}%
  \usebibmacro{finentry}%
}

\addbibresource{\jobname.bib}
\begin{document}

\cite{MyOnline}

\printbibliography

\end{document}

long date for URL

  • It's always tricky deciding what to do with things that the 'model' doesn't use: Nature don't print the full date and I think one can argue things either way! That said, I'll probably look at this again. – Joseph Wright Sep 13 '16 at 5:50
  • @JosephWright Maybe you could set the urldate option to a format that only prints the year, so people can easily get out of that by overriding urldate; in that case you could use the standard url+urldate macro. ... But something would have to be done about using year instead of urlyear if the latter is not defined. – moewe Sep 13 '16 at 7:32
  • @cfr Thanks this is exactly what I wanted. However, I moved this DeclareBibliographyDriver block in my own bbx instead of doing this in the main.tex document. – anemal Sep 13 '16 at 11:41
  • @anemal Just remember to incorporate any changes if the default one gets updated. (See JW's comment above ;).) – cfr Sep 13 '16 at 20:22

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.