Skip to content

Instantly share code, notes, and snippets.

@djsutherland
Created October 12, 2017 13:04
Show Gist options
  • Save djsutherland/fd405ad9ffab644d1b00c3d8130ffb0e to your computer and use it in GitHub Desktop.
Save djsutherland/fd405ad9ffab644d1b00c3d8130ffb0e to your computer and use it in GitHub Desktop.
Patch to workaround biblatex oddities with the natbib option in versions < 3.5
% biblatex authoryear with natbib does a million stray commas in versions < 3.5
% see: https://tex.stackexchange.com/q/312539/
% this works around it for versions 3.3 and 3.4
\ifthenelse{\equal{\abx@version}{3.4}}{%
\DeclareDelimFormat[cbx@textcite]{nameyeardelim}{\addspace}
}{\ifthenelse{\equal{\abx@version}{3.3}}{%
% Workaround following http://golatex.de/neue-biber-version-ploetzlich-komma-bei-zitierung-t17005.html
% (in German...), which changes \nameyeardelim / \nonameyeardelim to \addspace
% in the citation style's textcite macro.
% sigh....
\renewbibmacro*{textcite}{%
\ifnameundef{labelname}
{\iffieldundef{shorthand}
{\usebibmacro{cite:label}%
\setunit{%
\global\booltrue{cbx:parens}%
\addspace\bibopenparen}% This was changed
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\usebibmacro{cite:labelyear+extrayear}}
{\usebibmacro{cite:shorthand}}}
{\printnames{labelname}%
\setunit{%
\global\booltrue{cbx:parens}%
\addspace\bibopenparen}%
\ifnumequal{\value{citecount}}{1}
{\usebibmacro{prenote}}
{}%
\usebibmacro{citeyear}}}
}{%
% version is not 3.3 or 3.4; assuming we're good :)
}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment