diff --git a/sample-book.pdf b/sample-book.pdf index 4ffc450..f6d2189 100644 Binary files a/sample-book.pdf and b/sample-book.pdf differ diff --git a/sample-handout.pdf b/sample-handout.pdf index a22a342..aab9deb 100644 Binary files a/sample-handout.pdf and b/sample-handout.pdf differ diff --git a/tufte-common.def b/tufte-common.def index b70711f..ab05cc0 100644 --- a/tufte-common.def +++ b/tufte-common.def @@ -1030,16 +1030,21 @@ \let\@tufte@orig@label\label% } +% New length for tweaking float captions +\newlength{\@tufte@caption@vertical@offset} +\setlength{\@tufte@caption@vertical@offset}{0pt} + % Store the caption and label contents \newcommand{\@tufte@stored@shortcaption}{} \newcommand{\@tufte@stored@caption}{} \newcommand{\@tufte@stored@label}{} -\newcommand{\@tufte@caption}[2][]{% +\long\def\@tufte@caption[#1][#2]#3{% \ifthenelse{\isempty{#1}}% - {\gdef\@tufte@stored@shortcaption{#2}}% + {\gdef\@tufte@stored@shortcaption{#3}}% {\gdef\@tufte@stored@shortcaption{#1}}% - \gdef\@tufte@stored@caption{#2}% + \gdef\@tufte@caption@vertical@offset{-#2}% we want positive push to lower captions + \gdef\@tufte@stored@caption{#3}% } \newcommand{\@tufte@label}[1]{% @@ -1071,8 +1076,8 @@ \ifthenelse{\equal{#1}{b}\OR\equal{#1}{B}}% {\renewcommand{\floatalignment}{b}}% {\renewcommand{\floatalignment}{t}}% - % Caption the contents of the \caption and \label commands to use later - \renewcommand{\caption}[2][]{\@tufte@caption[##1]{##2}}% + % Capture the contents of the \caption and \label commands to use later + \renewcommand{\caption}{\optparams{\@tufte@caption}{[][0pt]}}% \renewcommand{\label}[1]{\@tufte@label{##1}}% \@tufte@orig@float{#2}[#1]% \ifthenelse{\boolean{@tufte@float@star}}% @@ -1096,8 +1101,8 @@ \begin{fullwidth}% \begin{minipage}[\floatalignment]{\linewidth}% \ifthenelse{\boolean{@tufte@float@star}}% - {\@tufte@float@fullwidth{\@tufte@figure@box}{\@tufte@caption@box}}% - {\@tufte@float@textwidth{\@tufte@figure@box}{\@tufte@caption@box}}% + {\@tufte@float@fullwidth[\@tufte@caption@vertical@offset]{\@tufte@figure@box}{\@tufte@caption@box}}% + {\@tufte@float@textwidth[\@tufte@caption@vertical@offset]{\@tufte@figure@box}{\@tufte@caption@box}}% \end{minipage}% \end{fullwidth}% \@tufte@orig@endfloat% @@ -1108,37 +1113,36 @@ \begin{lrbox}{\@tufte@caption@box}\hbox{}\end{lrbox}% \gdef\@tufte@stored@shortcaption{}% \gdef\@tufte@stored@caption{}% + \gdef\@tufte@caption@vertical@offset{0pt}% reset caption push } -\newcommand{\@tufte@float@textwidth}[2]{% +\newcommand{\@tufte@float@textwidth}[3][0pt]{% \ifthenelse{\NOT\boolean{@tufte@symmetric}\OR\boolean{@tufte@float@recto}}{% % asymmetric or page is odd, so caption is on the right \hbox{% - \usebox{#1}% + \usebox{#2}% \hspace{\marginparsep}% - \smash{\usebox{#2}}% + \smash{\raisebox{#1}{\usebox{#3}}}% }% - }{% - % symmetric pages and page is even, so caption is on the left + }{% symmetric pages and page is even, so caption is on the left \hbox{% - \smash{\usebox{#2}}% + \smash{\raisebox{#1}{\usebox{#3}}}% \hspace{\marginparsep}% - \usebox{#1}% + \usebox{#2}% }% }% } -\newcommand{\@tufte@float@fullwidth}[2]{% +\newcommand{\@tufte@float@fullwidth}[3][0pt]{% \ifthenelse{\equal{\floatalignment}{b}}% {% place caption above figure \ifthenelse{\NOT\boolean{@tufte@symmetric}\OR\boolean{@tufte@float@recto}}% - {\hfill\smash{\usebox{#2}}\par\usebox{#1}}% caption on the right - {\smash{\usebox{#2}\hfill}\par\usebox{#1}}% caption on the left - }% - {% place caption below figure + {\hfill\smash{\raisebox{#1}{\usebox{#3}}}\par\usebox{#2}}% caption on the right + {\smash{\raisebox{#1}{\usebox{#3}}}\hfill\par\usebox{#2}}% caption on the left + }{% place caption below figure \ifthenelse{\NOT\boolean{@tufte@symmetric}\OR\boolean{@tufte@float@recto}}% - {\usebox{#1}\par\hfill\smash{\usebox{#2}}}% caption on the right - {\usebox{#1}\par\smash{\usebox{#2}\hfill}}% caption on the left + {\usebox{#2}\par\hfill\smash{\raisebox{#1}{\usebox{#3}}}}% caption on the right + {\usebox{#2}\par\smash{\raisebox{#1}{\usebox{#3}}}\hfill}% caption on the left }% }