Просмотр исходного кода

* Added additional optional parameters to \sidenote (and \footnote). Usage:

\sidenote[num][dimension]{Sidenote text.} where ``num'' is the sidenote
  number and ``dimension'' is the amount of space to move the sidenote down the
  page.   (Negative values will move the sidenote up the page.)


git-svn-id: https://tufte-latex.googlecode.com/svn/trunk@73 516e2f36-ce3a-0410-bea4-1d4a03f5df72
master
Kevin M. Godby 17 лет назад
Родитель
Сommit
241feaafff
5 измененных файлов: 83 добавлений и 27 удалений
  1. Двоичные данные
      sample-book.pdf
  2. +2
    -2
      sample-book.tex
  3. Двоичные данные
      sample-handout.pdf
  4. +15
    -16
      sample-handout.tex
  5. +66
    -9
      tufte-common.sty

Двоичные данные
sample-book.pdf Просмотреть файл


+ 2
- 2
sample-book.tex Просмотреть файл

@@ -9,8 +9,8 @@
%% %%
% If they're installed, use Bergamo and Chantilly from www.fontsite.com. % If they're installed, use Bergamo and Chantilly from www.fontsite.com.
% They're clones of Bembo and Gill Sans, respectively. % They're clones of Bembo and Gill Sans, respectively.
\IfFileExists{bergamo.sty}{\usepackage[osf]{bergamo}}{}% Bembo
\IfFileExists{chantill.sty}{\usepackage{chantill}}{}% Gill Sans
%\IfFileExists{bergamo.sty}{\usepackage[osf]{bergamo}}{}% Bembo
%\IfFileExists{chantill.sty}{\usepackage{chantill}}{}% Gill Sans


%\usepackage{microtype} %\usepackage{microtype}




Двоичные данные
sample-handout.pdf Просмотреть файл


+ 15
- 16
sample-handout.tex Просмотреть файл

@@ -1,4 +1,4 @@
\documentclass[nofonts]{tufte-handout}
\documentclass{tufte-handout}


\usepackage{amsmath} \usepackage{amsmath}


@@ -16,19 +16,19 @@
%% %%
% If we have Bergamo and Chantilly fonts (from www.fontsite.com) installed, % If we have Bergamo and Chantilly fonts (from www.fontsite.com) installed,
% use them. Bergamo is a clone of Bembo and Chantilly is similar to Gill Sans. % use them. Bergamo is a clone of Bembo and Chantilly is similar to Gill Sans.
\makeatletter
\ifthenelse{\NOT\boolean{@tufte@xetex}}
{%
\IfFileExists{bergamo.sty}{\usepackage[osf]{bergamo}}{}% Bembo clone
\IfFileExists{chantill.sty}{\usepackage{chantill}}{}% Gill Sans clone
}{% We're using XeTeX -- load fontspec, etc.
\usepackage{fontspec}
\usepackage{xltxtra}
\setromanfont{Bergamo}% Bembo clone
\setsansfont{Chantilly}% Gill Sans clone
\setmonofont{Bitstream Vera Sans Mono}%
}
\makeatother
%\makeatletter
%\ifthenelse{\NOT\boolean{@tufte@xetex}}
% {%
% \IfFileExists{bergamo.sty}{\usepackage[osf]{bergamo}}{}% Bembo clone
% \IfFileExists{chantill.sty}{\usepackage{chantill}}{}% Gill Sans clone
% }{% We're using XeTeX -- load fontspec, etc.
% \usepackage{fontspec}
% \usepackage{xltxtra}
% \setromanfont{Bergamo}% Bembo clone
% \setsansfont{Chantilly}% Gill Sans clone
% \setmonofont{Bitstream Vera Sans Mono}%
% }
%\makeatother


% The following package makes prettier tables. We're all about the bling! % The following package makes prettier tables. We're all about the bling!
\usepackage{booktabs} \usepackage{booktabs}
@@ -74,7 +74,7 @@ This style provides \textsc{a}- and \textsc{b}-heads (that is,
\Verb|\section| and \Verb|\subsection|) demonstrated above. \Verb|\section| and \Verb|\subsection|) demonstrated above.


If you need more than two levels of section headings, you'll have to define If you need more than two levels of section headings, you'll have to define
them yourself at the moment;\sidenote{See see ``Defining new sections'' on
them yourself at the moment;\sidenote{See see ``\nameref{sec:defining-sections}'' on
page~\pageref{sec:defining-sections} for help with defining more heading page~\pageref{sec:defining-sections} for help with defining more heading
levels.} there are no pre-defined styles for anything below a levels.} there are no pre-defined styles for anything below a
\Verb|\subsection|. As Bringhurst points out in \textit{The Elements of \Verb|\subsection|. As Bringhurst points out in \textit{The Elements of
@@ -314,7 +314,6 @@ class relies upon. Packages marked with an asterisk are optional.
\item chngpage \item chngpage
\item paralist \item paralist
\item textcase \item textcase
\item footmisc
\item natbib and bibentry \item natbib and bibentry
\item placeins \item placeins
\item caption \item caption


+ 66
- 9
tufte-common.sty Просмотреть файл

@@ -146,12 +146,11 @@
% Load the `hyperref' package. We will set more options later. % Load the `hyperref' package. We will set more options later.
% TODO Set nice defaults for hyperref options % TODO Set nice defaults for hyperref options
\ifthenelse{\boolean{@tufte@xetex}} \ifthenelse{\boolean{@tufte@xetex}}
{\RequirePackage[xetex]{hyperref}}
{\RequirePackage{hyperref}}
{\RequirePackage[hyperfootnotes=false,xetex]{hyperref}}
{\RequirePackage[hyperfootnotes=false]{hyperref}}


\hypersetup{% \hypersetup{%
pdfborder = {0 0 0}, pdfborder = {0 0 0},
hyperfootnotes = false
} }


%% %%
@@ -414,8 +413,6 @@
\nobibliography* % pre-loads the bibliography keys \nobibliography* % pre-loads the bibliography keys
\providecommand{\doi}[1]{\textsc{doi:} #1} % pre-defining this so it may be used before the \bibliography command it issued \providecommand{\doi}[1]{\textsc{doi:} #1} % pre-defining this so it may be used before the \bibliography command it issued


\let\sidenote\footnote% This will be redefined shortly

%% %%
% Normal \cite behavior % Normal \cite behavior
\newcommand{\@tufte@normal@cite}[1]{% \newcommand{\@tufte@normal@cite}[1]{%
@@ -458,7 +455,8 @@
% Transform existing \footnotes into \sidenotes % Transform existing \footnotes into \sidenotes
% Sidenote: ``Where God meant footnotes to go.'' ---Tufte % Sidenote: ``Where God meant footnotes to go.'' ---Tufte


\RequirePackage[side,multiple,stable]{footmisc}
\RequirePackage{optparams}% for our new sidenote commands -- provides multiple optional arguments for commands

\providecommand*{\footnotelayout}{\@tufte@marginfont\@tufte@justification} \providecommand*{\footnotelayout}{\@tufte@marginfont\@tufte@justification}
\renewcommand{\footnotelayout}{\@tufte@marginfont\@tufte@justification} \renewcommand{\footnotelayout}{\@tufte@marginfont\@tufte@justification}


@@ -469,20 +467,79 @@
% Set the in-text footnote mark in the same typeface as the body text itself. % Set the in-text footnote mark in the same typeface as the body text itself.
\def\@makefnmark{\hbox{\@textsuperscript{\normalfont\scriptsize\@thefnmark}}} \def\@makefnmark{\hbox{\@textsuperscript{\normalfont\scriptsize\@thefnmark}}}


\providecommand*{\multiplefootnotemarker}{3sp}
\providecommand*{\multfootsep}{,}

\renewcommand*\@footnotemark{%
\leavevmode%
\ifhmode%
\edef\@x@sf{\the\spacefactor}%
\@tufte@check@multiple@sidenotes%
\nobreak%
\fi%
\@makefnmark%
\ifhmode\spacefactor\@x@sf\fi%
\relax%
}

\newcommand{\@tufte@check@multiple@sidenotes}{%
\ifdim\lastkern=\multiplefootnotemarker\relax
\edef\@x@sf{\the\spacefactor}%
\unkern
\textsuperscript{\multfootsep}%
\spacefactor\@x@sf\relax
\fi
}

\renewcommand\@footnotetext[2][0pt]{%
\marginpar{%
\vspace*{#1}%
\def\baselinestretch {\setspace@singlespace}%
\reset@font\footnotesize%
\protected@edef\@currentlabel{%
\csname p@footnote\endcsname\@thefnmark%
}%
\color@begingroup%
\@makefntext{%
\ignorespaces#2%
}%
\color@endgroup%
}%
}%

% %
% Define \sidenote command. Can handle \cite. % Define \sidenote command. Can handle \cite.


\renewcommand{\sidenote}[1]{%
\newcommand{\@tufte@sidenote@vertical@offset}{0pt}

% #1 = footnote num, #2 = vertical offset, #3 = footnote text
\def\@tufte@sidenote[#1][#2]#3{%
\let\cite\@tufte@infootnote@cite% use the in-sidenote \cite command \let\cite\@tufte@infootnote@cite% use the in-sidenote \cite command
\gdef\@tufte@citations{}% clear out any old citations \gdef\@tufte@citations{}% clear out any old citations
\footnote{#1}% print the actual sidenote
\ifthenelse{\NOT\isempty{#2}}{\renewcommand{\@tufte@sidenote@vertical@offset}{#2}}{}%
\ifthenelse{\isempty{#1}}{%
% % no footnote number
\stepcounter\@mpfn%
\protected@xdef\@thefnmark{\thempfn}%
\@footnotemark\@footnotetext[\@tufte@sidenote@vertical@offset]{#3}%
}{%
% % footnote number
\begingroup%
\csname c@\@mpfn\endcsname #1\relax%
\unrestored@protected@xdef\@thefnmark{\thempfn}%
\endgroup%
\@footnotemark\@footnotetext[\@tufte@sidenote@vertical@offset]{#3}%
}%
\@tufte@print@citations% print any citations \@tufte@print@citations% print any citations
\let\cite\@tufte@normal@cite% go back to using normal in-text \cite command \let\cite\@tufte@normal@cite% go back to using normal in-text \cite command
\unskip\ignorespaces% remove extra white space \unskip\ignorespaces% remove extra white space
\kern-\multiplefootnotemarker% remove \kern left behind by sidenote \kern-\multiplefootnotemarker% remove \kern left behind by sidenote
\kern\multiplefootnotemarker\relax% add new \kern here to replace the one we yanked (used by footmisc's `multiple' option)
\kern\multiplefootnotemarker\relax% add new \kern here to replace the one we yanked
} }


\newcommand*{\sidenote}{\optparams{\@tufte@sidenote}{[][0pt]}}
\renewcommand*{\footnote}{\optparams{\@tufte@sidenote}{[][0pt]}}

%% %%
% Sidenote without the footnote mark % Sidenote without the footnote mark




Загрузка…
Отмена
Сохранить