I have this command \name which stores the name of someone. (Edit: I also use this command for other things, so I would like it to be the same).
I would like to use the command \plauthorname[first name][von-part]{surname} to remove the name given in \name from the bibliography. The problem is to make a command that splits \name into one, two or three strings depending on the input:
- If only surname is given, i.e.
\name{surname}we get\plauthorname{surname} - If first (and middle) names are given, but no von-part, i.e.
\name{ Firstname Middlename Lastname}we get\plauthorname[Firstname Middlename]{surname}. - If a von-part recognized by
biblatexis given in name, i.e.\name{Firstname von-part Lastname}we get\plauthorname[first name][von-part]{surname} - I would also like it to work if someone wrote
\name{Lastname, Firstname}
The hardest part (I think) is to find out if the name contains a von-part recognized by \plauthorname.
\documentclass{article}
% From .sty file:
\newcommand{\name}[1]{\def@name{#1}}
\RequirePackage[%
backend=biber,
bibstyle=publist,
hyperref=auto
]{biblatex}
% Some code to get first name, middle name von-part and surname.
\plauthorname[first name][von-part]{surname}
\begin{filecontents}[overwrite]{sample.bib}
@article{einstein,
author = "Albert Einstein",
title = "{Zur Elektrodynamik bewegter K{"o}rper}. ({German})
[{On} the electrodynamics of moving bodies]",
journal = "Annalen der Physik",
volume = "322",
number = "10",
pages = "891--921",
year = "1905",
DOI = "http://dx.doi.org/10.1002/andp.19053221004",
}
@book{dirac,
title = {The Principles of Quantum Mechanics},
author = {Paul Adrien Maurice Dirac},
isbn = {9780198520115},
series = {International series of monographs on physics},
year = {1981},
publisher = {Clarendon Press},
}
\end{filecontents}
\addbibresource{sample.bib}
% This will be defined by users:
\name{Paul Adrien Maurice Dirac}
\begin{document}
foo baz baa
\nocite{*}
\printbibliography
\end{document}
\plauthorname[first name][von-part]{surname} is from biblatex-publist: https://ctan.org/pkg/biblatex-publist
Side note: I was thinking of declaring class options to (a) not hide name from publist or (b) highlight name in publist instead (for example normalpublist and highlightpublist). How would I go about this? Here is my thinking: for higlight set plauthorhandling=highlight somehow (?), and for normal also set plauthorhandling=highlight but re-define highlight to be normal text by (p. 11 in documentation):
\renewcommand*\plauthorhl[1]{%
#1%
}
.bibfile. See https://tex.stackexchange.com/a/416416/35864. – moewe Nov 02 '22 at 16:38