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

* Added vertical offset feature to \captions. (Thanks, Dan!)

\caption[short caption][offset]{normal caption}


git-svn-id: https://tufte-latex.googlecode.com/svn/trunk@120 516e2f36-ce3a-0410-bea4-1d4a03f5df72
master
Kevin M. Godby 16 лет назад
Родитель
Сommit
d5d54175db
3 измененных файлов: 25 добавлений и 21 удалений
  1. Двоичные данные
      sample-book.pdf
  2. Двоичные данные
      sample-handout.pdf
  3. +25
    -21
      tufte-common.def

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


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


+ 25
- 21
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
}%
}



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