3

I am struggling to re-create the format required for the bibliography in a variation of the Harvard style. This is an example of an online article:

Elliott, L. (2008) Economic slowdown and tax breaks put the government in the red. Guardian [Internet], 20 November. Available from: <http://www.guardian.co.uk/business> [Accessed 19 November 2007].

Using the minimal example below, I manage to create the following:

Elliott, L. (2008). Economic slowdown and tax breaks put the government in the red. Guardian. [Internet] (20th Nov. 2008). Available from: <http://www.guardian.co.uk/business> [Accessed 19th Nov. 2017].

Looking at the differences, I have a few questions:

  1. How to print the date in day-month format as shown without the year and the surrounding parentheses?
  2. How to remove the periods after the label year and after the journal name?
  3. How to connect the journal and the date with a comma?

Here is a minimal example:

\begin{filecontents}{test.bib}
@article{test,
  author = {L. Elliott},
  title = {Economic slowdown and tax breaks put the government in the red},
  journal = {Guardian},
  date = {2008-11-20},
  url = {http://www.guardian.co.uk/business},
  urldate = {2017-11-19}
}
\end{filecontents}

\documentclass{article}
\usepackage{times}
\usepackage{csquotes}
\usepackage[british]{babel}
\usepackage[
  style=authoryear,
  mergedate=false,
  urldate=long
]{biblatex}
\addbibresource{test.bib}

\NewBibliographyString{available}
\NewBibliographyString{internet}
\DefineBibliographyStrings{english}{%
  urlseen = {Accessed},
  available = {Available from},
  internet = {[Internet]}
}
\DeclareFieldFormat[article]{title}{#1}
\renewbibmacro{in:}{}
\DeclareFieldFormat[article]{journaltitle}{\textbf{#1}\space\bibstring{internet}}
\DeclareFieldFormat{url}{\bibstring{available}\addcolon\space$<$\url{#1}$>$}
\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}\space#1}}
\urlstyle{same}

\begin{document}
\nocite{*}
\printbibliography
\end{document}
2
  • Please consider asking only one thing per question in the future. That makes it easier to answer your question, which means that you are likely to get good answers more quickly. It also helps people with a similar problem find relevant help more easily. See tex.meta.stackexchange.com/q/7425/35864
    – moewe
    Commented Jun 5, 2018 at 9:18
  • Also DeclareFieldFormat[article]{journaltitle}{\textbf{#1}\space\bibstring{internet}} looks a bit dangerous to me: It effectively turns all @articles into online articles.
    – moewe
    Commented Jun 5, 2018 at 9:19

1 Answer 1

2

For the main part of your question (the month-day-only date) you need to define a new date format. That is necessary because the standard date formats always check if a year is present: They won't print anything if there is no year. So we can't simply say \clearfield{year}\printdate and enjoy a date without year. The code below implements the two ned date formats daymonthlong and daymonthshort based on the long and short date formats. Output for date ranges will likely be confusing or outright wrong.

The other two issues are fairly boring changes to standard macros. See the code below.

%\RequirePackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{test,
  author = {L. Elliott},
  title = {Economic slowdown and tax breaks put the government in the red},
  journal = {Guardian},
  date = {2008-11-20},
  url = {http://www.guardian.co.uk/business},
  urldate = {2017-11-19}
}
\end{filecontents}

\documentclass{article}
\usepackage{csquotes}
\usepackage[british]{babel}
\usepackage[
  style=authoryear,
  mergedate=false,
  urldate=long,
  dateabbrev=false,
]{biblatex}
\addbibresource{\jobname.bib}

\NewBibliographyString{available}
\NewBibliographyString{internet}
\DefineBibliographyStrings{english}{%
  urlseen = {Accessed},
  available = {Available from},
  internet = {[Internet]}
}
\DeclareFieldFormat[article]{title}{#1}
\renewbibmacro{in:}{}
\DeclareFieldFormat[article]{journaltitle}{\textbf{#1}\setunit{\space}\bibstring{internet}}
\DeclareFieldFormat{url}{\bibstring{available}\addcolon\space$<$\url{#1}$>$}
\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibstring{urlseen}\space#1}}


\renewbibmacro*{issue+date}{%
  \printfield{issue}%
  \setunit*{\addspace}%
  \usebibmacro{date}%
  \newunit}

\makeatletter
\newrobustcmd*{\mkdaterangedaymonth}[2]{%
  \begingroup
    \blx@metadateinfo{#2}%
    \iffieldundef{#2year}
      {}
      {\printtext[#2date]{%
         \datecircaprint
         % Such a season component can only come from an ISO8601 season which replaces
         % a normal month so if it exists, we know that a normal date print is ruled out
         \iffieldundef{#2season}
           {\csuse{mkbibdate#1}{}{#2month}{#2day}%
            % Optionally print the time after the date
            \blx@printtime{#2}{}}
           {\csuse{mkbibseasondate#1}{}{#2season}}%
         \dateuncertainprint
         \dateeraprint{#2year}%
         \iffieldundef{#2endyear}
           {}
           {\iffieldequalstr{#2endyear}{}
              {\mbox{\bibdaterangesep}}
              {\bibdaterangesep
               \enddatecircaprint
               \iffieldundef{#2season}
                 {\csuse{mkbibdate#1}{#2endyear}{#2endmonth}{#2endday}%
                  % Optionally print the time after the date
                  \blx@printtime{#2}{end}}
                 {\csuse{mkbibseasondate#1}{#2endyear}{#2endseason}}%
               \enddateuncertainprint
               \dateeraprint{#2endyear}}}}}%
  \endgroup}

\newcommand*{\mkdaterangedaymonthlong}{\mkdaterangedaymonth{long}}
\newcommand*{\mkdaterangedaymonthshort}{\mkdaterangedaymonth{short}}
\makeatother

\ExecuteBibliographyOptions{date=daymonthlong}

\DeclareDelimFormat[bib,biblist]{nametitledelim}{\addspace}

\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\addspace}%
  \iffieldundef{series}
    {}
    {\newunit
     \printfield{series}%
     \setunit{\addspace}}%
  \usebibmacro{volume+number+eid}%
  \setunit{\addcomma\space}%
  \usebibmacro{issue+date}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \newunit}

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

enter image description here

2
  • This is exactly what I need, thank you! Makes me wonder if there is a shorter way to change the date format though. Commented Jun 5, 2018 at 12:19
  • @KungPaoChicken Not that I know of. All standard date formats print the year and bail out if it is not defined, so you can't trick biblatex into printing the date without year by deleting it. Naturally, the code could have been made shorter by not relying on standard macros and by hard-coding certain things, but then certain things might not work as expected.
    – moewe
    Commented Jun 5, 2018 at 13:08

You must log in to answer this question.

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