如何让完整或缩写的引文自动出现在 Tufte 脚注(旁注)中?

如何让完整或缩写的引文自动出现在 Tufte 脚注(旁注)中?

我正在尝试有前途的方法在引用已经被使用后,仅使用 \cite 自动生成 Tufte 文档中的缩写引用。但我遇到了一些困难和限制,我不确定如何解决:

  1. 我遇到了一个错误,即使参考文献尚未被引用,引用也会被缩写。
  2. 解决方案本身在 (sidenotes) 中不起作用\footnotes。那里的参考文献不会被识别为之前被引用过,因此始终会插入完整引用。这也凸显了 Tufte 类中可能存在的错误:这些完整引用会从脚注中“跳出”到它们自己的 (脚注段落)。
  3. 最后,在完美的世界中,我想从引用中省略 URL 和完整作者列表,但将它们保留在参考书目中。

以下是我得到的结果:

显示引用行为的示例输出


我正在使用 bibtex 并在 TeXShop 中构建我的 MWE(尽管我正在使用 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

相关内容