From 447d7dec07938e4d7bcb4d21fc180a696b39a7b9 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 11 Jan 2006 23:57:48 +0000
Subject: trunk/Master/texmf-dist/source/latex/sidecap

git-svn-id: svn://tug.org/texlive/trunk@515 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/sidecap/sidecap.dtx | 789 +++++++++++++++++++++
 1 file changed, 789 insertions(+)
 create mode 100644 Master/texmf-dist/source/latex/sidecap/sidecap.dtx

(limited to 'Master/texmf-dist/source/latex/sidecap/sidecap.dtx')

diff --git a/Master/texmf-dist/source/latex/sidecap/sidecap.dtx b/Master/texmf-dist/source/latex/sidecap/sidecap.dtx
new file mode 100644
index 00000000000..f42fa75e451
--- /dev/null
+++ b/Master/texmf-dist/source/latex/sidecap/sidecap.dtx
@@ -0,0 +1,789 @@
+% \iffalse
+%% File: sidecap.dtx 
+%%
+%
+%<package>\NeedsTeXFormat{LaTeX2e}
+%<package>\ProvidesPackage{sidecap}
+%<package>         [2003/06/06 v1.6f SideCap Package (RN/HjG)] 
+%
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage{sidecap}
+\GetFileInfo{sidecap.sty}
+\CodelineIndex
+\EnableCrossrefs
+\RecordChanges
+\begin{document}
+   \DocInput{sidecap.dtx}
+\end{document}
+%</driver>
+%
+% Copyright  1997--2003 Rolf Niepraschk and Hubert Gaesslein. 
+% This program can be redistributed and/or modified under the terms
+% of the LaTeX Project Public License Distributed from CTAN
+% archives in directory macros/latex/base/lppl.txt; either
+% version 1 of the License, or any later version.
+%
+% \fi
+%
+% \CheckSum{696}
+%
+% \CharacterTable
+% {Upper-case	 \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%  Lower-case	 \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%  Digits	 \0\1\2\3\4\5\6\7\8\9
+%  Exclamation   \!	Double quote  \"     Hash (number) \#
+%  Dollar	 \$	Percent       \%     Ampersand     \&
+%  Acute accent  \'	Left paren    \(     Right paren   \)
+%  Asterisk	 \*	Plus	      \+     Comma	   \,
+%  Minus	 \-	Point	      \.     Solidus	   \/
+%  Colon	 \:	Semicolon     \;     Less than     \<
+%  Equals	 \=	Greater than  \>     Question mark \?
+%  Commercial at \@	Left bracket  \[     Backslash     \\
+%  Right bracket \]	Circumflex    \^     Underscore    \_
+%  Grave accent  \`	Left brace    \{     Vertical bar  \|
+%  Right brace   \}	Tilde	      \~}
+%
+% \iffalse meta-comment
+% ===================================================================
+%  @LaTeX-package-file{
+%     author	      = {Rolf Niepraschk, Hubert G\"{a}\ss{}lein}
+%     version	      = "1.6e",
+%     date	      = "04 May 2003",
+%     filename        = "sidecap.sty",
+%     email	      = "niepraschk@ptb.de (INTERNET)",
+%     codetable       = "ISO/ASCII",
+%     keywords        = "LaTeX2e, sideways caption, \SCfigure, \SCtable",
+%     supported       = "yes",
+%     docstring       = "LaTeX package which defines new environments
+%			 for easy typesetting sideways captions and
+%			 wide floats".
+%  }
+% ===================================================================
+% \fi
+%
+%  \MakeShortVerb{\|}
+%  \setlength\parindent{0pt}
+%
+%  ^^A \CodelineIndex Fehler !!!
+%  ^^A \RecordChanges kein Fehler !!!
+%
+%  \changes{v1.0 (RN)}{1997/01/04}{New}
+%  \changes{v1.1 (RN/HjG)}{1997/05/01}{First public version}
+%  \changes{v1.2 (HjG)}{1998/01/29}{Proposal for amendments}
+%  \changes{v1.3 (RN/HjG)}{1998/01/29}{Unsuccessful attempt to make
+%               star-forms work}
+%  \changes{v1.4c (HjG)}{1998/06/05}{Successful (?) attempt to make
+%               star-forms work, plus some amendments}
+%  \changes{v1.4d (RN)} {1998/06/05}{New (LPPL) license}
+%  \changes{v1.5d (RN/HjG)}{2000/03/16}{Slight amendments to documentation.}
+%  \changes{v1.5h (RN/HjG)}{2002/05/24}{Improved compatibility with package
+%               hyperref.}
+%  \changes{v1.5h (RN/HjG)}{2002/05/24}{Environment wide does the right thing
+%               now outside SCfloat environments.}
+%
+%  \changes{v1.6d (RN/HjG)}{2002/09/13}{Simplify internal calculations
+%               using primitive operators where possible and useful,
+%               saving tokens (suggested by Frank Mittelbach.}
+%
+%  \IndexPrologue{^^A
+%     \section*{Index}^^A
+%     \markboth{Index}{Index}^^A
+%     Numbers written in \emph{italic} refer to the page where the
+%     corresponding entry is described, the ones
+%     \underline{underlined} to the definition, the rest to the places
+%     where the entry is used.}
+%
+%
+% ^^A -----------------------------
+%
+%  \title{\unskip
+%           The \textsf{sidecap} package^^A
+%        }
+%  \author{Rolf Niepraschk {\normalsize (\texttt{niepraschk@ptb.de})}\and 
+%          Hubert G\"a{\ss}lein}
+
+%  \date{\fileversion\ -- \filedate}
+%  \maketitle
+%
+%
+% ^^A -----------------------------
+%
+%
+%  \begin{abstract}
+%     This package defines the new environments |SCfigure| and |SCtable|,
+%     analogous to |figure| and |table|, which make it easy to 
+%     typeset captions sideways.
+%
+%     Additionally, a |wide| environment is defined; it allows to use
+%     the margin area, e.\,g., for figures wider than |\textwidth|.
+%
+%  \iffalse
+%     (???)
+%     Support for other types of floating environments is provided,
+%     e.\,g., as available by the |newfloat| package.
+%  \fi
+%  \end{abstract}
+%
+%  \pagestyle{headings}
+%
+% ^^A -----------------------------
+%
+% ^^A \tableofcontents
+%
+% ^^A -----------------------------
+%
+%  \section{Introduction}
+%
+%  In some cases it may be useful to typeset the caption aside the figure or
+%  the table. For this purpose the package \textsf{sidecap} defines the new 
+%  environments |SCfigure| and |SCtable|. The figure or the table and the 
+%  caption are put into two minipages that are positioned side by side and
+%  centered as a whole. The space between the minipages is |\sidecaptionsep|. The 
+%  correct positioning with respect to left and right pages requires at least 
+%  two compilation runs.
+%
+% ^^A -----------------------------
+%
+%  \section{Usage}
+%
+%  |\usepackage[|\meta{option}|]{sidecap}|
+%
+%  \smallskip  
+%
+%  |\begin{SCtable}  [|\meta{relwidth}|][|\meta{float}|] ... | 
+%  |\end{SCtable}|
+%
+%  |\begin{SCfigure} [|\meta{relwidth}|][|\meta{float}|] ... |
+%  |\end{SCfigure}|
+%
+%  \smallskip
+%  |\begin{SCtable*} [|\meta{relwidth}|][|\meta{float}|] ... | 
+%  |\end{SCtable*}|
+%
+%  |\begin{SCfigure*}[|\meta{relwidth}|][|\meta{float}|] ... |
+%  |\end{SCfigure*}|
+%
+%  \medskip
+%  \begin{center}
+%  \begin{tabular}{r@{~}p{.75\linewidth}}
+%    \meta{option} --   & |outercaption| (default): Caption appears left on 
+%                         left pages and right on right 
+%                         pages. \\[.25\baselineskip]
+%                       & |innercaption|: Caption appears right on left pages 
+%                         and left on right pages.\\[.25\baselineskip]
+%                       & |leftcaption|, |rightcaption|: Caption is always on 
+%                         the left or right, respectively.\\[.25\baselineskip]
+%                       & |wide|: The floating objects may extend into the
+%                         margin area.                       
+%                         \\[.25\baselineskip]
+%                       & |raggedright|, |raggedleft|, |ragged|: Better
+%                         justification for small captions.
+%                         The \textsf{ragged2e} package is used if available.
+%                         \\[.5\baselineskip]
+%    \meta{relwidth} -- & optional; caption width relative to the width of the 
+%                         figure or table. A large value (e.g., 50) reserves
+%                         the maximum width that is possible. 
+%                         Default is |\sidecaptionrelwidth|
+%                         (which is initialized to 1.0).\\[.5\baselineskip]
+%    \meta{float} --    & optional; like the floating position parameter of the
+%                         original table\slash figure environments. 
+%  		          Default is |tbp|. 		          
+%  \end{tabular}
+%  \end{center}
+%
+%  \medskip
+%  |\begin{wide} ... \end{wide}|
+%
+%  The |wide| environment may be used inside |figure| and |table|
+%  environments as well as in the normal text.
+%
+% ^^A -----------------------------
+%
+%  \section{Required packages}
+%
+%  This package requires the standard \LaTeX\ package \textsf{ifthen}.
+%
+% ^^A -----------------------------
+%
+%  \section{Supported packages}
+%
+%  This package is compatible with \LaTeX\ package \textsf{hyperref}
+%  (tested with version 6.71v as of 2001/11/12).
+%  If the |raggedright| or |raggedleft| or |ragged| package option has
+%  been given, then captions will be set with ragged margin.
+%  The \textsf{ragged2e} package will be used if it can be found.
+%
+%  \iffalse
+%  This package supports the \LaTeX\ package \textsf{newfloat},
+%  coming soon \dots\ (?)
+%  \fi
+%
+% ^^A -----------------------------
+%
+%  \StopEventually{^^A
+%     \PrintChanges\PrintIndex
+%     ^^A Make sure that the index is not printed twice
+%     ^^A (ltxdoc.cfg might have a second \PrintIndex command)
+%     \let\PrintChanges\relax
+%     \let\PrintIndex\relax
+%     }
+%
+% ^^A -----------------------------
+%
+%  \section{The implementation}
+%
+%  \subsection{Register allocation and auxiliary macros}
+%
+%    \begin{macrocode}
+%<*package>
+
+\RequirePackage{ifthen}
+
+\@ifdefinable{\SC@BOXWD}{\newdimen\SC@BOXWD}
+\@ifdefinable{\SC@CAPWD}{\newdimen\SC@CAPWD}
+% 2 noetig ???
+\@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]{#2}  %default: false
+%\newcommand*{\isSC@WIDEii}[2]{#2} %default: false
+\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*{\isSC@First}[2]{#1} %default: true
+
+\newcommand*\SC@justify{}
+\newcommand*\SC@justify@caption{}
+\newcommand*\SC@justify@body{}
+
+\newboolean{SC@origRagged} \setboolean{SC@origRagged}{false} %% ???
+%    \end{macrocode}
+% \begin{macro}{\SC@SaveCommands} 
+%  \changes{v1.5e (RN)}{2001/11/10}{\cmd\SC@AtFirstCall:
+%    Saves the old meaning 
+%    of \cmd\caption\ and \cmd\label\ at first call of some SC macros 
+%    (compatibility with `hyperref').}
+%  \changes{v1.5h (RN/HjG)}{2002/05/24}{Renamed \cmd\SC@AtFirstCall\ ^^A
+%    to \cmd\SC@SaveCommands\ and changed definition.}
+%    \begin{macrocode}
+\newcommand*{\SC@SaveCommands}{%
+    \let\SC@orig@caption=\caption \let\SC@orig@label=\label%
+}
+%    \end{macrocode}
+% \end{macro}
+%    \begin{macrocode}
+\SC@SaveCommands % necessary? or even wrong?
+%    \end{macrocode}  
+%
+%  \subsection{Package \textsf{hyperref} compatibility}
+%
+%  \changes{v1.5d (RN/HjG)}{2000/02/04}{Compatibility with `hyperref',
+%               thanks to Heiko Oberdiek}
+% Note: The |\pageref| doesn't work with \textsf{hyperref} \dots \mbox{:-(}
+%  \changes{v1.6 (RN/HjG)}{2002/06/07}{%
+%    Oneside mode had been forgotten ;-)}%
+%    \begin{macrocode}
+\if@twoside
+  \newcommand*{\isSC@ODD}[2]{% 
+    \ifthenelse{\isodd{\SC@pageref{\SC@IDENT}}}{#1}{#2}} 
+\else 
+  \newcommand*{\isSC@ODD}[2]{#1}%
+\fi  
+%    \end{macrocode}  
+%
+%
+%  \subsection{Option processing}
+%
+%    \begin{macrocode}  
+\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}%
+}
+%    \end{macrocode}
+%  \changes{v1.5a (RN)}{1999/07/18}{New Option and environment `wide'; some 
+%    small changes} 
+%    \begin{macrocode} 
+\DeclareOption{wide}{%
+   \renewcommand*{\isSC@WIDEi}[2]{\if@twocolumn #2\else #1\fi}% ???
+   \renewcommand*{\isSC@WIDEii}[2]{#1}}
+%    \end{macrocode}
+%  These `ragged\dots' options should stay here, behind the `\dots caption' options!
+%  \changes{v1.5b (RN)}{1999/10/31}{New Option `raggedright' as suggested by 
+%               James Kilfiger (mailto:mapdn@csv.warwick.ac.uk)}
+%    \begin{macrocode}
+\DeclareOption{raggedright}{%
+   \def\SC@justify{\RaggedRight}}
+%    \end{macrocode}
+%  \changes{v1.5f (RN)}{2002/01/13}{New option `raggedleft'}
+%    \begin{macrocode}   
+\DeclareOption{raggedleft}{%
+   \def\SC@justify{\RaggedLeft}}
+%    \end{macrocode}
+%  \changes{v1.5g (RN)}{2002/01/18}{New option `ragged'}
+%    \begin{macrocode}  
+\DeclareOption{ragged}{%
+   \def\SC@justify{\SC@justify@caption}%   \let ?
+}  
+%    \end{macrocode}
+%
+%    \begin{macrocode}  
+\DeclareOption{origragged}{\setboolean{SC@origRagged}{true}}
+%    \end{macrocode}
+%
+%
+%  \changes{v1.6 (RN/HjG)}{2002/06/07}{%
+%    New option `margincaption' added.}%
+%    \begin{macrocode}
+\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
+  }%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}  
+\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}%
+}
+%    \end{macrocode}
+%
+%    \begin{macrocode}  
+\ExecuteOptions{outercaption} 
+%%\InputIfFileExists{sidecap.cfg}{}{} % hier ? % 2002/06/14
+\ProcessOptions\relax
+%    \end{macrocode}
+%  \changes{v1.6 (RN)}{2002/06/09}{``Smart'' loading of package ragged2e.
+%    More simple code for hyperref compatibilty (\cmd\hypergetpageref).}
+%  \changes{v1.6f (RN/HjG)}{2003/06/06}{Test for presence of package babel
+%    (\cmd\org@pageref).}
+%    \begin{macrocode}  
+\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}%
+    }
+}
+%    \end{macrocode}
+%
+%
+%  \subsection{User-level macros (environments)}
+%
+% \begin{environment}{SCfigure}
+% Simply passes the first (optional) parameter and the required one,
+% in this case `figure', to |SC@float|\,.
+% The figure caption should be bottom aligned.
+%    \begin{macrocode}
+
+%\newcommand*\SCfigureVpos{b}% 2002/06/14
+\@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}
+
+%    \end{macrocode}
+% \end{environment}
+%
+% \begin{environment}{SCtable}
+% Simply passes the first (optional) parameter and the required one,
+% in this case `table', to |SC@float|\,.
+% The table caption should be top aligned.
+%    \begin{macrocode}
+
+%\newcommand*\SCtableVpos{t}% 2002/06/14
+\@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}
+
+%    \end{macrocode} 
+% \end{environment}
+%
+% \begin{environment}{wide}
+% This is an environment that allows to extend the width of the
+% text body (or of a floating environment) by using the margin space.
+%
+% It shouldn't be used in twocolumn text.
+%    \begin{macrocode} 
+% 
+\newenvironment{wide}%
+{%
+  \@parboxrestore% 2002/06/14 -- SW-Arch.: wozu? 2002/08/24
+  \advance\linewidth\marginparwidth
+  \advance\linewidth\marginparsep
+  \ifx\label\SC@label
+%<+debug>    \typeout{WIDE: inside SCfloat}%
+    \SC@widetrue
+  \else
+%<+debug>    \typeout{WIDE: outside SCfloat}%
+    \begin{lrbox}\SC@BOX  % \begin necessary: --> \@noitemerr
+       \minipage\linewidth
+  \fi
+}%
+{% 
+  \ifx\label\SC@label
+%<+debug>    
+\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
+%<+debug>    
+\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}}%
+%<+debug>    
+\typeout{WIDE: \string\linewidth=\the\linewidth}%
+    \noindent\makebox[\textwidth][\SC@hpos]{\copy\SC@BOX}% \usebox{\SC@BOX}
+    \endtrivlist
+  \fi
+}
+
+%    \end{macrocode}
+% \end{environment}
+%
+%
+%  \subsection{Internal macros}
+%
+%  \subsubsection{Collecting arguments}
+%
+% The new internal float environment, similar\slash analogous to
+% \LaTeX's |@float| environment.
+%
+% \smallskip
+% Syntax:
+%  |\SC@float[|\meta{vpos}|]{|\meta{name}|}[|\meta{relwidth}|][|\meta{fps}|]|
+%
+% \begin{itemize}
+% \item
+%    Parameter \meta{vpos} (optional) is the vertical positioning of the
+%    caption.
+% \item
+%    Parameter \meta{name} (required) is the name of the `original' \LaTeX\
+%    floating environment (e.g., `figure' or `table').
+%  \iffalse
+%    ; or one defined with the
+%    |newfloat| package.
+%  \fi
+% \item
+%    Parameter \meta{relwidth} (optional) is the desired relative width of the
+%    caption.
+% \item
+%    Parameter \meta{fps} (optional) is the usual \LaTeX\ float positioning
+%    specifier.
+% \end{itemize}
+%
+% The usual `cascading' programming style is applied
+% (cf.\ \LaTeX's |\@float|).
+%
+% \begin{macro}{\SC@float}
+% Initially, the first optional parameter is checked for.
+%    \begin{macrocode}
+\def\SC@float{\SC@SaveCommands\@ifnextchar[\SC@xfloat{\SC@xfloat[c]}}
+%    \end{macrocode}  
+% \end{macro}
+% \begin{macro}{\SC@xfloat}
+% Then the first and second parameters are consumed and the third one is
+% checked for.
+%    \begin{macrocode}
+\def\SC@xfloat[#1]#2{\@ifnextchar[%
+  {\SC@yfloat{#1}{#2}}%
+  {\SC@zfloat{#1}{#2}{\sidecaptionrelwidth}[\@nameuse{fps@#2}]}}
+%    \end{macrocode}  
+% \end{macro}
+% \begin{macro}{\SC@yfloat}
+% Again, the fourth (and last) parameter is checked for.
+%    \begin{macrocode}
+\def\SC@yfloat#1#2[#3]{\@ifnextchar[%
+  {\SC@zfloat{#1}{#2}{#3}}%
+  {\SC@zfloat{#1}{#2}{#3}[\@nameuse{fps@#2}]}}
+%    \end{macrocode}  
+% \end{macro}
+%
+%
+%  \subsubsection{Capturing the float's contents}
+%
+% \begin{macro}{\SC@zfloat}
+% Finally, here is the macro that does all the work.
+%    \begin{macrocode}
+\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%
+%    \end{macrocode}  
+% The |\caption| and |\label| commands must be redefined.
+%    \begin{macrocode}  
+  \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 ?
+%    \end{macrocode}  
+% Save the figure or table (or whatever) in a box.
+%    \begin{macrocode}
+  \SC@widefalse  
+  \begin{lrbox}\SC@BOX  % \begin necessary: --> \@noitemerr
+  %%% \strut
+}%
+
+%    \end{macrocode} 
+% \end{macro}
+%
+% \begin{macro}{\SC@dblfloat}
+% Analogous to \LaTeX's |\@dblfloat|.
+%    \begin{macrocode}
+\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}  
+%    \end{macrocode} 
+% \end{macro}
+%
+%
+%  \subsubsection{Output the float's contents}
+%
+% \begin{macro}{\endSC@float}
+% Outputs the figure or table (or whatever) and the caption. 
+%    \begin{macrocode} 
+\def\endSC@float{%   
+  %%% \strut
+  \end{lrbox}%  \end necessary: --> \@noitemerr
+%<+debug>  \typeout{onecolumn}%
+  \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}%
+%<+debug> \typeout{endSC@float: \string\@tempdima=\the\@tempdima}%
+  \endSC@FLOAT\@tempdima}%
+%    \end{macrocode} 
+% \end{macro} 
+% \begin{macro}{\endSC@dblfloat}
+% Ditto for |*|\mbox{-}forms of floats.
+%    \begin{macrocode} 
+\def\endSC@dblfloat{%   
+  \end{lrbox}%  \end necessary: --> \@noitemerr
+%<+debug>  \typeout{twocolumn}%
+  \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}%
+%<+debug>    
+\typeout{endSC@dblfloat: \string\@tempdima=\the\@tempdima}%
+  \endSC@FLOAT\@tempdima}%
+%    \end{macrocode}
+% \end{macro} 
+% \begin{macro}{\endSC@FLOAT}
+% Sets the caption width. If caption width plus figure\slash table width
+% (plus separation space) is too large then the caption width is set equal
+% to the remaining width. 
+%    \begin{macrocode}
+\def\endSC@FLOAT#1{% 
+  \SC@calcwidths{#1}%
+%    \end{macrocode}  
+% \begin{macro}{\@FLOAT}
+% Calls the \LaTeX\ float command with the two minipages inside a main minipage.
+% \end{macro}
+%    \begin{macrocode}      
+  \@FLOAT{\SC@captype}% 
+    \abovecaptionskip\z@skip
+    \belowcaptionskip\z@skip
+%    \end{macrocode}  
+% Creates a label for each figure or table (etc.)\ for later determination if
+% the page is odd or even. The counter |SC@C| must be incremented before.
+%    \begin{macrocode}    
+    \global\advance\c@SC@C\@ne
+    \SC@orig@label{\SC@IDENT}% nicht \ref... !!!
+%    \end{macrocode}
+% \begin{macro}{\isSC@WIDE}
+% ^^A ???
+% \end{macro}
+%    \begin{macrocode} 
+    \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}}%   
+%    \end{macrocode}
+% ^^A ??? 
+%    \begin{macrocode} 
+    \makebox[\@tempdimc][\SC@hpos]{%
+%    \end{macrocode}
+% \begin{macro}{\SC@FLOAT}
+%   Has two parameters. The first parameter is the minipage with the caption 
+%   text inside and the last parameter is the minipage with the body of the figure 
+%   or table ^^A (or whatever floating environment object) 
+%   inside.
+% \end{macro}
+%    \begin{macrocode} 
+      \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!
+%	   \isSC@ODD {\RaggedRight }{\RaggedLeft }
+%%%	   A B C
+%   \isSC@ODD{\typeout{xxxxx ungerade}}{\typeout{xxxxx gerade}}%
+%   \def\@makecaption##1##2{##1: ##2\endgraf}%
+% \@parboxrestore
+% \@setminipage
+\iffalse
+% DEBUG:
+          \endgraf
+          \@makecaption{\csname fnum@\SC@captype\endcsname}%
+              {\ignorespaces \SC@CAPtext}%
+          \endgraf
+\else
+          % \ifthenelse{\equal{\SC@OPTCAPtext}{\@empty}}%
+           \ifx\SC@OPTCAPtext\@empty% Noetig?
+% FM: strut needed twice for multiline captions
+             \SC@orig@caption[\SC@CAPtext]%
+                  {\strut\ignorespaces\SC@CAPtext\unskip\strut}% \expandafter\protect
+           \else
+% FM: strut needed twice for multiline captions
+% FM: if \SC@CAPtext can contain trailing banks then we also need \unskip
+% FM: (not checked)
+             \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%
+}
+%    \end{macrocode}
+% \end{macro} 
+%    \begin{macrocode} 
+\InputIfFileExists{sidecap.cfg}{}{} % hier ? % 2002/06/14
+%</package>
+%    \end{macrocode}
+%
+% ^^A -----------------------------
+%
+%  \Finale
-- 
cgit v1.2.3

