2

So this might be a bit specific of a question, but I need BibLaTeX to output dates in the long DMY format - dd.mm.yyyy that is.

BibLaTeX documentation states that one can achieve dd/mm/yyyy by using the date = terse setting.

However, I'd like to have the date separator to be a dot instead of a slash. I didn't find any easy way to do this while browsing through the documentation.

Here's an MWE (and its output) on what I'm working on, roughly. I have been modifying the style = chem-rsc package to fit my needs (or rather my Uni's requirements), but I've omitted those changes here for they are irrevelent in this case.

\documentclass[a4paper,12pt,british]{article}

\usepackage[T1]{fontenc} 
\usepackage[utf8]{inputenc}
\usepackage[labelfont=bf]{caption}
\usepackage[british]{babel}
\usepackage{filecontents}
\usepackage{csquotes}

\usepackage[backend=biber,
    style     = chem-rsc,
    autocite  = superscript,
    autopunct = true,
    sorting   = none,
    sortcites = true,
    eventdate = terse,
    datezeros = true,]{biblatex}

\begin{filecontents}{viitteet.bib}
@inproceedings{othusitse2015,
    author      = {Nhlanhla Othusitse and Edison Muzenda},
    title       = {Predictive Models of Leaching Processes: A Critical Review},
    booktitle   = {7th Int. Conf. on Latest Trends in Engineering \& Technology},
    location    = {Irene, Pretoria, South Africa},
    eventdate   = {2015-11-26/2015-11-27},
    pages       = {136--141},
}
\end{filecontents}

\addbibresource{viitteet.bib}

\begin{document}

\section{Section}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\supercite{othusitse2015}

\printbibliography

\end{document}

enter image description here

EDIT:

I tried tinkering with something like this...

\DefineBibliographyExtras{british}{%
    \renewrobustcmd*{\bibdatesep}{\adperiod}
}

... but to no avail.

2
  • 1
    Welcome! Does it work with the default styles? That is, if you just have \usepackage{biblatex} without changing the defaults, do you get the right separator in that case? Obviously not a solution, but it will tell you if the problem is in the \DefineBibliographyExtras or something the style/options are doing. If it works with the default, experiment to isolate the option causing the issue. (Probably the style, but worth checking.) – cfr Oct 27 '19 at 17:55
  • Thanks for the tip, but the default formatting for British English turns out as (26th-27th Nov. 2015) – Joni Niskanen Oct 28 '19 at 9:01
1

Following moewes answer here, you can copy the date formatting macros from a language definition file, that has the desired date format, i.e. german.lbx:

\documentclass[a4paper,12pt,british]{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[labelfont=bf]{caption}
\usepackage[british]{babel}
\usepackage{filecontents}
\usepackage{csquotes}

\usepackage[backend=biber,
    style     = chem-rsc,
    autocite  = superscript,
    autopunct = true,
    sorting   = none,
    sortcites = true,
    eventdate = terse,
    datezeros = true,]{biblatex}

\DefineBibliographyExtras{british}{%
\protected\def\mkbibdatelong#1#2#3{%
    \iffieldundef{#3}
      {}
      {\mkbibordinal{\thefield{#3}}%
       \iffieldundef{#2}{}{\nobreakspace}}%
    \iffieldundef{#2}
      {}
      {\mkbibmonth{\thefield{#2}}%
       \iffieldundef{#1}{}{\space}}%
    \iffieldbibstring{#1}
      {\bibstring{\thefield{#1}}}
      {\dateeraprintpre{#1}\stripzeros{\thefield{#1}}}}%
  \protected\def\mkbibdateshort#1#2#3{%
    \iffieldundef{#3}
      {}
      {\mkdayzeros{\thefield{#3}}\adddot
       \iffieldundef{#2}{}{\thinspace}}%
    \iffieldundef{#2}
      {}
      {\mkmonthzeros{\thefield{#2}}%
       \iffieldundef{#1}
         {}
         {\iffieldundef{#3}{/}{\adddot\thinspace}}}%
    \iffieldbibstring{#1}
      {\bibstring{\thefield{#1}}}
      {\dateeraprintpre{#1}\mkyearzeros{\thefield{#1}}}}%
}

\begin{filecontents}{viitteet.bib}
@inproceedings{othusitse2015,
    author      = {Nhlanhla Othusitse and Edison Muzenda},
    title       = {Predictive Models of Leaching Processes: A Critical Review},
    booktitle   = {7th Int. Conf. on Latest Trends in Engineering \& Technology},
    location    = {Irene, Pretoria, South Africa},
    eventdate   = {2015-11-26/2015-11-27},
    pages       = {136--141},
}
\end{filecontents}

\addbibresource{viitteet.bib}

\begin{document}

\section{Section}

Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.\supercite{othusitse2015}

\printbibliography

\end{document}

enter image description here

1
  • 1
    This is exactly what I needed. Many thanks, DG'! – Joni Niskanen Oct 28 '19 at 9:08

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.