I'm using biblatex
with a custom bibstyle based on the trad-standard
style:
\RequireBibliographyStyle{trad-standard}
In my custom style I redefined some appearances like bold text etc. but now I want to add the urldate
to the output if a URL is given.
I have for example a website as reference. Mendeley exported the resource as @misc
which seems to be correct, but the access date (saved as urldate
) is not showing up.
I now searched the code of the trad-standard
bibstyle and didn't find the urldate
key, so it's quite logical that there is no output. How could I add the functionality of always displaying the urldate
, if a URL and the urldate
is given, no matter what entry type I'm in?
My guess is to renew the doi+eprint+url
macro as it is responsible for the output of the URL. So if I could append the urldate
to the output, it should do what I want. The problem is, that I have no idea how tho append the urldate
to the macro.
Here is my custom .bbx
file:
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% This is a custom bibliography style based on the trad-abbrv style
% by Marco Daniel (2012--2015) and Moritz Wemheuer (2016--).
%
% This package is released under the terms of the
% LaTeX Project Public License v1.3c or later
% See http://www.latex-project.org/lppl.txt
%
% Copyright (c) 2012 -- 2015 Marco Daniel
% 2016 -- Moritz Wemheuer
%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %%%%%%%%%%%%%
% Declare Style
% %%%%%%%%%%%%%
\ProvidesFile{custom-abbrv.bbx}[2017/10/18 v1.0.0 Custom abbrv Bibliography Style]
% %%%%%%%%%%%%%%
% Require Styles
% %%%%%%%%%%%%%%
\RequireBibliographyStyle{trad-standard}
% %%%%%%%%%%%%%
% Basic Options
% %%%%%%%%%%%%%
\ExecuteBibliographyOptions{
abbreviate = false,
arxiv = false
autolang = hyphen,
backref = false,
dateabbrev = true,
eprint = false,
hyperref = true,
labelnumber = true,
maxnames = 3,
minnames = 3,
sorting = none,
}
% %%%%%%%%%%%%%%%%%%%
% trad-abbrv Settings
% %%%%%%%%%%%%%%%%%%%
\@ifpackagelater{biblatex}{2016/03/01}{%
\@ifpackagelater{biblatex}{2016/05/14}{%
\DeclareNameFormat{abbrv}{%
\usebibmacro{name:given-family}%
{\namepartfamily}%
{\namepartgiveni}%
{\namepartprefixi}%
{\namepartsuffixi}%
\usebibmacro{name:andothers}%
}%
}{%
\DeclareNameFormat{abbrv}{%
\nameparts{#1}%
\usebibmacro{name:given-family}%
{\namepartfamily}%
{\namepartgiveni}%
{\namepartprefixi}%
{\namepartsuffixi}%
\usebibmacro{name:andothers}%
}%
}%
}{%
\DeclareNameFormat{abbrv}{%
\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}%
\usebibmacro{name:andothers}%
}%
}%
\DeclareNameAlias{default}{abbrv}
\DeclareFieldFormat{bibentrysetcount}{\mkbibparens{\mknumalph{#1}}}
\DeclareFieldFormat{labelnumberwidth}{\mkbibbrackets{#1}}
\DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}}
\@ifpackagelater{biblatex}{2016/05/14}{%
\defbibenvironment{bibliography}%
{%
\list{%
\printtext[labelnumberwidth]{%
\printfield{labelprefix}%
\printfield{labelnumber}%
}%
}{%
\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}%
}%
\renewcommand*{\makelabel}[1]{\hss##1}%
}
{\endlist}
{\item}%
}{%
\defbibenvironment{bibliography}%
{%
\list{%
\printtext[labelnumberwidth]{%
\printfield{prefixnumber}%
\printfield{labelnumber}%
}%
}{%
\setlength{\labelwidth}{\labelnumberwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}%
}%
\renewcommand*{\makelabel}[1]{\hss##1}%
}%
{\endlist}%
{\item}%
}
\defbibenvironment{shorthands}%
{%
\list{%
\printfield[shorthandwidth]{shorthand}%
}{%
\setlength{\labelwidth}{\shorthandwidth}%
\setlength{\leftmargin}{\labelwidth}%
\setlength{\labelsep}{\biblabelsep}%
\addtolength{\leftmargin}{\labelsep}%
\setlength{\itemsep}{\bibitemsep}%
\setlength{\parsep}{\bibparsep}%
\renewcommand*{\makelabel}[1]{\hss##1}%
}%
}%
{\endlist}%
{\item}%
\DeclareBibliographyDriver{set}%
{%
\entryset%
{%
\ifbool{bbx:subentry}%
{%
\printfield[bibentrysetcount]{entrysetcount}%
\setunit*{\addnbspace}%
}%
{}%
}%
{}%
\newunit\newblock%
\usebibmacro{setpageref}%
\finentry%
}
% %%%%%%%%%%%%%%%%%
% Appearance Styles
% %%%%%%%%%%%%%%%%%
% Name
\renewcommand{\labelnamepunct}{\addcolon\space}
% Title
\DeclareFieldFormat*{title}{\enquote{#1}\isdot}
\DeclareFieldFormat{journaltitle}{\mkbibemph{#1},}
% Volume
\DeclareFieldFormat[article]{volume}{#1}
% Number
\DeclareFieldFormat*{number}{\mkbibparens{#1}}
% Pages
\DeclareFieldFormat*{pages}{\space#1\space}
\renewcommand*{\bibpagespunct}{\addspace}
% Year
\DeclareFieldFormat{date}{\textbf{#1}}
% URL
\DeclareFieldFormat{url}{URL:\space\url{#1}}
% ISSN / ISBN
\DeclareFieldFormat{issn}{ISSN:\space\url{#1}}
\DeclareFieldFormat{isbn}{ISBN:\space\url{#1}}
% DOI
\DeclareFieldFormat{doi}{%
DOI\addcolon\space
\ifhyperref
{\href{http://dx.doi.org/#1}{\nolinkurl{#1}}}
{\nolinkurl{#1}}%
}
% Item Separation
\setlength\bibitemsep{.5\baselineskip}
% Alignment
\AtBeginBibliography{\raggedright}
% %%%%%%%%%%%%%%%%%%%%%%%
% Changes in the position
% %%%%%%%%%%%%%%%%%%%%%%%
% Change the position of the year to be in front of the volume
\renewbibmacro*{journal+issuetitle}{%
\usebibmacro{journal}%
\usebibmacro{date}% Added the date, right after the journal
\newcommaunit*%
\iffieldundef{series}
{}
{%
\newunit
\printfield{series}%
\setunit{\addcomma\space}%
}%
\usebibmacro{volume+number+pages+eid}%
\newcommaunit
% \setunit{\addspace}%
\usebibmacro{issue+date-parens}%
\setunit*{\addcolon\space}%
\usebibmacro{issue}%
\newunit%
}
% Remove the date after the volume
\renewbibmacro*{issue+date-parens}{%
\iffieldundef{issue}%
{%
% \usebibmacro{date}
}%
{%
\printfield{issue}%
\newcommaunit*%
% \usebibmacro{date}
}%
\newunit%
}
\endinput
Best Answer
As it turned out in the comments, the problem is actually a malformed
urldate
field as exported by Mendeley. Allbiblatex
date fields must be written inYYYY-MM-DD
format (ISO 8601/EDTF),DD.MM.YYYY
is not acceptable input and generates a warning:You should definitely contact the Mendeley developers about this.
In the meantime, here is a fix with Biber's sourcemapping
But don't just use it: Complain to the Mendeley people!