10

I need a citation command that satisfies the following conditions – similar to \citeauthor – and was wondering how to define it:

  • If an author or a group of authors is cited the first time, then the authors full names are cited.
  • If an author or a group of authors is cited the second, etc. time, then only the authors surnames are cited.

E.g.:

\citeauthor{cit:howson1983SciRea} were the first who discussed this thesis. … 
But today \citeauthor{cit:howson1983SciRea} refute this thesis.

This should result in:

Colin Howson and Peter Urbach were the first who discussed this thesis. … But today Howson and Urbach refute this thesis.

I already tried a solution to a similar problem:

\DeclareCiteCommand*{\citeauthortest}
{\defcounter{maxnames}{99}%
\defcounter{minnames}{99}%
\defcounter{uniquename}{2}%
\boolfalse{citetracker}%
\boolfalse{pagetracker}%
\usebibmacro{prenote}}
{\ifciteindex{\indexnames{labelname}}{}%
\printnames{labelname}}
{\multicitedelim}
{\usebibmacro{postnote}}

But I get a

Package biblatex Error: Command '\citeauthortest' undefined

11

The biblatex-dw styles have an option for this (firstfullname). I must admit that I could not have implemented it without Philipp Lehman, who delivered the code. But anyhow, it can be adapted for any style, I think:

\documentclass[english]{scrartcl}
\listfiles
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{babel,csquotes}

\usepackage[
  style=authortitle,
  backend=biber
]{biblatex}
\addbibresource{biblatex-examples.bib}

\makeatletter
\newcommand*{\cbx@seennames}{}
\newrobustcmd*{\cbx@nameseen}[1]{%
  \listxadd{\cbx@seennames}{\detokenize{#1}}}
\newrobustcmd*{\cbx@ifnameseen}[1]{%
  \xifinlist{\detokenize{#1}}{\cbx@seennames}}

\DeclareNameFormat{citeauthor}{%
  \cbx@ifnameseen{#1#3#5#7}
    {\ifcase\value{uniquename}%
       \usebibmacro{name:last}{#1}{#3}{#5}{#7}%
     \or
       \ifuseprefix
         {\usebibmacro{name:first-last}{#1}{#4}{#5}{#8}}
         {\usebibmacro{name:first-last}{#1}{#4}{#6}{#8}}%
     \fi}%
    {\usebibmacro{name:first-last}{#1}{#3}{#5}{#7}%
     \cbx@nameseen{#1#3#5#7}}%
  \usebibmacro{name:andothers}}
\DeclareCiteCommand{\citeauthor}
  {\boolfalse{citetracker}%
   \boolfalse{pagetracker}%
   \usebibmacro{prenote}}
  {\indexnames{labelname}%
   \printnames[citeauthor]{labelname}}
  {\multicitedelim}
  {\usebibmacro{postnote}}
\makeatother

\begin{document}
\citeauthor{companion} were the first who discussed this thesis. \ldots{} 
But today \citeauthor{companion} refute this thesis.

\printbibliography
\end{document}

I just took the code from standard-dw.cbx. The result looks like this: The enhanced <code>\citeauthor</code> in action.

  • Your solution works perfectly well. Thanks a lot! – Christian Mar 4 '12 at 10:14
2

If you use \DeclareCiteCommand* then the resulting command must also be suffixed with a * (see biblatex documentation). So in your case try \citeauthortest*{citekey}

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.