Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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}

enter image description here

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.

share|improve this question
add comment

2 Answers 2

up vote 7 down vote accepted

Using biblatex 2.0/biber 1.0, you can change the datamodel. Simply add this to a file "biblatex-dm.cfg" somewhere latex can find it:

\DeclareDatamodelFields[type=field, datatype=date, skipout]{urlupdate}
\DeclareDatamodelFields[type=field, datatype=integer]{
  urlupday,
  urlupendday,
  urlupendmonth,
  urlupendyear,
  urlupmonth,
  urlupyear}

\DeclareDatamodelEntryfields{
  urlupday,
  urlupendday,
  urlupendmonth,
  urlupendyear,
  urlupmonth,
  urlupyear}

Then you can use the field "urlupdate" in your .bib files just like any of the other date fields and the split fields "urlupday" etc. will be in your .bbl and you can check for these in your biblatex formatting as with any other field.

share|improve this answer
    
That went smoothly. That was in the manual, alright. But I wasn't able to understand it until now :) –  hpesoj626 Oct 11 '12 at 14:54
add comment

A possibility would be to use urldate with a range value, i.e., YYYY-MM-dd/YYYY-MM-dd where the first date is mandatory and it is used for the cited value, and the second for the updated value. Then you can use field urlendyear, urlendmonth, urlendday to refer to the update values.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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