# How can I change the order of firstname and lastname for in-text citations with the authoryear style?

I am trying to convert from bibtex to biblatex + biber, and I am struggling to achieve a style I achieved quite easily with a bibtex .bst file. Basically I want author first names and/or initials to appear after their last names in in-text citations (e.g. [Alexander G. and Williams D. 1968] rather than [G. Alexander and D. Williams 1968]. By reviewing questions on this forum I have managed to achieve this in the bibliography, as shown below:

However, I have not been able to achieve the same result in citations. Your collective help would therefore be greatly appreciated.

\documentclass[a4paper,11pt]{scrreprt}

\usepackage[english]{babel}
\usepackage[usenames,dvipsnames]{color}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[autostyle]{csquotes}
\usepackage{lmodern}
\usepackage[
backend=biber,
style=authoryear-comp,
sortlocale=auto,
maxbibnames=6,
minbibnames=6,
maxcitenames=2,
mincitenames=1,
firstinits=true
]{biblatex}

\DeclareNameAlias{last-first/first-last}{last-first}

\makeatletter
\newrobustcmd*{\parentexttrack}[1]{
\begingroup
\blx@blxinit
\blx@setsfcodes
\blx@bibopenparen#1\blx@bibcloseparen
\endgroup}
\AtEveryCite{
\let\parentext=\parentexttrack
\let\bibopenparen=\bibopenbracket
\let\bibcloseparen=\bibclosebracket}
\makeatother

\DeclareFieldFormat[article]{title}{#1'}
\DeclareFieldFormat[article]{volume}{\mkbibbold{#1}}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}

\renewbibmacro{in:}{\ifentrytype{article}{}{\printtext{\bibstring{in}\intitlepunct}}}
\renewbibmacro*{volume+number+eid}{\printfield{volume}\printfield{number}}

\setlength\bibitemsep{1.5\itemsep}

\begin{filecontents}{test.bib}
@article{alexanderg68,
author = {Alexander, G and Williams, D.},
title = {Shivering and non-shivering thermogenesis during summit metabolism in young lambs},
journaltitle = {J Physiol},
volume = {198},
number = {2},
pages = {251-276},
year = {1968}
}
@article{alexanderr11,
author = {Alexander, R. and Lodish, H. and Sun, L.},
title = {MicroRNAs in adipogenesis and as therapeutic targets for obesity},
journaltitle = {Expert Opin Ther Targets},
volume = {15},
number = {5},
pages = {623-636},
year = {2011}
}
@article{williamss99,
author = {Williams, S. and Davie, G. and Lam, F.},
title = {Predicting BMI in young adults from childhood data using two approaches to modelling adiposity rebound},
journaltitle = {Int J Obes},
volume = {23},
number = {4},
pages = {348-354},
year = {1999}
}
\end{filecontents}

\begin{document}
First authors~\parencite{alexanderg68}. Second authors~\parencite{alexanderr11}. Third authors~\parencite{williamss99}.
\printbibliography
\end{document}


The citations use the printnames{labelname} for print the author names. Then you can modify or declare the format of labelname. The most simple way is using a alias. It means:

\DeclareNameAlias{labelname}{last-first}


but the above code not support the option uniquename because the last-first declaration not support this. Then other form is modifying the DeclareNameFormat{labelname}. I copied the definition of \DeclareNameFormat{labelname} in the biblatex.def file and changed the macro first-last by last-first.

  \DeclareNameFormat{labelname}{%
\ifcase\value{uniquename}%
\usebibmacro{name:last}{#1}{#3}{#5}{#7}%
\or
\ifuseprefix
{\usebibmacro{name:last-first}{#1}{#4}{#5}{#8}}
{\usebibmacro{name:last-first}{#1}{#4}{#6}{#8}}%
\or
\usebibmacro{name:last-first}{#1}{#3}{#5}{#7}%
\fi
\usebibmacro{name:andothers}}
`