diff options
author | Karl Berry <karl@freefriends.org> | 2006-01-13 00:06:51 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2006-01-13 00:06:51 +0000 |
commit | cb337e08b47c579a5a770dfaf9835017f9e8c2c3 (patch) | |
tree | 2522ea200c733c331560bcd82bbdacf32e6eb38f /Master | |
parent | d0c6ac97b617833f87a1261c409460aa5963a91b (diff) |
sidecap
git-svn-id: svn://tug.org/texlive/trunk@1320 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r-- | Master/texmf-dist/tex/latex/sidecap/sidecap.sty | 337 |
1 files changed, 337 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/sidecap/sidecap.sty b/Master/texmf-dist/tex/latex/sidecap/sidecap.sty new file mode 100644 index 00000000000..880c1aab5e1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/sidecap/sidecap.sty @@ -0,0 +1,337 @@ +%% +%% This is file `sidecap.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% sidecap.dtx (with options: `package') +%% +%% IMPORTANT NOTICE: +%% +%% For the copyright see the source file. +%% +%% Any modified versions of this file must be renamed +%% with new filenames distinct from sidecap.sty. +%% +%% For distribution of the original source see the terms +%% for copying and modification in the file sidecap.dtx. +%% +%% This generated file may be distributed as long as the +%% original source files, as listed above, are part of the +%% same distribution. (The sources need not necessarily be +%% in the same archive or directory.) +%% File: sidecap.dtx +%% +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{sidecap} + [2003/06/06 v1.6f SideCap Package (RN/HjG)] + + +\RequirePackage{ifthen} + +\@ifdefinable{\SC@BOXWD}{\newdimen\SC@BOXWD} +\@ifdefinable{\SC@CAPWD}{\newdimen\SC@CAPWD} +\@ifdefinable{\SC@tempdima}{\newdimen\SC@tempdima} +\@ifdefinable{\SC@tempdimb}{\newdimen\SC@tempdimb} +\newcounter{SC@C} \newsavebox{\SC@BOX} \newcommand*{\SC@FLOAT}{} +\newcommand*{\SC@IDENT}{SC@\number\value{SC@C}} +\newcommand*\SC@label[1]{\gdef\SC@LABtext{#1}\ignorespaces} +\newcommand*\SC@orig@caption{} \newcommand*\SC@orig@label{} +\newcommand*\sidecaptionsep{} \newcommand*\SC@pageref{} +\edef\sidecaptionsep{\the\marginparsep} +\newcommand*\sidecaptionrelwidth{1.0} +\newcommand*\sidecaptionvpos[2]{% 2002/08/31 + \@namedef{SC@#1@vpos}{#2}% +} + +\newboolean{SC@wide} +\def\SC@widefalse{\global\let\ifSC@wide\iffalse} +\def\SC@widetrue {\global\let\ifSC@wide\iftrue} + + % Kann man auf dieses Laengenregister verzichten? Nein! (RN) <****> + +\newcommand*\SC@calcwidths[1]{% + \SC@tempdima#1\relax + \SC@BOXWD\wd\SC@BOX + \SC@CAPWD\SC@fraction\SC@BOXWD + \@tempdima\SC@BOXWD + \advance\@tempdima\SC@CAPWD + \advance\@tempdima\sidecaptionsep + \ifdim\@tempdima>\SC@tempdima + \advance\SC@CAPWD-\@tempdima + \advance\SC@CAPWD\SC@tempdima + \fi + \SC@tempdimb\@tempdima +} + +\newcommand*{\isSC@WIDEi}[2]{\ifSC@wide#1\else#2\fi} %default: false +\newcommand*{\isSC@WIDEii}[2]{\ifSC@wide#1\else#2\fi} %default: false + + +\newcommand*\SC@justify{} +\newcommand*\SC@justify@caption{} +\newcommand*\SC@justify@body{} + +\newboolean{SC@origRagged} \setboolean{SC@origRagged}{false} %% ??? +\newcommand*{\SC@SaveCommands}{% + \let\SC@orig@caption=\caption \let\SC@orig@label=\label% +} +\SC@SaveCommands % necessary? or even wrong? +\if@twoside + \newcommand*{\isSC@ODD}[2]{% + \ifthenelse{\isodd{\SC@pageref{\SC@IDENT}}}{#1}{#2}} +\else + \newcommand*{\isSC@ODD}[2]{#1}% +\fi +\DeclareOption{innercaption}{% + \renewcommand*{\SC@FLOAT}[2]{% + \isSC@ODD{{#1}\hspace{\sidecaptionsep}{#2}} {{#2}\hspace{\sidecaptionsep}{#1}}} + \renewcommand*\SC@justify@caption{% + \isSC@ODD{\RaggedLeft}{\RaggedRight}} +} + +\DeclareOption{outercaption}{% + \renewcommand*{\SC@FLOAT}[2]{% + \isSC@ODD{{#2}\hspace{\sidecaptionsep}{#1}} {{#1}\hspace{\sidecaptionsep}{#2}}} + \renewcommand*\SC@justify@caption{% + \isSC@ODD{\RaggedRight}{\RaggedLeft}} +} + +\DeclareOption{rightcaption}{% + \renewcommand*{\SC@FLOAT}[2]{{#2}\hspace{\sidecaptionsep}{#1}} + \def\SC@justify@caption{\RaggedRight}% +} + +\DeclareOption{leftcaption}{% + \renewcommand*{\SC@FLOAT}[2]{{#1}\hspace{\sidecaptionsep}{#2}} + \def\SC@justify@caption{\RaggedLeft}% +} +\DeclareOption{wide}{% + \renewcommand*{\isSC@WIDEi}[2]{\if@twocolumn #2\else #1\fi}% ??? + \renewcommand*{\isSC@WIDEii}[2]{#1}} +\DeclareOption{raggedright}{% + \def\SC@justify{\RaggedRight}} +\DeclareOption{raggedleft}{% + \def\SC@justify{\RaggedLeft}} +\DeclareOption{ragged}{% + \def\SC@justify{\SC@justify@caption}% \let ? +} +\DeclareOption{origragged}{\setboolean{SC@origRagged}{true}} +\DeclareOption{margincaption}{% + \ds@outercaption\ds@outerbody\ds@wide + \let\ds@innercaption\@empty + \let\ds@leftcaption\@empty + \let\ds@rightcaption\@empty + \def\SC@calcwidths#1{% + \SC@tempdimb#1\relax + \SC@BOXWD\SC@tempdimb % *-form !!! ??? + \advance\SC@BOXWD-\marginparwidth + \advance\SC@BOXWD-\marginparsep + \SC@CAPWD\marginparwidth + }% +} +\DeclareOption{innerbody}{% + \def\SC@justify@body{% + \isSC@ODD{\RaggedRight}{\RaggedLeft}} +} + +\DeclareOption{outerbody}{% + \def\SC@justify@body{% + \isSC@ODD{\RaggedLeft}{\RaggedRight}} +} + +\DeclareOption{centerbody}{% + \def\SC@justify@body{\Centering} +} + +\DeclareOption{rightbody}{% + \def\SC@justify@body{\RaggedLeft}% +} + +\DeclareOption{leftbody}{% + \def\SC@justify@body{\RaggedRight}% +} +\ExecuteOptions{outercaption} +%%\InputIfFileExists{sidecap.cfg}{}{} % hier ? % 2002/06/14 +\ProcessOptions\relax +\AtBeginDocument{% + \ifSC@origRagged\else + \@ifpackageloaded{ragged2e}{}% + {% + \IfFileExists{ragged2e.sty}{% + \RequirePackage[NewParameters]{ragged2e}}% + {% + \PackageWarningNoLine{sidecap}{% + Package `ragged2e' not found -- expect bad formatting}% + }% + } + \fi + \@ifundefined{RaggedRight}% + {% + \let\RaggedLeft\raggedleft + \let\RaggedRight\raggedright + \let\Centering\centering + }{} + \@ifpackageloaded{hyperref}% + {\let\SC@pageref=\hypergetpageref}% + {% + \@ifpackageloaded{babel}% + {\let\SC@pageref=\org@pageref}% + {\let\SC@pageref=\pageref}% + } +} + +\@ifdefinable\SC@figure@vpos{\def\SC@figure@vpos{b}} +\newenvironment{SCfigure}{\SC@float[\SC@figure@vpos]{figure}}{\endSC@float} +\newenvironment{SCfigure*}{\SC@dblfloat[\SC@figure@vpos]{figure}}{\endSC@dblfloat} + + +\@ifdefinable\SC@table@vpos{\def\SC@table@vpos{t}} +\newenvironment{SCtable}{\SC@float[\SC@table@vpos]{table}}{\endSC@float} +\newenvironment{SCtable*}{\SC@dblfloat[\SC@table@vpos]{table}}{\endSC@dblfloat} + +\newenvironment{wide}% +{% + \@parboxrestore% 2002/06/14 -- SW-Arch.: wozu? 2002/08/24 + \advance\linewidth\marginparwidth + \advance\linewidth\marginparsep + \ifx\label\SC@label + \SC@widetrue + \else + \begin{lrbox}\SC@BOX % \begin necessary: --> \@noitemerr + \minipage\linewidth + \fi +}% +{% + \ifx\label\SC@label +\typeout{WIDE: inside SCfloat}% + %\renewcommand*{\isSC@WIDEi}[2]{\if@twocolumn ##2\else ##1\fi}% + %\renewcommand*{\isSC@WIDEii}[2]{##1}% + %\let\isSC@WIDE\isSC@WIDEi + \else +\typeout{WIDE: outside SCfloat}% + \endminipage + \end{lrbox}% \end necessary: --> \@noitemerr + \global\advance\c@SC@C\@ne + \SC@orig@label{\SC@IDENT}% nicht \ref... !!! + \trivlist \item\relax + \isSC@ODD{\def\SC@hpos{l}}{\def\SC@hpos{r}}% +\typeout{WIDE: \string\linewidth=\the\linewidth}% + \noindent\makebox[\textwidth][\SC@hpos]{\copy\SC@BOX}% \usebox{\SC@BOX} + \endtrivlist + \fi +} + +\def\SC@float{\SC@SaveCommands\@ifnextchar[\SC@xfloat{\SC@xfloat[c]}} +\def\SC@xfloat[#1]#2{\@ifnextchar[% + {\SC@yfloat{#1}{#2}}% + {\SC@zfloat{#1}{#2}{\sidecaptionrelwidth}[\@nameuse{fps@#2}]}} +\def\SC@yfloat#1#2[#3]{\@ifnextchar[% + {\SC@zfloat{#1}{#2}{#3}}% + {\SC@zfloat{#1}{#2}{#3}[\@nameuse{fps@#2}]}} +\def\SC@zfloat#1#2#3[#4]{% + \def\SC@vpos{#1}% + \expandafter\edef\csname fps@#2\endcsname{#4}% + \def\SC@captype{#2}% + \ifx#3\@empty\def\SC@fraction{1}\else\def\SC@fraction{#3}\fi% + \let\SC@CAPtext\@empty \let\SC@OPTCAPtext\@empty \let\SC@LABtext\@empty% + \renewcommand\caption[2][]{\gdef\SC@OPTCAPtext{##1}% + \gdef\SC@CAPtext{##2}\ignorespaces}% \SC@justify + \let\label=\SC@label + \@namedef{fnum@#2}{\mbox{\@nameuse{#2name}~\@nameuse{the#2}}}% caption2 ? + \SC@widefalse + \begin{lrbox}\SC@BOX % \begin necessary: --> \@noitemerr + %%% \strut +}% + +\def\SC@dblfloat{% + \SC@SaveCommands% + \if@twocolumn\let\reserved@a\SC@dbflt\else\let\reserved@a\SC@float\fi + \reserved@a} +\def\SC@dbflt{\SC@float} +\def\endSC@float{% + %%% \strut + \end{lrbox}% \end necessary: --> \@noitemerr + \let\isSC@WIDE\isSC@WIDEi% + \def\@FLOAT{\@float}\def\end@FLOAT{\end@float}% + \isSC@WIDE% + {\@tempdima\textwidth % \columnwidth ??? + \advance\@tempdima\marginparwidth + \advance\@tempdima\marginparsep}% + {\@tempdima\columnwidth}% + \endSC@FLOAT\@tempdima}% +\def\endSC@dblfloat{% + \end{lrbox}% \end necessary: --> \@noitemerr + \let\isSC@WIDE\isSC@WIDEii% + \def\@FLOAT{\@dblfloat}\def\end@FLOAT{\end@dblfloat}% + \isSC@WIDE% + {\@tempdima\textwidth% + \advance\@tempdima\marginparwidth + \advance\@tempdima\marginparsep}% + {\@tempdima\textwidth}% +\typeout{endSC@dblfloat: \string\@tempdima=\the\@tempdima}% + \endSC@FLOAT\@tempdima}% +\def\endSC@FLOAT#1{% + \SC@calcwidths{#1}% + \@FLOAT{\SC@captype}% + \abovecaptionskip\z@skip + \belowcaptionskip\z@skip + \global\advance\c@SC@C\@ne + \SC@orig@label{\SC@IDENT}% nicht \ref... !!! + \isSC@WIDE% + {\ifdim\SC@tempdimb>\textwidth % ??? + \isSC@ODD{\def\SC@hpos{l}}{\def\SC@hpos{r}}% + \else% + \def\SC@hpos{c}% + \fi + \@tempdimc\textwidth}% ??? + {\@tempdimc\SC@tempdima\def\SC@hpos{c}}% + \makebox[\@tempdimc][\SC@hpos]{% + \SC@FLOAT% + {\minipage[\SC@vpos]{\SC@CAPWD}% + %% \nointerlineskip %\offinterlineskip% + %% \kern0pt\relax + \hrule \@height\z@\@depth\z@ %%% Testen, Doku. (Implementierung) !!! + %\show\SC@justify@caption +%%% \tracingall\tracingonline=0 + \SC@justify + \let\@arrayparboxrestore\relax % sonst Blocksatz! (\@parboxrestore) + \let\usecaptionmargin\relax % sonst Pseudo-Blocksatz, nicht-alternierend! +%%% A B C +\iffalse + \endgraf + \@makecaption{\csname fnum@\SC@captype\endcsname}% + {\ignorespaces \SC@CAPtext}% + \endgraf +\else + % \ifthenelse{\equal{\SC@OPTCAPtext}{\@empty}}% + \ifx\SC@OPTCAPtext\@empty% Noetig? + \SC@orig@caption[\SC@CAPtext]% + {\strut\ignorespaces\SC@CAPtext\unskip\strut}% \expandafter\protect + \else + \SC@orig@caption[\SC@OPTCAPtext]% \expandafter\protect + {\strut\ignorespaces\SC@CAPtext\unskip\strut}% \expandafter\protect + \fi + \unskip% ??? Dok. !!! + \ifx\SC@LABtext\@empty\else + \SC@orig@label{\SC@LABtext}\fi% \expandafter\protect +\fi +%%% X Y Z + \hrule \@height\z@\@depth\z@ + \endminipage}% + {\minipage[\SC@vpos]{\SC@BOXWD}% + %% \nointerlineskip %\offinterlineskip% + %% \kern0pt\relax + \hrule \@height\z@\@depth\z@ + \SC@justify@body + \unhbox\SC@BOX % \strut \unhbox/\usebox{\SC@BOX}% TESTEN! + % \kern0pt\relax + \hrule \@height\z@\@depth\z@ + \endminipage}% + }% + \end@FLOAT% +} +\InputIfFileExists{sidecap.cfg}{}{} % hier ? % 2002/06/14 +\endinput +%% +%% End of file `sidecap.sty'. |