Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

  1. I'm experiencing a bug, in which citations are abbreviated even when a references has not yet been cited.
  2. 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).
  3. 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:

Example output showing citation behavior


I'm using bibtex and building my MWE in TeXShop (though I'm building my documents using LyX).

\documentclass[]{tufte-handout}

%From --- http://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
share|improve this question

closed as too localized by Marco Daniel, Stefan Kottwitz Mar 4 '12 at 17:27

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1  
How should citations within sidenotes appear? You mention that Tufte does this with his books; could you point me at an example? Thanks! –  godbyk Feb 27 '12 at 18:09
    
@godbyk: Sorry, "should" is of course entirely your call. I'm thinking of something along the lines of VE p.71, notes 36 and 38; or even note 7 on p.59. These are "conversational", in the sense that the citations appear naturally in the context of a brief discussion (as full entries when they are new, and as short citations when they are not, as in note 6, p.58). The same happens in captions, as on p.73. –  raxacoricofallapatorius Feb 27 '12 at 18:49
    
@godbyk: I've added illustrations of some of these examples to the question. –  raxacoricofallapatorius Mar 1 '12 at 19:26
    
@godbyk: As noted in the update to the original question, I've sorted this out (I think) using biblatex, which, I gather, is the direction to go anyway. I have a few more questions about fine tuning, but those are bib latex questions, for another day. –  raxacoricofallapatorius Mar 2 '12 at 23:23

Browse other questions tagged or ask your own question.