I am trying to display the initials of only the first name of my authors in my citations. So, I should get the following format: (J. Kennedy et al., 2023) and not (John Fitzgerald Kennedy et al., 2023).
There is a solution for this in LaTeX using Biblatex. However, the code (from here) used to solve this is old and does not use the Biblatex 3.3 naming convention.
When I run the below MWE, I get the following error:
Illegal parameter number in definition of \blx@defformat@d.
<to be read again>
4
l.23 \usebibmacro{name:first-last}{#1}{#4
}{#5}{#7}%
Here is how much of LuaTeX's memory you used:
6844 strings out of 481315
125171,662416 words of node,token memory allocated
430 words of node memory still in use:
2 hlist, 1 rule, 1 dir, 3 kern, 1 glyph, 3 attribute, 59 glue_spec, 3 attribute_list, 1 write nodes
avail lists: 2:18,3:3,4:3,5:1,7:2,9:3
23963 multiletter control sequences out of 65536+600000
25 fonts using 3258707 bytes
36i,0n,33p,816b,67s stack positions out of 5000i,500n,10000p,200000b,100000s
! ==> Fatal error occurred, no output PDF file produced!
The legacy solution for this is:
\documentclass[]{article}
\usepackage{filecontents}
\begin{filecontents}{bib.bib}
@article{jdoe,
author = {John Paul Peter Julian Doe},
journal = {Journal},
title = {Title},
year = 2014,
pages = 111--222,
}
\end{filecontents}
\usepackage[style=authoryear]{biblatex}
\addbibresource{bib.bib}
% Helper function to get initial letter
\def\firstinit#1{\justfirst#1\relax}
\def\justfirst#1#2\relax{#1}
% Format for FirstInitials - LastName (standard implementation)
\DeclareNameFormat{firstinits-last}{%
\usebibmacro{name:first-last}{#1}{#4}{#5}{#7}%
\usebibmacro{name:andothers}}
% Format for VeryFirstInitial - LastName
\DeclareNameFormat{firstfirstinit-last}{%
\usebibmacro{name:first-last}{#1}{\firstinit{#4}\adddot}{#5}{#7}%
\usebibmacro{name:andothers}}
% Set format for sortname (bibliography) and labelname (citation)
\DeclareNameAlias{sortname}{firstinits-last}
\DeclareNameAlias{labelname}{firstfirstinit-last}
\begin{document}
\noindent Citation: \cite{jdoe}.
\printbibliography[]
\end{document}
Can anyone help me adapt this legacy code using the new Biblatex 3.3 naming convention?

given-iis for each author? I have a love long bib file and cannot do this manually. Any suggestion on how best to do this? – Mohamed Yusuf Feb 28 '23 at 05:16biblatexdocumentation. – moewe Feb 28 '23 at 06:22\DeclareNameAlias{labelname}{given-family}. You may or may not get better results if you additionally passgiveninits=true,tobiblatexas loading option. – moewe Feb 28 '23 at 10:52biblatexthinks these are two different names and treats them as such, but your citations will both shows "J. Doe" creating the wrong impression that they are the same. – moewe Feb 28 '23 at 12:09