I am trying to list the references of two different people with the same last name:
\newcommand*{\generateauthorcategory}[3]{%
\DeclareBibliographyCategory{by#1}%
\DeclareIndexNameFormat{cat#1}{%
\ifboolexpr{test {\ifdefstring{\namepartfamily}{#2}}
and test {\ifdefstring{\namepartgiven}{#3}}}
{\addtocategory{by#1}{\thefield{entrykey}}}
{}}%
\AtDataInput{\indexnames[cat#1][1-999]{author}}}
\generateauthorcategory{foo}{Foo}{Andrew}
\generateauthorcategory{foo}{Foo}{Fernand}
\begin{document}
\printbibliography[heading=none, category=byfoo, check=yr2018,]
\printbibliography[heading=none, category=byfoo, check=yr2017,]
\printbibliography[heading=none, category=byfoo, check=yr2016,]
\printbibliography[heading=none, category=byfoo, check=yr2018,]
\printbibliography[heading=none, category=byfoo, check=yr2017,]
\printbibliography[heading=none, category=byfoo, check=yr2016,]
\nocite{*}
\end{document}
It tells me I already have a foo catergory so i cant have two.
\generateauthorcategory{fooa}{Foo}{Andrew} \generateauthorcategory{foof}{Foo}{Fernand}and thencategory=byfooaandcategory=byfoofrespectively? The first argument of\generateauthorcategorymust be unique and should only contain ASCII chars (I prefer to keep them lowercase) - it is however only used internally and so need not bear relation to the second and third arguments. – moewe Apr 12 '18 at 21:00