This is a follow-up question to biblatex format for online sources. I have the following biblatex configuration file. Thanks to Guido for the inputs. I have also taken some code for the \MakeSentenceCase
from Audrey's answer to Sentence case for titles in biblatex.
\ProvidesFile{biblatex.cfg}
\ExecuteBibliographyOptions{
firstinits=true,
isbn=true,
dashed=false,
eprint=true,
maxbibnames=99,
alldates=long,
doi=true,
uniquename=init
}
\DeclareSourcemap{
\maps[datatype=bibtex]{
\map{
\step[fieldsource=medium, fieldtarget=usera]
\step[fieldsource=urlupdate, fieldtarget=extradate]
}
}
}
\DefineBibliographyStrings{english}{%
references = {Cited References},
}
\DefineBibliographyStrings{english}{%
january = {Jan},
february = {Feb},
march = {Mar},
april = {Apr},
may = {May},
june = {Jun},
july = {Jul},
august = {Aug},
september = {Sep},
october = {Oct},
november = {Nov},
december = {Dec}
}
\NewBibliographyString{available}
\NewBibliographyString{cited}
\DefineBibliographyStrings{english}{%
available = {Available from},
}
% Redefined url+urldate macro
\DeclareFieldFormat{url}{\bibstring{available}\addcolon\space\url{#1}}
\DeclareFieldFormat{urldate}{#1}
\DeclareFieldFormat{urlday}{#1}
\renewbibmacro*{url+urldate}{%
\iffieldundef{urlyear}
{}
% {\setunit*{\addspace}%
% }
{\printtext{[}%
\printtext{cited}\addcolon\space%
\printfield{urlyear}
\mkbibmonth{\thefield{urlmonth}}
\stripzeros{\thefield{urlday}}%
\printtext{].}\space%
\printfield{url}%
}
}
% Change how the publisher, location and dates are printed
\renewbibmacro{publisher+location+date}{
\iflistundef{publisher}
{}
{\printtext{}%
\iflistundef{location}
{}
{\printlist{location}}%
\printtext{\addcolon\space}%
\printlist{publisher}%
\printtext{\addsemicolon\space}
}
}
% Remove parentheses around dates
\renewbibmacro*{date+extrayear}{%
\iffieldundef{year}
{}
{\printtext{%
\addperiod\space\printfield{labelyear}%
\printfield{extrayear}}}}
% Print last name first before first name
\renewbibmacro*{title}{%
\ifboolexpr{
test {\iffieldundef{title}}
and
test {\iffieldundef{subtitle}}
}
{}
{\printtext[title]{%
\printfield[titlecase]{title}%
\setunit{\subtitlepunct}%
\printfield[titlecase]{subtitle}
\setunit{}%
\iffieldundef{usera}
{}
{\printtext{[}\printfield{usera}\printtext{]}}}%
\newunit}%
\printfield{titleaddon}}
\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first} % for good measure, changes that of the editor and others
\renewcommand{\bibinitperiod}{}
\renewcommand{\bibinitdelim}{}
\DeclareFieldFormat{title}{#1}
\DeclareFieldFormat{titlecase}{\MakeTitleCase{#1}}
\newrobustcmd{\MakeTitleCase}[1]{%
\ifthenelse{\ifcurrentfield{booktitle}\OR\ifcurrentfield{booksubtitle}%
\OR\ifcurrentfield{maintitle}\OR\ifcurrentfield{mainsubtitle}%
\OR\ifcurrentfield{journaltitle}\OR\ifcurrentfield{journalsubtitle}%
\OR\ifcurrentfield{issuetitle}\OR\ifcurrentfield{issuesubtitle}%
\OR\ifentrytype{book}\OR\ifentrytype{mvbook}\OR\ifentrytype{bookinbook}%
\OR\ifentrytype{booklet}\OR\ifentrytype{suppbook}%
\OR\ifentrytype{collection}\OR\ifentrytype{mvcollection}%
\OR\ifentrytype{suppcollection}\OR\ifentrytype{manual}%
\OR\ifentrytype{periodical}\OR\ifentrytype{suppperiodical}%
\OR\ifentrytype{proceedings}\OR\ifentrytype{mvproceedings}%
\OR\ifentrytype{reference}\OR\ifentrytype{mvreference}%
\OR\ifentrytype{report}\OR\ifentrytype{thesis}}
{#1}
{\MakeSentenceCase{#1}}}
%% What actually prints the bibliography entry.
\DeclareBibliographyDriver{online}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\usebibmacro{author/translator+others}%
\setunit{\labelnamepunct}\newblock
\usebibmacro{title}%
\newunit
\printlist{language}%
\newunit\newblock
\usebibmacro{byauthor}%
\newunit\newblock
\usebibmacro{bytranslator+others}%
\newunit\newblock
\printfield{version}%
\newunit\newblock
\usebibmacro{publisher+location+date}
\newunit\newblock
\usebibmacro{url+urldate}
\usebibmacro{finentry}}
\endinput
Now, consider the following MWE:
\documentclass[10pt]{article}
\usepackage[style=authoryear,backend=biber]{biblatex}
\usepackage{lipsum}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@online{kruse,
author = {John S. Kruse},
title = {Framework for Sustainable Soil Management: Literature Review and Synthesis},
year = {2007},
url = {http://www.swcs.org/documents/filelibrary/BeyondTliteraturereview.pdf},
publisher= {Soil and Water Conservation Society},
location={Ankeny (IA)},
urldate = {2008-08-03},
medium = {Internet},
}
@online{cois,
author={},
title = {Canadian Soil Information Service},
medium = {Internet},
location = {Ottawa (ON)},
publisher = {Agriculture and Agri-Food Canada},
urldate = {2010-06-30},
url = {http://sis.agr.gc.ca/cansis/},
}
\end{filecontents}
\addbibresource{\jobname.bib}
\begin{document}
\lipsum[1]
\nocite{*}
\printbibliography
\end{document}
For the first bibliography entry, I want to be able to put a field urlupdate
in my .bib
file which maps to the extradate field. I want to be able to use the extradate field to come up with something like
Canadian soil information service [Internet]. 2010. Ottawa (ON): Agriculture and Agri‐Food Canada; [updated 2010 May 19; cited 2010 June 30]. Available from: http://sis.agr.gc.ca/cansis/
when urlupdate is declared and
Canadian soil information service [Internet]. 2010. Ottawa (ON): Agriculture and Agri‐Food Canada; [cited 2010 June 30]. Available from: http://sis.agr.gc.ca/cansis/
when it is not.
The answer must be somewhere in the biblatex manual but it is very hard to look for it. I have been at this problem for the past 2 hours.