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}
This style seems to use author names and years in the reference abbreviations, i.e., something like [Smith94]
instead of [1]
. If that was the case, the weirdness would result because you do not supply authors (author = {...}
) in your BibTeX entries.
On their website, it says:
The in-text citation style is as follows: For parenthetical citations we enclose the last name of the first author and year of publication, thus: [Burando 2007];
Thus, you probably just need to supply author and year in the BibTeX and get good-looking citations.
Best Answer
You're posting contains two parts. The answers to both parts involve editing a copy of the bibliography style -- here,
abbrvnat.bst
. Begin by finding the fileabbrvnat.bst
in your TeX distribution and making a copy called, say,myabbrvnat.bst
. (Do not edit a file from the TeX distribution directly.) Use any text editor you're familiar with to do the editing; the editor you use for your tex files will do fine. As I show below, the required edits happily to be minor and thus easy to apply.Q1: How to change the listing of the bibliography items from being sorted alphabetically to being listed in the order they're cited in the body of the document?
A1: In the file
myabbrvnat.bst
, find the two lines that start withSORT
(uppercase is relevant). Comment out these lines -- or, if you prefer, just delete them.Q2: How to change the typesetting of the author's name (or authors' names) from
to
A2: To invert the order of given names and surnames of authors, find the string
(located in the function
format.names
, most likely on line 222) and change it toSave the file
myabbrvnat.bst
, either in the directory where your main tex file is located or in a directory that's searched by BibTeX. If you choose the latter method, be sure to update the filename database of your TeX distribution appropriately.And, in your main tex file, change the instruction
\bibliographystyle{abbrvnat}
to\bibliographystyle{myabbrvnat}
and run LaTeX, BibTeX, and LaTeX twice more to fully propagate all changes.