# biblatex: extract authors seperately

Given and BibTeX entry

@articel{paper,
author={Jane Doe and John Hansen and Tom Nielsen},
year={2012},
title={Paper title}
}


How do I make commands (using biblatex) that

1. insert "Jane Doe, John Hansen and Tom Nielsen" in the text (\citeauthor only use the last names)
2. insert "Jane Doe" into the text (i.e. only the first author)

Thanks

• Welcome to TeX.SX! Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Sep 8 '14 at 7:42

Here are the definitions for (simplified) citation commands to print the (full) name of the first author and the full names of the authors.

\documentclass[a4paper,12pt]{article}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@articel{test,
author={Jane Doe and John Hansen and Tom Nielsen},
year={2012},
title={Paper title}
}

\end{filecontents}
\usepackage{xpatch}

\usepackage[style=authoryear,maxbibnames=6]{biblatex}

\DeclareNameFormat{onlyfirst}{%
\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
}

\DeclareCiteCommand{\citefirstauthor}
{\usebibmacro{prenote}}
{\printnames[onlyfirst][1-1]{labelname}
\usebibmacro{citeindex}}
{\multicitedelim}
{\usebibmacro{postnote}}

\DeclareCiteCommand{\citenames}
{\usebibmacro{prenote}}
{\printnames[first-last]{labelname}}
{\multicitedelim}
{\usebibmacro{postnote}}

\begin{document}
First author only: \citefirstauthor{test}

All authors: \citenames{test}

\printbibliography

\end{document}


• Shame there isn't an MWE with this post; I just tried this code with TexLive 2014 - and still get first name initals only; please see the below post... any help? – sdaau Oct 16 '14 at 19:47
• @sdaau included full MWE. – Guido Oct 16 '14 at 19:57

Here is an MWE based on @Guido's answer:

\documentclass{article}
\usepackage{filecontents} % tlmgr install filecontents
\begin{filecontents*}{btest.bib}
@BOOK{Author2014,
author = {Jane Doe and John Hansen and Tom Nielsen},
publisher = {Another},
title = {The Author book},
year = 2014
}
\end{filecontents*}

\usepackage[%
style=ieee,
isbn=true,
doi=false,
url=true,
backend=biber
]{biblatex}
\bibliography{btest}

\DeclareNameFormat{onlyfirst}{%
\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
}

\DeclareCiteCommand{\citefirstauthor}
{\usebibmacro{prenote}}
{\printnames[onlyfirst][1-1]{labelname}}
{\multicitedelim}
{\usebibmacro{postnote}}

\DeclareCiteCommand{\citenames}
{\usebibmacro{prenote}}
{\printnames[first-last]{labelname}}
{\multicitedelim}
{\usebibmacro{postnote}}

\begin{document}

Testing citenames here: \citenames{Author2014}

\end{document}


Compiled this with pdflatex test.tex, biber test, pdflatex test.tex, pdflatex test.tex, and still I get this:

I use the exactly the same code as in the answer, yet I get the first names as initial only. Why and how could I get the full names?

EDIT: just found that one just needs to add firstinits=false to the package loading:

...
\usepackage[%
style=ieee,
isbn=true,
doi=false,
url=true,
firstinits=false, %% this!
backend=biber
]{biblatex}
\bibliography{btest}
...


... and then full names are generated:

EDIT2: ... and if you need this command to switch explicitly in an environment like IEEE where firstinits=true, and you don't want to set firstinits=false in preamble - probably this will work:

\DeclareCiteCommand{\citenames}
{\usebibmacro{prenote}}
{%
% \ExecuteBibliographyOptions{firstinits=false} % only in preamble
\makeatletter%
\setkeys{blx@opt@pre}{firstinits=false}%
\makeatother%
\printnames[first-last]{labelname}%
\makeatletter%
\setkeys{blx@opt@pre}{firstinits=true}%
\makeatother%
}
{\multicitedelim}
{\usebibmacro{postnote}}

• The solution I gave does not use style=ieee, it works with style=authoryear. – Guido Oct 16 '14 at 19:54
• @Guido - it turns out in my case firstinits=false, fixed things. Cheers! – sdaau Oct 16 '14 at 19:59