[Tex/LaTex] BibTex/Natbib: References with exactly three authors require all authors on first occurence and first author et al on further occurences

author-numberbibtexnatbib

I'm writing a paper for a journal (MNRAS, the UK Royal Astronomical society journal) which requires that when I cite any papers with exactly three authors, I need to give the full author list at the first citation, but merely give first author et al on any further citations.

e.g. for an example, for a reference to a paper by Bloggs, Smith and Klein 1999 with a cite key of Bloggs1999, I want to be able to type into my latex file the following:

This information was found within \citet{Bloggs1999}. Referring again 
to this seminal paper \citep{Bloggs1999}.

And have this be typeset after running latex/bibtex/latex/latex as:

This information was found within Bloggs, Smith and Klein (1999). 
Referring again to this seminal paper (Bloggs et al. 1999).

The journal provided class and .bib file (mn2e.cls and mn2e.bst) don't support this (and mn2e.bst has a bunch of other problems anyway) unfortunately. I know that natbib lets you do this manually, with \citet and \citet*, but I was looking for something automatic, if anyone has any ideas.

Best Answer

Here is a proof of concept (no support for the optional argument, and something similar is needed for \citep and other cite commands), and also it assumes that the .bst style use "et al" for references for more that a single author.

The idea is to create something similar to \ifciteseen in biblatex. Thus we can create a list of references already cited in the document (and we exploit the list facilities of etoolbox). Then, if the reference has not been used before we use \citet*, and we add the key to the list of seen references. Otherwise, we use \citet.

\documentclass{article}
\usepackage{etoolbox}
\usepackage{natbib}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@article{test1,
  author = {Author, A. and Buthor, B and Cuthor, C and Duthor, D},
  title = {Title},
  journal = {Journal},
  year = 2013
}
@article{test2,
  author = {Author, A. and Buthor, B and Cuthor, C and Duthor, D},
  title = {Title},
  journal = {Journal},
  year = 2012
}
\end{filecontents}


\newcommand{\citelist}{}

\newcounter{currentcite}
\newcounter{currentcitetotal}
\newcommand{\mycite}[1]{
  \setcounter{currentcitetotal}{0}
  \renewcommand{\do}[1]{\addtocounter{currentcitetotal}{1}}
  \docsvlist{#1}
  \renewcommand{\do}[1]{%
  \addtocounter{currentcite}{1}%
  \ifinlist{##1}{\citelist}
    {\citet{##1}}
    {\citet*{##1}\listadd{\citelist}{##1}}%
  \ifnumcomp{\value{currentcitetotal}}{>}{\value{currentcite}}
    {, }
    {}%
  }
  \docsvlist{#1}
}


\begin{document}

\mycite{test1,test2}

\mycite{test1}

\mycite{test2}


\bibliographystyle{plainnat}
\bibliography{\jobname}
\end{document}

enter image description here