5

Somewhat similar to Customize `\citeauthor*` to show full author name but UpperCase only the first letter, but I cannot wrap my head around this. Consider this MWE:

% pdflatex test.tex; biber test; pdflatex test.tex; pdflatex test.tex
\documentclass{article}

\usepackage[%
  style=ieee,
  isbn=true,
  doi=false,
  url=true,
  defernumbers=true,
  sorting=nyt,
  %sorting=none, % "Do not sort at all. All entries are processed in citation order." (order of appearance)
  firstinits=false, % shows full first name in \printbibliography References
  backend=biber
]{biblatex}

\addbibresource{biblatex-examples.bib}
% @book{knuth:ct:a,
%   author       = {Knuth, Donald E.},
%   title        = {The \TeX book},
%   date         = 1984,

\usepackage{xcolor}
\pagecolor{yellow!10}

\begin{document}

As \citeauthor*{knuth:ct:a} noted in \cite{knuth:ct:a}, Tex can be a bit complicated. But as also noted in \cite{knuth:ct:d}, Metafont isn't far behind.

\printbibliography[sorting=none]

\end{document}

It currently produces this output:

test.png

... that is, currently \citeauthor*{knuth:ct:a} produces only the last name, "Knuth".

I would like to, arbitrarily in the text, use either \citeauthor* (with options?) or some other command, so that based on the same citation key, I obtain: a) "D. Knuth" (first name as initial, middle name ignored); or b) "Donald Knuth" (first name full, middle name ignored). Actually, if it's easier that way, I would appreciate methods that include the middle initial(s) ("D. E. Knuth" or "Donald E. Knuth") also. Needless to say, I want the reference list to remain as shown. How could I do that?

2

Well, a more erudite answer will, as always, be appreciated - but for the time being, I got to a workaround, producing this (which includes the middle name initials):

test2.png

It is not really straightforward, as the name formats 'first-last' etc have to be looked up in biblatex.def (they are not present in the manual), and a hack has to be used to control firstinits outside of the preamble; but it seems to work. Here is the MWE:

% pdflatex test.tex; biber test; pdflatex test.tex; pdflatex test.tex
\documentclass{article}

\usepackage[%
  style=ieee,
  isbn=true,
  doi=false,
  url=true,
  defernumbers=true,
  sorting=nyt,
  %sorting=none, % "Do not sort at all. All entries are processed in citation order." (order of appearance)
  firstinits=false, % shows full first name
  backend=biber
]{biblatex}

\addbibresource{biblatex-examples.bib}
% @book{knuth:ct:a,
%   author       = {Knuth, Donald E.},
%   title        = {The \TeX book},
%   date         = 1984,

\usepackage{xcolor}
\pagecolor{yellow!10}

% http://tex.stackexchange.com/questions/179169/customize-citeauthor-to-show-full-author-name-but-uppercase-only-the-first-l
% http://tex.stackexchange.com/questions/200112/biblatex-extract-authors-seperately/207529#200119
% in biblatex.def: \DeclareNameFormat{first-last}, \DeclareNameFormat{initsonly}, \DeclareNameFormat{labelname}
\makeatletter%
\DeclareCiteCommand{\citeauthorfin}
  {\renewcommand*{\mkbibnamelast}[1]{####1}%
   \boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   % \printnames[initsonly]{author} % too strong, all is initials (D.E.K.)
   %\printnames[firstinits=true,first-last]{author}} % cannot:
   % \ExecuteBibliographyOptions{firstinits=false} % only in preamble!
   % so must use setkeys:
   \setkeys{blx@opt@pre}{firstinits=true}%
   \printnames[first-last]{author}%
   \setkeys{blx@opt@pre}{firstinits=false}% restore - assuming false is default, which here it is
  }
  {\multicitedelim}
  {\usebibmacro{postnote}}
\makeatother%
\DeclareCiteCommand{\citeauthorffn}
  {\renewcommand*{\mkbibnamelast}[1]{####1}%
   \boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\ifciteindex
     {\indexnames{labelname}}
     {}%
   \printnames[first-last]{author}}
  {\multicitedelim}
  {\usebibmacro{postnote}}


\begin{document}

As \citeauthor*{knuth:ct:a} noted in \cite{knuth:ct:a}, Tex can be a bit complicated. But as also noted in \cite{knuth:ct:d}, Metafont isn't far behind. 
Also, "\citeauthorfin{knuth:ct:a}" and "\citeauthorffn{knuth:ct:a}", and "\citeauthor*{knuth:ct:a}" again after that.

\printbibliography[sorting=none]

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.