3

I have the same question as asked in How to (properly) remove the parentheses around the year in authoryear style?. The accepted answer, however, no longer works (presumable due to some update to biblatex). What would the current solution be?

\documentclass{article}

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

\begin{filecontents}{\jobname.bib}
@misc{A01,author={Author, A.},year={2001},title={Alpha}}
@misc{A02,author={Author, A.},year={2001},title={Beta}}
\end{filecontents}
\addbibresource{\jobname.bib}
\xpatchbibmacro{date+extrayear}{%
  \printtext[parens]%
}{%
  \setunit{\addperiod\space}%
  \printtext%
}{}{}
\begin{document}
\nocite{*}
\printbibliography
\end{document}

enter image description here

  • I can compile your file and the patch works fine. – Bernard Feb 3 '14 at 23:38
  • @Bernard Maybe different versions? I see the same problem as Sverre when I compile that code. – cfr Feb 4 '14 at 0:51
  • @cfr I use the last version: biblatex 2.8a (MiKTeX 2.9). – Bernard Feb 4 '14 at 7:15
  • To remove the parenthesis and add a period+space after the year, you can use \DeclareFieldFormat*{parens}{#1\addperiod\addspace}. However, I think it will format every fields in the bibliographic entry that are in parenthesis. – Luc M Dec 3 '14 at 16:31
6

Replace

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

with

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

MWE:

\documentclass{article}

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

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

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

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

Output:

enter image description here

  • I actually tried this already - but this will remove the period placed after an author's name (before the year). – Sverre Feb 4 '14 at 11:59
  • @Sverre Are you saying that my MWE gives a different result to you? – karlkoeller Feb 4 '14 at 12:32
  • No, the period remains in the MWE because the input happens to have "A." with a period in the .bib file (I just copied the example from the original to preserve consistency - maybe I shouldn't have). If this were e.g. "Author, Anne", it would give "Author, Anne 2001a." without a period, rather than "Author, Anne. 2001a." – Sverre Feb 4 '14 at 12:37
  • @Sverre Note that there is no period between the author and the year in the normal behavior. – karlkoeller Feb 4 '14 at 12:42
  • 2
    @Sverre From the manual: The starred variant differs from the regular version in that it checks if the last \printtext, \printfield, \printlist, \printnames, or \bibstring command did actually print anything. If not, it does nothing. – karlkoeller Feb 4 '14 at 13:04

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.