I'm experimenting with a promising approach to generate generate abbreviated citations in Tufte documents automatically using \cite alone, once a reference has already been used. But I've encounters some difficulties and limitations that I'm not sure how to fix:
- I'm experiencing a bug, in which citations are abbreviated even when a references has not yet been cited.
- The solution as it is does not work within
\footnotes(sidenotes). References there are not recognized as having been cited before, so full citations are always inserted. This also highlights what may be a bug in the Tufte classes: these full citations "jump out" of the footnote into their own (footnote paragraph). - Finally, in a perfect world, I'd like to omit URLs and full author lists from citations, while keeping them in the bibliography.
Here's what I'm getting:

I'm using bibtex and building my MWE in TeXShop (though I'm building my documents using LyX).
\documentclass[]{tufte-handout}
%From --- https://tex.stackexchange.com/a/45878/7844
% Redefine some footnote code to support additional features:
\usepackage{etoolbox}% provides some support for comma-separated lists
\makeatletter
% We'll keep track of the old/seen bibkeys here.
\def\@tufte@old@bibkeys{}
% This macro prints the full citation if it's the first time it's been used
% and a shorter citation if it's been used before.
\newcommand{\@tufte@print@margin@citation}[1]{%
% print full citation if bibkey is not in the old bibkeys list
\ifinlist{#1}{\@tufte@old@bibkeys}{%
\citealp{#1}% print short entry
}{%
\bibentry{#1}% print full entry
}%
% add bibkey to the old bibkeys list
\listgadd{\@tufte@old@bibkeys}{#1}%
}
% We've modified this Tufte-LaTeX macro to call \@tufte@print@margin@citation
% instead of \bibentry.
\renewcommand{\@tufte@normal@cite}[2][0pt]{%
% Snag the last bibentry in the list for later comparison
\let\@temp@last@bibkey\@empty%
\@for\@temp@bibkey:=#2\do{\let\@temp@last@bibkey\@temp@bibkey}%
\sidenote[][#1]{%
% Loop through all the bibentries, separating them with semicolons and spaces
\normalsize\normalfont\@tufte@citation@font%
\setcounter{@tufte@num@bibkeys}{0}%
\@for\@temp@bibkeyx:=#2\do{%
\ifthenelse{\equal{\@temp@last@bibkey}{\@temp@bibkeyx}}{%
\ifthenelse{\equal{\value{@tufte@num@bibkeys}}{0}}{}{and\ }%
\@tufte@trim@spaces\@temp@bibkeyx% trim spaces around bibkey
\@tufte@print@margin@citation{\@temp@bibkeyx}%
}{%
\@tufte@trim@spaces\@temp@bibkeyx% trim spaces around bibkey
\@tufte@print@margin@citation{\@temp@bibkeyx};\space
}%
\stepcounter{@tufte@num@bibkeys}%
}%
}%
}\begin{document}
%end From
This is the first occurrence of a citation,\cite{Deutsch:2002} which works as expected. I would also ideally like to be able to cite the same paper again, and have it appear automatically in some abbreviated form. Whereas before I had to do this manually with a footnote and ERT\footnote{\citealp{Deutsch:2002}} that now happens automatically\cite{Deutsch:2002}, thanks to "godbyk".
But although these basics work, I'm still having problems getting this to work quite the way I'd like (or that it seems they should in general):
\begin{enumerate}
\item First, what seems to be a bug: even in cases were a reference has not been used before, I'm getting abbreviated citations.\cite{Sarukkai:2005}\cite{Neeley:1907}
\item Second, citations \textit{within footnotes} (a key feature of the Tufte books) don't behave as they should. Those that appear in full, "jump out" of the note into a new paragraph within the note\footnote{There should be a full citation right here,\cite{OConnell:2010} but it's down there.}, and those that should appear as abbreviated citations (since the've been cited before) are still cited in full (and again, "jump out" of the note).\footnote{This\cite{Deutsch:2002} (look below) should be abbreviated, but it isn't.}
\item Finally, I'd like to be able to exclude URLs and full author lists from (initial, full) citations, but keep them in the bibliography (ideally on their own line), though that may be to much to ask.
\end{enumerate}
Thanks again for any assistance!
\bibliographystyle{unsrtnat}
\bibliography{References}
\end{document}
%See edit history for .bib contents