5

In my example below, I would like to change the appearance of the URL access date. Rather than the date being typed numerically like

(accessed 2013-09-01).

I would like the month to be written in full and displayed like this

(accessed 01 September 2013).

MWE:

\documentclass[twocolumn]{article}
\usepackage[style=authoryear,maxcitenames = 2,mincitenames = 1,maxbibnames = 99,minbibnames = 1,dashed = false,firstinits=true,backend=biber]{biblatex}  
% !BIB TS-program = biber     
%^ line above is necessary to tell TeXShop to use Biblatex rathern than traditional BibTex.
\usepackage[utf8]{inputenc}    % utf8 support       
\usepackage[T1]{fontenc}       % code for pdf file  % w/out these two lines, I get the warning, "WARN - The entry '_______' has characters which cannot be encoded in 'ascii'. Recoding problematic characters into macros.

\usepackage{filecontents}
\begin{filecontents}{Test.bib}    
@unpublished{usgs_gmted_data,
Author = {{United States Geological Survey}},
Title = {USGS Global Multi-resolution Terrain Elevation Data (GMTED) product},
Url = {http://topotools.cr.usgs.gov/gmted_viewer/},
urldate = {2013-09-01}, 
urlmonth = {September},                    % Added                                
Year = {2010}}
\end{filecontents}
\addbibresource{Test.bib}

% Add the text, "Available at:" prior to URL and "accessed" afterward in parentheses.
\DefineBibliographyStrings{english}{%          
urlseen = {accessed}
}
\DefineBibliographyStrings{english}{%
urlseen = {accessed},
url = {Available at:}
}
\DeclareFieldFormat{url}{\bibstring{url}\space\url{#1}}

% Prevent Italics for booktitle in these data types 
\DeclareFieldFormat
[article,book,manual,misc,software,unpublished]
{booktitle}{#1}

 % Remove quotations around the following titles.
\DeclareFieldFormat[article,book,collection,incollection,manual,misc,
periodical,proceedings,report,thesis,software,unpublished]{title}{#1} 

%% =================================================
\begin{document}
Test cite \parencite{usgs_gmted_data}.

\nocite{*}
\printbibliography
\end{document} 

The citation looks like this:

United States Geological Survey (2010) USGS Global Multi-resolution Terrain Elevation Data (GMTED) product. Available at: http://topotools.cr.usgs.gov/gmted_viewer/ (accessed 09/01/2013).

But I'd like it to look like this:

United States Geological Survey (2010) USGS Global Multi-resolution Terrain Elevation Data (GMTED) product. Available at: http://topotools.cr.usgs.gov/gmted_viewer/ (accessed 01 September 2013).

6
  • 1
    Have you tried with the option urldate=long, i.e., \usepackage[...,urldate=long,...]{biblatex}
    – Guido
    Commented Aug 13, 2015 at 21:29
  • @ Guido, you're suggestion is close to what I want. It shows (accessed Sept. 1, 2013). When I alter my .bib file to include the field urlmonth = {September}, your suggestion prints (accessed September 1, 2013), which is almost exactly what I want.
    – Edward
    Commented Aug 13, 2015 at 21:32
  • 1
    Add the dateabbrev=false option.
    – Guido
    Commented Aug 13, 2015 at 21:38
  • Adding dateabbrev=false doesn't alter it. If I remove the urldate=long while keeping dateabbrev=false, it prints out this, (accessed September/01/2013).
    – Edward
    Commented Aug 13, 2015 at 21:42
  • In the bibtex record, the value of month you should use either a number or a 3-letter abbreviation
    – Guido
    Commented Aug 13, 2015 at 21:53

2 Answers 2

8

Apart from urldate=long and dateabbrev=false option, you need some bibliography extras similar to those for australian language, but you needn't to strip leading zeroes from numbers.

So, you can add the following lines to your preamble (code taken and modified from australian.lbx):

\DefineBibliographyExtras{english}{%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#3}
      {}
      {\thefield{#3}%
       \iffieldundef{#2}{}{\nobreakspace}}%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
    \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}%
}

Note that you don't have the need to write specific urlmonth and urlday in your .bib file.

MWE:

\documentclass[twocolumn]{article}
\usepackage[style=authoryear,
            maxcitenames = 2,
            mincitenames = 1,
            maxbibnames = 99,
            minbibnames = 1,
            dashed = false,
            firstinits=true,
            urldate=long,
            dateabbrev=false,
            backend=biber]{biblatex}

% !BIB TS-program = biber
%^ line above is necessary to tell TeXShop to use Biblatex rathern than traditional BibTex.
\usepackage[utf8]{inputenc}    % utf8 support
\usepackage[T1]{fontenc}       % code for pdf file  % w/out these two lines, I get the warning, "WARN - The entry '_______' has characters which cannot be encoded in 'ascii'. Recoding problematic characters into macros.

\usepackage{filecontents}
\begin{filecontents}{Test.bib}
@unpublished{usgs_gmted_data,
Author = {{United States Geological Survey}},
Title = {USGS Global Multi-resolution Terrain Elevation Data (GMTED) product},
Url = {http://topotools.cr.usgs.gov/gmted_viewer/},
urldate = {2013-09-01},
Year = {2010}}
\end{filecontents}
\addbibresource{Test.bib}

% Add the text, "Available at:" prior to URL and "accessed" afterward in parentheses.
\DefineBibliographyStrings{english}{%
urlseen = {accessed}
}
\DefineBibliographyStrings{english}{%
urlseen = {accessed},
url = {Available at:}
}
\DeclareFieldFormat{url}{\bibstring{url}\space\url{#1}}

% Prevent Italics for booktitle in these data types
\DeclareFieldFormat
[article,book,manual,misc,software,unpublished]
{booktitle}{#1}

 % Remove quotations around the following titles.
\DeclareFieldFormat[article,book,collection,incollection,manual,misc,
periodical,proceedings,report,thesis,software,unpublished]{title}{#1}

\DefineBibliographyExtras{english}{%
  \protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#3}
      {}
      {\thefield{#3}%
       \iffieldundef{#2}{}{\nobreakspace}}%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
    \iffieldbibstring{#1}{\bibstring{\thefield{#1}}}{\stripzeros{\thefield{#1}}}}%
}

%% =================================================
\begin{document}
Test cite \parencite{usgs_gmted_data}.

\nocite{*}
\printbibliography
\end{document} 

Output:

enter image description here

3
  • Very helpful and I appreciate the clarification regarding what's necessary in the .bib file.
    – Edward
    Commented Aug 14, 2015 at 14:12
  • @user76245 You're welcome. Commented Aug 17, 2015 at 15:53
  • Perhaps it would be better to replace \thefield{#3} with \stripzeros{\thefield{#3}} since 1 July 2018 looks better than 01 July 2018. Commented Nov 5, 2018 at 20:28
4

The format of the urldate is controlled by the urldate options, for a long date, use the long option. The second option to set is whether abbreviations are used, i.e., dateabbrev=false.

Finally, to achieve the British date format, one has to set language=british.

With the above options, i.e.,:

\usepackage[style=authoryear,
  maxcitenames = 2,
  mincitenames = 1,
  maxbibnames = 99,
  minbibnames = 1,
  dashed =false,
  firstinits=true,
  backend=biber,
  urldate=long,
  dateabbrev=false,
  language=british]{biblatex}    

the MWE provided in the OP produces:

enter image description here

1
  • Is there a way to alter 1st to 01? In my .bib file, I tried urlday = {{01}}, but it prints 010th rather than what I hoped / need.
    – Edward
    Commented Aug 13, 2015 at 22:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .