[Tex/LaTex] biblatex format for online sources

biblatex

The Council of Science Editors Name-Year Citation Style prescribes the following format for online documents:

Author(s). Date of publication. Title [medium designator]. Edition. Place of Publication: Publisher; [date update; date cited]. Available from: URL.

Here, "medium designator" maybe microfiche, CD-ROM, DVD, or Internet.

For online documents, the medium designator "Internet" applies.

Here is an example.

Kruse JS. 2007. Framework for sustainable soil management: literature review and synthesis [Internet]. Ankeny (IA): Soil and Water Conservation Society; [cited 2008 Aug 3]. Available from: http://www.swcs.org/documents/filelibrary/BeyondTliteraturereview.pdf

The bibliography entry has at least the following format.

  1. The title is not italicized and in sentence format.
  2. There are no dots after the initials of the author(s).

Putting all together the guides and some answers to posts I found in this site, notably Guidelines for customizing biblatex styles, I have the following biblatex.cfg

\ProvidesFile{biblatex.cfg}

\ExecuteBibliographyOptions{
firstinits=true,
isbn=true,
dashed=false,
eprint=true,
maxbibnames=99,
alldates=long,
doi=true,
uniquename=init
}

\DefineBibliographyStrings{english}{%
  references = {Cited References},
}

\NewBibliographyString{available}
\NewBibliographyString{cited}

\DefineBibliographyStrings{english}{%
  available = {Available from},
}


% Redefined url+urldate macro

\DeclareFieldFormat{url}{\bibstring{available}\addcolon\space\url{#1}}
\DeclareFieldFormat{urldate}{#1}

\renewbibmacro*{url+urldate}{%
  \iffieldundef{urlyear}
    {}
    {\setunit*{\addspace}%
     }
  \printtext{[}%
  \printtext{cited}\addcolon\space%
    \printurldate
  \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

\DeclareNameAlias{sortname}{last-first}
\DeclareNameAlias{default}{last-first} % for good measure, changes that of the editor and others

\DeclareFieldFormat{title}{#1}

\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

Here are a minum working .tex file and an output.

\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},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\lipsum[1]
\nocite{*}
\printbibliography

\end{document}

Now to my questions. (I can't separate the questions in this case. Please bear with me.)

  1. How do I remove the dots after the initials; and,
  2. How can I automatically put a medium designator right after the title, before the period?
  3. And how can I write the urldate as 2008 Aug 3?
  4. I've seen somewhere how to make the titles in sentence case but I can't find it anymore. Can someone please point me to it? 🙂

Answers may be partial. But of course if someone can give a full solution then that is preferred.

Note: This is related to a previous post: Biblatex Style or Package for Council of Science Editors Citation Format

enter image description here

Best Answer

For 1. The period after the initial can be remove by \renewcommand{\bibinitperiod}{}

For 2, you can introduce a new field medium in your bibtex entries, and the use a source map (supported by recent biber and biblatex)

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=medium, fieldtarget=usera]
    }
  }
}

and then add the appropriate instruction, for example

\iffieldundef{usera}
  {}
  {\printtext{[}\printfield{usera}\printtext{]}}

at the right place in the online driver

For 3: To change the format of the urldate you can replace \printurldate in the url+urldate bibmacro with

\printfield{urlyear} \mkbibmonth{\thefield{urlmonth}} \stripzeros{\thefield{urlday}}

Notice that biblatex include a period at the end of the abbreviations for the months. To remove it one has to declare

\DeclareBibliographyStrings{%
   january = {Jan}, 
   ...
}

For 4: To transform some text in "sentence case" you can use \MakeSentenceCase{text} or \MakeSentenceCase*{text}

Related Question