I'm trying to put individual names within my bibliographic entries into brackets, and trying to patch biblatex bibmacros for that, using the facilities of (rege)xpatch.
In particular, I'm trying to patch the bibmacros name:given-family
and name:family-given
.
As far as I understood, regexpatch
offers the same patch commands xpatch
does, plus some with regex features. And I couldn't grasp from the documentation any change of syntax of the original commands of xpatch
whithin regexpatch
. However, the patches which work with xpatch
return undefined control sequence
with regexpatch
. A MWE:
\documentclass{article}
\usepackage{xpatch}
%\usepackage{regexpatch}
\usepackage[style=authortitle]{biblatex}
\addbibresource{biblatex-examples.bib}
% These patches work with xpatch, but not with regexpatch
\xpatchbibmacro{name:given-family}
{\usebibmacro{name:hook}}
{\bibopenbracket\usebibmacro{name:hook}}
{}{}
\xapptobibmacro{name:given-family}
{\bibclosebracket}
{}{}
\xpatchbibmacro{name:family-given}
{\usebibmacro{name:hook}{#3#1}}
{\bibopenbracket\usebibmacro{name:hook}{#3#1}}
{}{}
\xpatchbibmacro{name:family-given}
{\usebibmacro{name:hook}{#1}}
{\bibopenbracket\usebibmacro{name:hook}{#1}}
{}{}
\xapptobibmacro{name:family-given}
{\bibclosebracket}
{}{}
\begin{document}
\nocite{*}
\printbibliography
\end{document}
What am I missing/doing wrong?
Obs: I need regexpatch
for other patches that actually require the regex facilities, and I'd like to use the original xpatch
patch commands, if possible, for the sake of code readability.
\xpatchbibmacro*
(changing all appearances should do nothing wrong in the shown cases). – egreg Jan 16 '18 at 12:40