# BibLaTeX - replace recurrent author by short name or Idem/Eadem in citations

I am currently defining a (french) citation style. One thing I haven't managed to do is to replace the name of a recurring author by the short form in the citations. What I would like to do is :

• Jane Smith, first work, Paris, 1900. [first citation from this author].
• J. Smith, other work, Paris, 1901 [if not directly following the previous one].

or :

• Ead., other work, Paris, 1901 [if directly following].

Is there a way of doing this? I have tried to use \ifentryseen{author} but without any success so far.

 Here is how I try to do it (but I get an ! extra \else error):

\newbibmacro*{author-fullnote}{%
\ifthenelse{\ifuseauthor\AND\NOT\ifnameundef{author}}%
{\ifthenelse{\iffieldequals{namehash}{\bbx@lasthash}\AND\NOT\iffirstonpage}
{\bibstring[\mkidem]{idem\thefield{gender}}}
{\ifthenelse{\ifentryseen{author}}{\printnames{labelname}}{
\printnames[upshape][1-10]{author}
\savefield{namehash}{\bbx@lasthash}}}}
{\global\undef\bbx@lasthash}}
-
@Jean-Baptiste: Did you enable the idemtracker? It would be good to have a minimal example for this. –  domwass Apr 2 '11 at 14:54
@domwass I have declared \ExecuteBibliographyOptions{idemtracker} in the beginning of the bbx file. As for my example, I'll include it in my post, since it is too long for a comment. –  Jean-Baptiste Camps Apr 2 '11 at 15:33
@Jean-Baptiste: If you use 4-space indentation for a code block (which is good!), then you don't need backticks `. –  Hendrik Vogt Apr 2 '11 at 17:31
@Hendrik Vogt, Duly noted ! –  Jean-Baptiste Camps Apr 2 '11 at 18:26
I've noticed that, if I don't use {\ifthenelse{\ifentryseen{author}} but only \ifentryseen{author}, I no longer get the ! extra \else error message, but, instead of "Ead.,", I get "Ead., J. Smith, Jane Smith"... –  Jean-Baptiste Camps Apr 2 '11 at 18:28

Here how I finally managed to do it, using code from the Biblatex-dw styles. I added in the cbx :

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

\AtBeginDocument{%
\DeclareNameFormat{citeauthor}{%
\cbx@ifnameseen{#1#3#5#7}
{\usebibmacro{name:first-last-upshape}{#1}{#4}{#5}{#7}%
}%
{\usebibmacro{name:first-last-upshape}{#1}{#3}{#5}{#7}%
\cbx@nameseen{#1#3#5#7}}%
\usebibmacro{name:andothers}}
}

Where first-last-upshape is the format to be used in notes, with full first name the first time, and only initials the others. I then, in the bbx, defined two macros, inspired from the historische-zeitschrift style, to be applied in the full note (et al. only after ten names) and short notes (et al. after three names), each time specifying that idem/eadem/etc. should be used for the same author in two following references :

\newbibmacro*{author-fullnote}{%
\ifthenelse{\ifuseauthor\AND\NOT\ifnameundef{author}}%
{\ifthenelse
{\iffieldequals{namehash}{\cbx@lasthash}}%
{\bibstring{idem\thefield{gender}},}%
{\printnames[citeauthor][1-10]{author}%
\savefield{namehash}{\cbx@lasthash}
}}%
{\global\undef\cbx@lasthash}}

\newbibmacro*{author-shortnote}{%
\ifthenelse{\ifuseauthor\AND\NOT\ifnameundef{author}}%
{\ifthenelse
{\iffieldequals{namehash}{\cbx@lasthash}}%
{\bibstring{idem\thefield{gender}},}%
{\printnames[citeauthor][1-3]{author}%
\savefield{namehash}{\cbx@lasthash}
}}%
{\global\undef\cbx@lasthash}}

Here is what it looks like :

In following references :

In a further reference :

-