[Tex/LaTex] BibLaTeX – replace recurrent author by short name or Idem/Eadem in citations

biblatex

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.

[edit] 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}}

Best Answer

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]{%
\listxadd{\cbx@seennames}{\detokenize{#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 following references

In a further reference :

In a further reference