Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question

2 Answers 2

up vote 9 down vote accepted

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.

share|improve this answer
    
Your solution works perfectly well. Thanks a lot! –  Christian Mar 4 '12 at 10:14

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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