6

I'd like to have a comma behind every unit in a bibliography entry except the year and at the end of an entry. How can I achieve that?

This is what I have so far.

\usepackage[
language=auto,
style=authoryear,
backend=bibtex,
hyperref=true,
isbn=false,
doi=false,
citereset=chapter,
maxcitenames=3,
dashed=false,
sorting=nyt,
block=par,
natbib=true, %faking natbib-commands
firstinits=true,
terseinits=false
maxbibnames=99,
autopunct=true
]{biblatex}

\DeclareBibliographyDriver{book}{%
\printnames{author}%
\newunit
\printfield{year}%
\newunit\newblock
\printfield{title}%
\newunit
\printlist{edition}%
\newunit
\printlist{publisher}%
\newunit
\printlist{location}%
\finentry}

%\DeclareBibliographyDriver{article}{%
%\printnames{author}%
%\newunit
%\printfield{year}%
%\newunit\newblock
%\printfield{title}%
%\newunit
%\printlist{edition}%
%\newunit
%\printlist{journal}%
%\newunit
%\printlist{location}%
%\finentry}

%% Jahresangabe bei Referenzen in Biblipographie fett
\DeclareFieldFormat{year}{\bfseries{(#1)}}
%% Jahresangabe bei Referenzen im Dokument nicht fett
\DeclareFieldFormat{labelyear}{(#1)}
%% Zeilenumbruch vor Ausgabe der URL bei Internetquellen
\DeclareFieldFormat{url}{\newline URL: \url{#1}}
%% Ausgabe des letzten Seitenbesuchs nach Richtlinien
\DeclareFieldFormat{urldate}{(Last Visit: \urldate{#1})}

\DefineBibliographyStrings{american}{%
bibliography = {Bibliography},
shorthands = {Abbreviations},
editor = {editor},
editors = {editors},
}

\renewcommand*{\bibpagespunct}{%
\ifentrytype{article,inbook,incollection,inproceedings,patent,thesis,unpublished,online}{\addspace}{\addcomma\space}}

%% no indent
\setlength{\bibhang}{0pt} 
%% eine Leerzeile zwischen zwei Bib-Einträgen
\setlength{\bibitemsep}{12pt} 

%% Doppelpunkte nach dem Datum sicherstellen
\renewcommand{\labelnamepunct}{\addcolon} 
\renewcommand{\intitlepunct}{\addcolon}
%% Names... Lastname, Firstname
\DeclareNameAlias{sortname}{last-first} 
%% Format der Titelausgabe im Dokument bei Referenzen auf normal setzen
\DeclareFieldFormat{citetitle}{#1\isdot} 
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished,online]{citetitle}{#1}
%% Format der Titelausgabe in Bibliographie
\DeclareFieldFormat{title}{#1\isdot} 
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished,online]{title}{#1}

\AtBeginBibliography{%
%% auschließlich Slash zwischen den Autorennamen
\renewcommand{\multinamedelim}{/}
\renewcommand{\finalnamedelim}{/}
%% auschließlich Slash zwischen den Orten
\renewcommand{\multilistdelim}{/}
\renewcommand{\finallistdelim}{/}
%% alle Teile der Autoren fett formatieren
\renewcommand*{\mkbibnamefirst}[1]{\bfseries{#1}}
\renewcommand*{\mkbibnamelast}[1]{\bfseries{#1}}
\renewcommand*{\mkbibnameprefix}[1]{\bfseries{#1}}
\renewcommand*{\mkbibnameaffix}[1]{\bfseries{#1}}
}

\addbibresource{Bibliography/SA-bib}

I thought the

\renewcommand*{\bibpagespunct}{%
\ifentrytype{article,inbook,incollection,inproceedings,patent,thesis,unpublished,online}{\addspace}{\addcomma\space}}

would go in the right direction, but that is about it.

I have a couple of other specific questions but I intend to open another thread for each one if that is alright. Also, if anyone would like to comment on improving the config, I'd gladly take that advice too.

2
  • you should take a look at \renewcommand{\newunitpunct}{...}
    – Nils L
    Apr 25, 2013 at 19:45
  • Thank you, but by renewing the command with \addcomma\addspace I must have overwritten some other commands. The colon behind the year is gone. Do I have to use some sort of if-condition here?
    – henry
    Apr 25, 2013 at 19:58

1 Answer 1

6

Your drivers make use of \newunitpunct instead of \labelnamepunct, so you can't incorporate different unit punctuation after the author-year label. Instead of re-writing the drivers entirely, you might prefer to tailor the standard drivers. This task is made particularly easy with egreg's xpatch package, which (among other things) extends etoolbox's patching commands to bibliography macros, drivers, formatting directives and indexing directives.

\documentclass{article}
\usepackage[american]{babel}
\usepackage{csquotes}
\usepackage[style=authoryear,uniquename=init,firstinits]{biblatex}
\usepackage{xpatch}

\renewcommand*{\newunitpunct}{\addcomma\space} 

% bold bibliography "label" followed by colon and linebreak
\renewbibmacro*{begentry}{\mkbibbold\bgroup}
\xapptobibmacro{date+extrayear}{\addcolon\egroup}{}{}
\renewcommand*{\labelnamepunct}{\par\nobreak} 

% redefine string preceding urldate
\DefineBibliographyStrings{american}{%
  urlseen = {last visit\addcolon}}

% linebreak before URLs
\xpretobibmacro{url+urldate}{\setunit{\newunitpunct\par\nobreak}}{}{}

% some additional bibliography formatting
\DeclareNameAlias{sortname}{last-first} 
\setlength{\bibhang}{0pt} 
\setlength{\bibitemsep}{\baselineskip}
\AtBeginBibliography{%
  \renewcommand{\multinamedelim}{\addslash}%
  \renewcommand{\finalnamedelim}{\addslash}%
  \renewcommand{\multilistdelim}{\addslash}%
  \renewcommand{\finallistdelim}{\addslash}}

\addbibresource{biblatex-examples.bib}
\begin{document}
Filler text \parencite{companion,ctan,jaffe}.
\printbibliography
\end{document}

enter image description here

2
  • Thanks a lot, that helped so far. However at this point, I am sort of in "over my head". Can I still change the drivers of some source types? I still have to customize some things.
    – henry
    Apr 26, 2013 at 10:57
  • @henry Of course. But again, these could probably be handled with patches instead of completely redefining the drivers. If you need help with further changes, feel free to ask another question.
    – Audrey
    Apr 26, 2013 at 13:23

You must log in to answer this question.

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