1

I'm trying to adapt bibliography to display in the same way as the style given from college.

MWE:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}
\begin{document}
This is a little example for the question \parencite{ctan}.
    Available at: <url to the website>

\printbibliography
\end{document}

This looks like : enter image description here

This is how it's meant to look :

Surname, In (YEAR) Italic title of the webpage[Online] [Accessed on: Dayth Month Year]

Image example :

enter image description here


I'm not sure how to go about customising this to match, I can't seem to find any other templates that use this style of Harvard referencing to use. I may not really know what to search for though.

Thanks

  • 1
    I have edited your code to make it compilable without extra files. – moewe Apr 16 '15 at 13:54
  • 1
    In was guessing on the style=authoryear, though. So if the set-up above differs significantly from what you have in your actual document, please change the code to reflect that. – moewe Apr 16 '15 at 14:06
2

Since your strings are not the standard strings we need to change the standard via

\NewBibliographyString{onlinesource}
\DefineBibliographyStrings{english}{%
  urlseen = {accessed on},
  urlfrom = {available at},
  onlinesource = {online},
}

where we also add the new "Online" string.

Then what you want can be done via some reformatting of the url and urldate formats ...

\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibsentence\bibstring{urlseen}\addcolon\space#1}}
\DeclareFieldFormat{url}{\bibsentence\bibstring{urlfrom}\addcolon\space<\url{#1}>}

... and a slight rework in the order of the macro url+urldate.

\newbibmacro*{url+urldate}{%
  \printtext{\bibstring[\mkbibbrackets]{onlinesource}}%
  \setunit{\addspace}%
  \iffieldundef{urlyear}
    {}
    {\setunit*{\addspace}%
     \usebibmacro{urldate}}%
  \usebibmacro{url}}

MWE

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[style=authoryear]{biblatex}
\addbibresource{biblatex-examples.bib}

\NewBibliographyString{onlinesource}
\DefineBibliographyStrings{english}{%
  urlseen = {accessed on},
  urlfrom = {available at},
  onlinesource = {online},
}

\DeclareFieldFormat{urldate}{\mkbibbrackets{\bibsentence\bibstring{urlseen}\addcolon\space#1}}
\DeclareFieldFormat{url}{\bibsentence\bibstring{urlfrom}\addcolon\space<\url{#1}>}

\newbibmacro*{url+urldate}{%
  \printtext{\bibstring[\mkbibbrackets]{onlinesource}}%
  \setunit{\addspace}%
  \iffieldundef{urlyear}
    {}
    {\setunit*{\addspace}%
     \usebibmacro{urldate}}%
  \usebibmacro{url}}


\begin{document}
This is a little example for the question \parencite{ctan}.
    Available at: <url to the website>

\printbibliography
\end{document}

enter image description here

  • Out of interest, how much time did you spent on this answer? – Johannes_B Apr 16 '15 at 14:07
  • 1
    @Johannes_B Roughly the time between my edit of the question (~15 mins ago) and posting the answer (~5 mins ago), so that would be 10 minutes. I probably should have invested more time in looking for a duplicate though. – moewe Apr 16 '15 at 14:11
  • Would have taken me longer. btw, if you could have a look at golatex.de/… and its dev branch at github.com/johannesbottcher/HinweiseLitverzeichnisse and maybe give some feedback, i would be more than thankful. – Johannes_B Apr 16 '15 at 14:13
  • thanks a lot @moewe, I've realised that I formatted the OP pretty stupidly, but I'll leave it as it is now as somehow you've answered the original question with the available at : underneath the parencite. Thanks :) – baxx Apr 16 '15 at 14:22
  • @Johannes_B For lack of a better place, I will comment on your "Wichtige Hinweise" here. I would add a more prominent warning about the fact that the German translation of the biblatex documentation is outdated (the one I found was about version 1.6). While lots of it is still relevant (especially the "basic" stuff), it can be hard to know which bits have changed and even more so for beginners. Since you seem to favour not dropping the last comma after a field in .bib files (I agree with you there), you might want to adjust kurtGolatexBibTest example so this practice is uniformly applied. – moewe Apr 16 '15 at 15:06

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.