11

I have a question that has been answered a few times, but does not work for me (and also not for another commenter in a previously asked question).

I want to remove the parenthesis around the yead in the bibliography with biblatex style authoryear, and ideally also add a comma and space before it. I have looked at the following questions:

biblatex: How to remove the parentheses around the year in authoryear style?

How to (properly) remove the parentheses around the year in authoryear style?

How to (properly) remove the parentheses around the year in authoryear style? (v2)

I use biber 2.10 and TexLive 2017/W32Tex.

This MWE should work according to the question v2 above, but does not work for me, i.e. the output is still Author, Anne (2001a). Alpha. The output I need is Author, Anne, 2001a. Alpha.

\documentclass{article}

\usepackage[style=authoryear,dashed=false]{biblatex}
\usepackage{xpatch,filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,author={Author, Anne},year={2001},title={Alpha}}
@misc{A02,author={Author, Anne},year={2001},title={Beta}}
\end{filecontents}
\addbibresource{\jobname.bib}

\xpatchbibmacro{date+extrayear}{%
  \printtext[parens]%
}{%
  \setunit*{\addperiod\space}%
  \printtext%
}{}{} 

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

2 Answers 2

11

The bibmacro date+extrayear is deprecated, and is replaced with date+extradate

\documentclass{article}

\usepackage[style=authoryear,dashed=false]{biblatex}
\usepackage{xpatch,filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,author={Author, Anne},year={2001},title={Alpha}}
@misc{A02,author={Author, Anne},year={2001},title={Beta}}
\end{filecontents}
\addbibresource{\jobname.bib}

\xpatchbibmacro{date+extradate}{%
  \printtext[parens]%
}{%
  \setunit*{\addcomma\space}%
  \printtext%
}{}{} 

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

output of code

6
  • Oops, I was a tad too slow. (+1) (But the OP asks for a comma between the name and the year.)
    – gusbrs
    Commented Apr 24, 2018 at 2:15
  • 1
    @gusbrs I'll fix that.
    – Alan Munn
    Commented Apr 24, 2018 at 2:17
  • 2
    The macro in question was renamed in biblatex v3.8 (see github.com/plk/biblatex/wiki#release-notes-for-version-38 and in particular github.com/plk/biblatex/wiki/Name-Changes). These 'renaming sprees' should ideally be kept at a minimum and in hindsight changing the macro names might have been worse than living with the apparent slight inconsistency between macro name and field name. See also github.com/plk/biblatex/issues/700
    – moewe
    Commented Apr 24, 2018 at 5:55
  • This solution appears not to work anymore. I've opened a question about it here.
    – Sverre
    Commented May 31, 2022 at 16:59
  • @Sverre It does work... if you read it more carefully. ;-)
    – gusbrs
    Commented May 31, 2022 at 17:07
6

Allow me to indulge in a bit of advertising for biblatex-ext. The ext-authoryear family has built-in support to change the format of the year. The ext-... styles are compatible with the standard styles and can be used as a drop-in replacement.

You just need to redefine the field format biblabeldate (a biblatex-ext feature) and the delimiter nameyeardelim (a standard biblatex feature) appropriately.

\documentclass{article}

\usepackage[style=ext-authoryear,dashed=false]{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareFieldFormat{biblabeldate}{#1}
\DeclareDelimFormat[bib]{nameyeardelim}{\addcomma\space}

\begin{document}
\nocite{sigfridsson,knuth:ct:a,knuth:ct:b}
\printbibliography
\end{document}

enter image description here

You must log in to answer this question.

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