I'm trying to compare the content of \partnamefamily of an author's name in biblatex against a manual definition that is stored in another macro, lets call it \family, using \ifdefequal.
So, I have
Lastnameis found without problem in the comparisonCompound~Lastnamecreates a problem as the~is converted to a\bibnamedelimamacro that is stored inside. So the name isCompound\bibnamedelima Lastnameinstead. And that is not the same when doing the definition comparison.
The issue, that I think is happening, is related to the protected macro \bibnamedelima that appears when the name has a non-breaking space (~). If the name has no special delimiter that is handled by biblatex the comparison works fine. However, I can't compare it when that happens. My solutions were
- Try to expand it, and then compare strings or macros with the expanded
\partnamefamilyon it. But didn't work. I guess it is due to the protected macro\bibnamedelima. - Try to compare the macros by doing a substitution, but that didn't work either.
I searched for a way of expanding macros with protected macros on it (like On unprotecting (expanding) \protected macros (or, "the space after command name") and Expanding arguments before macro call) but didn't help. Also, tried to convert it to string without success.
Is there a way to compare these two macros directly?
Here is an example to show my problem
% !BIB program = biber
\documentclass{article}
\usepackage[backend=biber, giveninits=true]{biblatex}
\begin{filecontents}{\jobname.bib}
@InProceedings{identifier1,
Title = {Some Awesome Title},
Author = {One~Two, Author and Three, Author},
Booktitle = {Some Book about the Future},
Year = {2042},
Pages = {1--42}
}
\end{filecontents}
\addbibresource{\jobname.bib}
\newcommand*{\name}[1]{%
\def\lastname{#1}}
\name{}
\renewcommand{\mkbibnamefamily}[1]{%
% I have a complex expression here, so I was using the \ifboolexpr
\ifboolexpr{ test {\ifdefequal{\lastname}{\namepartfamily}} }
{(F)\mkbibbold{#1}}{(NF)#1}%
}
\begin{document}
\nocite{*}
\name{One~Two}% not found due to ~, as biblatex convert ~ to \bibnamedelima
\printbibliography
\name{One\bibnamedelima Two}% found due to \bibnamedelima instead of ~
\printbibliography
% found as it is not using any delim
\name{Three}
\printbibliography
\end{document}

biblatex(in my opinion) is to use hashes as hinted at by Audrey here and explained in one of my answers here. – moewe Nov 23 '16 at 20:13\bibnamedelimaand putting it back into a macro, or something in that lines. – adn Nov 23 '16 at 20:23\bibnamedelim...s and do the comparison on expanded macros... But I'm really not sure. – moewe Nov 24 '16 at 06:43