3

Consider the following .bib file:

@MISC{test,
  author = {Last1, First1 and Last2, First2 and Last3, First3},
}

What do I want? I want to get the n-th author in a .bib file entry.

First Author: First1 Last1
Second Author: First2 Last2
Third Author: First3 Last3

I tried the code below, using \DeclareCiteCommand and \printnames but I didn't get the desired result. Indeed, the code in the MWE gives me:

First Author: First1 Last1 et al.
Second Author: First2 Last2, et al.
Third Author: First3 Last3

But I don't want the comma and the "et al.". I only want the authors.

Notice that I defined the commands \citeauthorone, \citeauthortwo and \citeauthorthree. This is not an elegant tentative. I would rather using something like \citenthauthor[n]{test} and get the n-th author. Unfortunately I don't know how to combine a new command that would interact with \DeclareCiteCommand passing options.

MWE

\documentclass{article}
\usepackage[]{biblatex}
\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@MISC{test,
  author = {Last1, First1 and Last2, First2 and Last3, First3},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\DeclareCiteCommand{\citeauthorone}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printnames[][1-1]{author}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
  
\DeclareCiteCommand{\citeauthortwo}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printnames[][2-2]{author}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
  
\DeclareCiteCommand{\citeauthorthree}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printnames[][3-3]{author}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
  


\begin{document}

\noindent
First Author: \citeauthorone{test} \\
Second Author: \citeauthortwo{test} \\
Third Author: \citeauthorthree{test} \\

\printbibliography

\end{document}
4

Define a new name format without the code for andothers.

Usually I would not recommend this, but if you can give up the usual postnote argument you can use its optional argument for the author number.

\documentclass{article}
\usepackage[]{biblatex}

\DeclareNameFormat{given-family:noetal}{%
  \ifgiveninits
    {\usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiveni}
      {\namepartprefix}
      {\namepartsuffix}}
    {\usebibmacro{name:given-family}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}}}

\DeclareCiteCommand{\citeauthorone}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printnames[given-family:noetal][1-1]{author}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeauthortwo}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printnames[given-family:noetal][2-2]{author}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeauthorthree}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printnames[given-family:noetal][3-3]{author}}
  {\multicitedelim}
  {\usebibmacro{postnote}}

\DeclareCiteCommand{\citeauthorgeneral}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\printnames[given-family:noetal][\thefield{postnote}-\thefield{postnote}]{author}}
  {\multicitedelim}
  {}
  
\begin{filecontents}{\jobname.bib}
@misc{test,
  author = {Last1, First1 and Last2, First2 and Last3, First3},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
First Author: \citeauthorone{test}

Second Author: \citeauthortwo{test}

Third Author: \citeauthorthree{test}

First Author: \citeauthorgeneral[1]{test}

Second Author: \citeauthorgeneral[2]{test}

Third Author: \citeauthorgeneral[3]{test}

\printbibliography
\end{document}

First Author: First1 Last1//Second Author: First2 Last2//Third Author: First3 Last3//First Author: First1 Last1//Second Author: First2 Last2//Third Author: First3 Last3

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.