# [Tex/LaTex] biblatex: How to remove the parentheses around the year in authoryear style?

biblatexpunctuation

The standard authoryear style in biblatex puts parentheses around the year in the bibliography and no parentheses around in text citation years:

• Smith 2011 shows … (citation)

• Smith, Joe (2011) … (bibliography)

Is there a (simple) way to turn these into:

• Smith (2011) shows … (citation)

• Smith, Joe. 2011. … (bibliography)

Thanks to egreg's great answer to biblatex: Is it possible to patch macros created with \newbibmacro?, the solution to the present question is easy: Use the new \patchbibmacro command to selectively change the definition of the date+extrayear bibmacro however this definition looks like in the first place (provided some common patterns are present).

\documentclass{article}

\usepackage[style=authoryear]{biblatex}

% By courtesy of Enrico Gregorio (egreg)
\makeatletter
\def\act@on@bibmacro#1#2{%
\expandafter#1\csname abx@macro@\detokenize{#2}\endcsname
}
\def\patchbibmacro{\act@on@bibmacro\patchcmd}
\def\pretobibmacro{\act@on@bibmacro\pretocmd}
\def\apptobibmacro{\act@on@bibmacro\apptocmd}
\def\showbibmacro{\act@on@bibmacro\show}
\makeatother

\usepackage{filecontents}

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

\nocite{*}

\begin{document}

\printbibliography

\printtext[parens]%
}{%
\printtext%
}{}{}

\printbibliography

\end{document}


EDIT: Things are even easier with egreg's xpatch package:

\documentclass{article}

\usepackage[style=authoryear]{biblatex}

\usepackage{xpatch}

\usepackage{filecontents}

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

\nocite{*}

\begin{document}

\printbibliography