6

I know I can print the current month (or day) as an integer with month (or day).

How can I make use of the localisation information to print it as a string?

03 -> March

EDIT: Added a MWE

.bib file:

@ONLINE{IPAustraliaStandardPatentApplication,
    author = {{IP Australia}},
    title = {Standard patent application process | IP Australia},
    year = 2013,   
    note = {http://www.ipaustralia.gov.au/get-the-right-ip/patents/patent-application-process/standard-patent-application-process/}, 
    urldate = {2013-05-21},
}

macro:

% URL Dates
\renewbibmacro*{urldate}{%
    \printtext[parens]{%
      \printfield{urlday}%
      \setunit*{\addspace}%
      \printfield{urlmonth}%
      \setunit*{\addspace}%
      \printfield{urlyear}%
    }%
    \newunit%
}   

I want urlmonth to be printed as, eg, May.

  • You've added the biblatex tag, but it sounds like you're asking for a solution that allows you to print the name of the current month anywhere in the document, right? – Jake May 23 '13 at 2:55
  • If you are talking about the bibliography, then this is automatic: as long as the month is an integer, biblatex automatically localises the month based on the babel settings or language option. – PLK May 23 '13 at 3:44
  • Jake - actually, I'm only interested in the bibliography. @PLK - it doesn't appear to be doing so. I'm getting the actual integer printed out in my bibliography when I do \printfield{month} – sapi May 23 '13 at 4:36
  • 1
    For future reference, it would be helpful if you can construct a minimal working example (MWE) that community members can copy-and-paste to start working on a solution. – Werner May 23 '13 at 5:38
  • 1
    In that case we will need a MWE as this looks more like a biblatex localisation issue. – PLK May 23 '13 at 9:41
3

The answer is very simple: the formatting of the urldate in the bibliography is controlled by the urldate option of the biblatex package. Thus

\documentclass{article}

\usepackage[backend=biber,urldate=comp]{biblatex}

\addbibresource{test.bib}

\begin{document}

Test 1 \cite{IPAustraliaStandardPatentApplication}

\printbibliography

\end{document}

will produce the desired output (converting urlmonth to a word), assuming your bibliography is in test.bib. For more options consult section page 60 of section 3.1.2.1 of the biblatex manual.


Update: To change the exact format of the date you have to modify the definitions of the mkbibdatelong macro. This is defined in the language specific files, so in your case english.lbx (assuming you write in english).

To avoid modifying those you can do the redefining in your preamble. Below I include code which should print the date in the format "21 May, 2013". I have not tested all the corner cases, such as day but no month, etc.

\documentclass{article}

\usepackage[backend=biber,urldate=comp]{biblatex}

\AtBeginDocument{
    \protected\def\mkbibdatelong#1#2#3{% y/m/d 
    % taken from english.lbx
        \iffieldundef{#3} %day
          {}
          {\stripzeros{\thefield{#3}}\space}%
          \iffieldundef{#2} %month
          {}
          {\mkbibmonth{\thefield{#2}}%
           \iffieldundef{#3}
             {\iffieldundef{#1}{}{\space}}
         {,\nobreakspace}}%
             %\iffieldundef{#1}{}{,\space}
        \stripzeros{\thefield{#1}} %year
    }%
}


\addbibresource{test.bib}

\begin{document}

Test 1 \cite{IPAustraliaStandardPatentApplication}


\printbibliography

\end{document}
  • Thanks - that's got me almost there. One thing left - the format (when using \printurldate) is currently, eg, August 15, 2011. How can I swap this so that it becomes 15 August, 2011? – sapi May 24 '13 at 23:12
  • @sapi see the updated answer, I hope that is what you were looking for. – ach May 25 '13 at 9:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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