Browse Source

* Added optional offset to the \cite command. See sample-handout.pdf for details.

* Multiple citations are now typeset in a single sidenote instead of multiple
  sidenotes.  This is how Tufte appears to handle them in his book and it will
  save us a lot of vertical space in the sidenote column.


git-svn-id: https://tufte-latex.googlecode.com/svn/trunk@78 516e2f36-ce3a-0410-bea4-1d4a03f5df72
master
Kevin M. Godby 17 years ago
parent
commit
2ff01295e6
5 changed files with 40 additions and 12 deletions
  1. BIN
      sample-book.pdf
  2. +1
    -1
      sample-book.tex
  3. BIN
      sample-handout.pdf
  4. +4
    -3
      sample-handout.tex
  5. +35
    -8
      tufte-common.sty

BIN
sample-book.pdf View File


+ 1
- 1
sample-book.tex View File

@@ -3,7 +3,7 @@
%%
% Book metadata
\title{A Tufte-Style Book\thanks{Thanks to Edward R.~Tufte for his inspiration.}}
\author[The Tufte-LaTeX Developers]{The Tufte-\LaTeX\ Developers}
\author[The Tufte-LaTeX Developers]{The Tufte-LaTeX\ Developers}
\publisher{Publisher of This Book}

%%


BIN
sample-handout.pdf View File


+ 4
- 3
sample-handout.tex View File

@@ -156,10 +156,11 @@ the \Verb|\bibliography| command. (See the end of this document for an
example.) If you do not want to print a bibliography at the end of your
document, use the \Verb|\nobibliography| command in its place.

To enter multiple citations at one location,\cite{Tufte2006,Tufte1990} you can
provide a list of keys separated by commas: \Verb|\cite{Tufte2006,Tufte1990}|.
To enter multiple citations at one location,\cite[-3\baselineskip]{Tufte2006,Tufte1990} you can
provide a list of keys separated by commas and the same optional vertical
offset argument: \Verb|\cite{Tufte2006,Tufte1990}|.
\begin{docspec}
\doccmd{cite\{\docarg{bibkey1,bibkey2,\ldots}\}}
\doccmd{cite[\docopt{offset}]\{\docarg{bibkey1,bibkey2,\ldots}\}}
\end{docspec}

\section{Figures and Tables}\label{sec:figures-and-tables}


+ 35
- 8
tufte-common.sty View File

@@ -421,12 +421,25 @@

%%
% Normal \cite behavior
\newcommand{\@tufte@normal@cite}[1]{%
\@for\@temp@bibkey:=#1\do{%
\sidenote{\bibentry{\@temp@bibkey}.}%
\newcounter{@tufte@num@bibkeys}%
\newcommand{\@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
\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\ }%
\bibentry{\@temp@bibkeyx}}%
{\bibentry{\@temp@bibkeyx};\ }%
\stepcounter{@tufte@num@bibkeys}%
}%
}%
}


%%
% Macros for holding the list of cite keys until after the \sidenote

@@ -438,10 +451,24 @@
\g@addto@macro\@tufte@citations{#1}
}

\newcommand{\@tufte@print@citations}{% puts each citation in its own margin note
\@for\@temp@bibkey:=\@tufte@citations\do{%
\marginpar{\@tufte@marginfont\@tufte@justification\bibentry{\@temp@bibkey}.}%
}
\newcommand{\@tufte@print@citations}[1][0pt]{% puts the citations in a margin note
% Snag the last bibentry in the list for later comparison
\let\@temp@last@bibkey\@empty%
\@for\@temp@bibkey:=\@tufte@citations\do{\let\@temp@last@bibkey\@temp@bibkey}%
\marginpar{%
\vspace*{#1}%
\@tufte@marginfont%
\@tufte@justification%
% Loop through all the bibentries, separating them with semicolons and spaces
\setcounter{@tufte@num@bibkeys}{0}%
\@for\@temp@bibkeyx:=\@tufte@citations\do{%
\ifthenelse{\equal{\@temp@last@bibkey}{\@temp@bibkeyx}}%
{\ifthenelse{\equal{\value{@tufte@num@bibkeys}}{0}}{}{and\ }%
\bibentry{\@temp@bibkeyx}}%
{\bibentry{\@temp@bibkeyx};\ }%
\stepcounter{@tufte@num@bibkeys}%
}%
}%
}

%%
@@ -549,7 +576,7 @@
%%
% Sidenote without the footnote mark

\providecommand\marginnote[2][0pt]{%
\newcommand\marginnote[2][0pt]{%
\let\cite\@tufte@infootnote@cite% use the in-sidenote \cite command
\gdef\@tufte@citations{}% clear out any old citations
\marginpar{\vspace*{#1}\@tufte@marginfont\@tufte@justification #2}%


Loading…
Cancel
Save