Debian Codegraph @

texmf-dist/source/latex/sidecap/sidecap.dtx

raw
1 % \iffalse
2 %% File: sidecap.dtx
3 %%
4 %
5 %<package>\NeedsTeXFormat{LaTeX2e}[2022-06-01]
6 %<package>\ProvidesPackage{sidecap}[2023/01/24 v1.7a SideCap Package (RN/HjG)]
7 %
8 %<*driver>
9 \documentclass{ltxdoc}
10 \usepackage{sidecap}
11 \GetFileInfo{sidecap.sty}
12 \CodelineIndex
13 \EnableCrossrefs
14 \RecordChanges
15 \begin{document}
16 \DocInput{sidecap.dtx}
17 \end{document}
18 %</driver>
19 %
20 % Copyright 1997--2016 Rolf Niepraschk and Hubert Gaesslein.
21 % Copyright 2016--.. Rolf Niepraschk
22 % This program can be redistributed and/or modified under the terms
23 % of the LaTeX Project Public License Distributed from CTAN
24 % archives in directory macros/latex/base/lppl.txt; either
25 % version 1.3 of the License, or any later version.
26 %
27 % This work has the LPPL maintenance status "author-maintained".
28 % \fi
29 %
30 % \CheckSum{683}
31 %
32 % \CharacterTable
33 % {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
34 % 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
35 % Digits \0\1\2\3\4\5\6\7\8\9
36 % Exclamation \! Double quote \" Hash (number) \#
37 % Dollar \$ Percent \% Ampersand \&
38 % Acute accent \' Left paren \( Right paren \)
39 % Asterisk \* Plus \+ Comma \,
40 % Minus \- Point \. Solidus \/
41 % Colon \: Semicolon \; Less than \<
42 % Equals \= Greater than \> Question mark \?
43 % Commercial at \@ Left bracket \[ Backslash \\
44 % Right bracket \] Circumflex \^ Underscore \_
45 % Grave accent \` Left brace \{ Vertical bar \|
46 % Right brace \} Tilde \~}
47 %
48 %
49 % \MakeShortVerb{\|}
50 % \setlength\parindent{0pt}
51 %
52 % ^^A \CodelineIndex Fehler !!!
53 % ^^A \RecordChanges kein Fehler !!!
54 %
55 % \changes{v1.0 (RN)}{1997/01/04}{New}
56 % \changes{v1.1 (RN/HjG)}{1997/05/01}{First public version}
57 % \changes{v1.2 (HjG)}{1998/01/29}{Proposal for amendments}
58 % \changes{v1.3 (RN/HjG)}{1998/01/29}{Unsuccessful attempt to make
59 % star-forms work}
60 % \changes{v1.4c (HjG)}{1998/06/05}{Successful (?) attempt to make
61 % star-forms work, plus some amendments}
62 % \changes{v1.4d (RN)} {1998/06/05}{New (LPPL) license}
63 % \changes{v1.5d (RN/HjG)}{2000/03/16}{Slight amendments to documentation.}
64 % \changes{v1.5h (RN/HjG)}{2002/05/24}{Improved compatibility with package
65 % hyperref.}
66 % \changes{v1.5h (RN/HjG)}{2002/05/24}{Environment wide does the right thing
67 % now outside SCfloat environments.}
68 %
69 % \changes{v1.6d (RN/HjG)}{2002/09/13}{Simplify internal calculations
70 % using primitive operators where possible and useful,
71 % saving tokens (suggested by Frank Mittelbach.}
72 %
73 % \IndexPrologue{^^A
74 % \section*{Index}^^A
75 % \markboth{Index}{Index}^^A
76 % Numbers written in \emph{italic} refer to the page where the
77 % corresponding entry is described, the ones
78 % \underline{underlined} to the definition, the rest to the places
79 % where the entry is used.}
80 %
81 %
82 % ^^A -----------------------------
83 %
84 % \title{\unskip
85 % The \textsf{sidecap} package^^A
86 % }
87 % \author{Rolf Niepraschk {\normalsize (\texttt{[email protected]})}\and
88 % Hubert G\"a{\ss}lein}
89
90 % \date{\fileversion\ -- \filedate}
91 % \maketitle
92 %
93 %
94 % ^^A -----------------------------
95 %
96 %
97 % \begin{abstract}
98 % This package defines the new environments |SCfigure| and |SCtable|,
99 % analogous to |figure| and |table|, which make it easy to
100 % typeset captions sideways.
101 %
102 % Additionally, a |wide| environment is defined; it allows to use
103 % the margin area, e.\,g., for figures wider than |\textwidth|.
104 %
105 % \iffalse
106 % (???)
107 % Support for other types of floating environments is provided,
108 % e.\,g., as available by the |newfloat| package.
109 % \fi
110 % \end{abstract}
111 %
112 % \pagestyle{headings}
113 %
114 % ^^A -----------------------------
115 %
116 % ^^A \tableofcontents
117 %
118 % ^^A -----------------------------
119 %
120 % \section{Introduction}
121 %
122 % In some cases it may be useful to typeset the caption aside the figure or
123 % the table. For this purpose the package \textsf{sidecap} defines the new
124 % environments |SCfigure| and |SCtable|. The figure or the table and the
125 % caption are put into two minipages that are positioned side by side and
126 % centered as a whole. The space between the minipages is |\sidecaptionsep|. The
127 % correct positioning with respect to left and right pages requires at least
128 % two compilation runs.
129 %
130 % ^^A -----------------------------
131 %
132 % \section{Usage}
133 %
134 % |\usepackage[|\meta{option}|]{sidecap}|
135 %
136 % \smallskip
137 %
138 % |\begin{SCtable} [|\meta{relwidth}|][|\meta{float}|] ... |
139 % |\end{SCtable}|
140 %
141 % |\begin{SCfigure} [|\meta{relwidth}|][|\meta{float}|] ... |
142 % |\end{SCfigure}|
143 %
144 % \smallskip
145 % |\begin{SCtable*} [|\meta{relwidth}|][|\meta{float}|] ... |
146 % |\end{SCtable*}|
147 %
148 % |\begin{SCfigure*}[|\meta{relwidth}|][|\meta{float}|] ... |
149 % |\end{SCfigure*}|
150 %
151 % \medskip
152 % \begin{center}
153 % \begin{tabular}{r@{~}p{.75\linewidth}}
154 % \meta{option} -- & |outercaption| (default): Caption appears left on
155 % left pages and right on right
156 % pages. \\[.25\baselineskip]
157 % & |innercaption|: Caption appears right on left pages
158 % and left on right pages.\\[.25\baselineskip]
159 % & |leftcaption|, |rightcaption|: Caption is always on
160 % the left or right, respectively.\\[.25\baselineskip]
161 % & |wide|: The floating objects may extend into the
162 % margin area.
163 % \\[.25\baselineskip]
164 % & |raggedright|, |raggedleft|, |ragged|: Better
165 % justification for small captions.
166 % The \textsf{ragged2e} package is used if available.
167 % \\[.5\baselineskip]
168 % \meta{relwidth} -- & optional; caption width relative to the width of the
169 % figure or table. A large value (e.g., 50) reserves
170 % the maximum width that is possible.
171 % Default is |\sidecaptionrelwidth|
172 % (which is initialized to 1.0).\\[.5\baselineskip]
173 % \meta{float} -- & optional; like the floating position parameter of the
174 % original table\slash figure environments.
175 % Default is |tbp|.
176 % \end{tabular}
177 % \end{center}
178 %
179 % \medskip
180 % |\begin{wide} ... \end{wide}|
181 %
182 % The |wide| environment may be used inside |figure| and |table|
183 % environments as well as in the normal text.
184 %
185 % ^^A -----------------------------
186 %
187 % \section{Required packages}
188 %
189 % This package requires the standard \LaTeX\ package \textsf{ifthen}.
190 %
191 % ^^A -----------------------------
192 %
193 % \section{Supported packages}
194 %
195 % This package is compatible with \LaTeX\ package \textsf{hyperref}
196 % (tested with version 6.71v as of 2001/11/12).
197 % If the |raggedright| or |raggedleft| or |ragged| package option has
198 % been given, then captions will be set with ragged margin.
199 % The \textsf{ragged2e} package will be used if it can be found.
200 %
201 % \iffalse
202 % This package supports the \LaTeX\ package \textsf{newfloat},
203 % coming soon \dots\ (?)
204 % \fi
205 %
206 % ^^A -----------------------------
207 %
208 % \StopEventually{^^A
209 % \PrintChanges\PrintIndex
210 % ^^A Make sure that the index is not printed twice
211 % ^^A (ltxdoc.cfg might have a second \PrintIndex command)
212 % \let\PrintChanges\relax
213 % \let\PrintIndex\relax
214 % }
215 %
216 % ^^A -----------------------------
217 %
218 % \section{The implementation}
219 %
220 % \subsection{Register allocation and auxiliary macros}
221 %
222 % \begin{macrocode}
223 %<*package>
224
225 \RequirePackage{ifthen}
226
227 \@ifdefinable{\SC@BOXWD}{\newdimen\SC@BOXWD}
228 \@ifdefinable{\SC@CAPWD}{\newdimen\SC@CAPWD}
229 % 2 noetig ???
230 \@ifdefinable{\SC@tempdima}{\newdimen\SC@tempdima}
231 \@ifdefinable{\SC@tempdimb}{\newdimen\SC@tempdimb}
232 \newcounter{SC@C} \newsavebox{\SC@BOX} \newcommand*{\SC@FLOAT}{}
233 \newcommand*{\SC@IDENT}{SC@\number\value{SC@C}}
234 \newcommand*\SC@label[1]{\gdef\SC@LABtext{#1}\ignorespaces}
235 \newcommand*\SC@orig@caption{} \newcommand*\SC@orig@label{}
236 \newcommand*\sidecaptionsep{}
237 \edef\sidecaptionsep{\the\marginparsep}
238 \newcommand*\sidecaptionrelwidth{1.0}
239 \newcommand*\sidecaptionvpos[2]{% 2002/08/31
240 \@namedef{SC@#1@vpos}{#2}%
241 }
242
243 \newboolean{SC@wide}
244 \def\SC@widefalse{\global\let\ifSC@wide\iffalse}
245 \def\SC@widetrue {\global\let\ifSC@wide\iftrue}
246
247 % Kann man auf dieses Laengenregister verzichten? Nein! (RN) <****>
248
249 \newcommand*\SC@calcwidths[1]{%
250 \SC@tempdima#1\relax
251 \SC@BOXWD\wd\SC@BOX
252 \SC@CAPWD\SC@fraction\SC@BOXWD
253 \@tempdima\SC@BOXWD
254 \advance\@tempdima\SC@CAPWD
255 \advance\@tempdima\sidecaptionsep
256 \ifdim\@tempdima>\SC@tempdima
257 \advance\SC@CAPWD-\@tempdima
258 \advance\SC@CAPWD\SC@tempdima
259 \fi
260 \SC@tempdimb\@tempdima
261 }
262
263 %\newcommand*{\isSC@WIDEi}[2]{#2} %default: false
264 %\newcommand*{\isSC@WIDEii}[2]{#2} %default: false
265 \newcommand*{\isSC@WIDEi}[2]{\ifSC@wide#1\else#2\fi} %default: false
266 \newcommand*{\isSC@WIDEii}[2]{\ifSC@wide#1\else#2\fi} %default: false
267
268 %\newcommand*{\isSC@First}[2]{#1} %default: true
269
270 \newcommand*\SC@justify{}
271 \newcommand*\SC@justify@caption{}
272 \newcommand*\SC@justify@body{}
273
274 \newboolean{SC@origRagged} \setboolean{SC@origRagged}{false} %% ???
275 % \end{macrocode}
276 % \begin{macro}{\SC@SaveCommands}
277 % \changes{v1.5e (RN)}{2001/11/10}{\cmd\SC@AtFirstCall:
278 % Saves the old meaning
279 % of \cmd\caption\ and \cmd\label\ at first call of some SC macros
280 % (compatibility with `hyperref').}
281 % \changes{v1.5h (RN/HjG)}{2002/05/24}{Renamed \cmd\SC@AtFirstCall\ ^^A
282 % to \cmd\SC@SaveCommands\ and changed definition.}
283 % \begin{macrocode}
284 \newcommand*{\SC@SaveCommands}{%
285 \let\SC@orig@caption=\caption \let\SC@orig@label=\label%
286 }
287 % \end{macrocode}
288 % \end{macro}
289 % \begin{macrocode}
290 \SC@SaveCommands % necessary? or even wrong?
291 % \end{macrocode}
292 %
293 % \subsection{Package \textsf{hyperref} compatibility}
294 %
295 % \changes{v1.5d (RN/HjG)}{2000/02/04}{Compatibility with `hyperref',
296 % thanks to Heiko Oberdiek}
297 % Note: The |\pageref| doesn't work with \textsf{hyperref} \dots \mbox{:-(}
298 % \changes{v1.6 (RN/HjG)}{2002/06/07}{%
299 % Oneside mode had been forgotten ;-)}%
300 % \begin{macrocode}
301 \if@twoside
302 \newcommand*{\isSC@ODD}[2]{%
303 \ifthenelse{\isodd{\pageref{\SC@IDENT}}}{#1}{#2}}
304 \else
305 \newcommand*{\isSC@ODD}[2]{#1}%
306 \fi
307 % \end{macrocode}
308 %
309 %
310 % \subsection{Option processing}
311 %
312 % \begin{macrocode}
313 \DeclareOption{innercaption}{%
314 \renewcommand*{\SC@FLOAT}[2]{%
315 \isSC@ODD{{#1}\hspace{\sidecaptionsep}{#2}} {{#2}\hspace{\sidecaptionsep}{#1}}}
316 \renewcommand*\SC@justify@caption{%
317 \isSC@ODD{\RaggedLeft}{\RaggedRight}}
318 }
319
320 \DeclareOption{outercaption}{%
321 \renewcommand*{\SC@FLOAT}[2]{%
322 \isSC@ODD{{#2}\hspace{\sidecaptionsep}{#1}} {{#1}\hspace{\sidecaptionsep}{#2}}}
323 \renewcommand*\SC@justify@caption{%
324 \isSC@ODD{\RaggedRight}{\RaggedLeft}}
325 }
326
327 \DeclareOption{rightcaption}{%
328 \renewcommand*{\SC@FLOAT}[2]{{#2}\hspace{\sidecaptionsep}{#1}}
329 \def\SC@justify@caption{\RaggedRight}%
330 }
331
332 \DeclareOption{leftcaption}{%
333 \renewcommand*{\SC@FLOAT}[2]{{#1}\hspace{\sidecaptionsep}{#2}}
334 \def\SC@justify@caption{\RaggedLeft}%
335 }
336 % \end{macrocode}
337 % \changes{v1.5a (RN)}{1999/07/18}{New Option and environment `wide'; some
338 % small changes}
339 % \begin{macrocode}
340 \DeclareOption{wide}{%
341 \renewcommand*{\isSC@WIDEi}[2]{\if@twocolumn #2\else #1\fi}% ???
342 \renewcommand*{\isSC@WIDEii}[2]{#1}}
343 % \end{macrocode}
344 % These `ragged\dots' options should stay here, behind the `\dots caption' options!
345 % \changes{v1.5b (RN)}{1999/10/31}{New Option `raggedright' as suggested by
346 % James Kilfiger (mailto:[email protected])}
347 % \begin{macrocode}
348 \DeclareOption{raggedright}{%
349 \def\SC@justify{\RaggedRight}}
350 % \end{macrocode}
351 % \changes{v1.5f (RN)}{2002/01/13}{New option `raggedleft'}
352 % \begin{macrocode}
353 \DeclareOption{raggedleft}{%
354 \def\SC@justify{\RaggedLeft}}
355 % \end{macrocode}
356 % \changes{v1.5g (RN)}{2002/01/18}{New option `ragged'}
357 % \begin{macrocode}
358 \DeclareOption{ragged}{%
359 \def\SC@justify{\SC@justify@caption}% \let ?
360 }
361 % \end{macrocode}
362 %
363 % \begin{macrocode}
364 \DeclareOption{origragged}{\setboolean{SC@origRagged}{true}}
365 % \end{macrocode}
366 %
367 %
368 % \changes{v1.6 (RN/HjG)}{2002/06/07}{%
369 % New option `margincaption' added.}%
370 % \begin{macrocode}
371 \DeclareOption{margincaption}{%
372 \ds@outercaption\ds@outerbody\ds@wide
373 \let\ds@innercaption\@empty
374 \let\ds@leftcaption\@empty
375 \let\ds@rightcaption\@empty
376 \def\SC@calcwidths#1{%
377 \SC@tempdimb#1\relax
378 \SC@BOXWD\SC@tempdimb % *-form !!! ???
379 \advance\SC@BOXWD-\marginparwidth
380 \advance\SC@BOXWD-\marginparsep
381 \SC@CAPWD\marginparwidth
382 }%
383 }
384 % \end{macrocode}
385 %
386 % \begin{macrocode}
387 \DeclareOption{innerbody}{%
388 \def\SC@justify@body{%
389 \isSC@ODD{\RaggedRight}{\RaggedLeft}}
390 }
391
392 \DeclareOption{outerbody}{%
393 \def\SC@justify@body{%
394 \isSC@ODD{\RaggedLeft}{\RaggedRight}}
395 }
396
397 \DeclareOption{centerbody}{%
398 \def\SC@justify@body{\Centering}
399 }
400
401 \DeclareOption{rightbody}{%
402 \def\SC@justify@body{\RaggedLeft}%
403 }
404
405 \DeclareOption{leftbody}{%
406 \def\SC@justify@body{\RaggedRight}%
407 }
408 % \end{macrocode}
409 %
410 % \begin{macrocode}
411 \ExecuteOptions{outercaption}
412 %%\InputIfFileExists{sidecap.cfg}{}{} % hier ? % 2002/06/14
413 \ProcessOptions\relax
414 % \end{macrocode}
415 % \changes{v1.6 (RN)}{2002/06/09}{``Smart'' loading of package ragged2e.
416 % More simple code for hyperref compatibilty (\cmd\hypergetpageref).}
417 % \changes{v1.6f (RN/HjG)}{2003/06/06}{Test for presence of package babel
418 % (\cmd\org@pageref).}
419 % \changes{v1.7a (RN)}{2023/01/24}{%
420 % Special handling with \cmd\SC@pageref is no longer necessary.}
421 % \begin{macrocode}
422 \AtBeginDocument{%
423 \ifSC@origRagged\else
424 \@ifpackageloaded{ragged2e}{}%
425 {%
426 \IfFileExists{ragged2e.sty}{%
427 \RequirePackage[NewParameters]{ragged2e}}%
428 {%
429 \PackageWarningNoLine{sidecap}{%
430 Package `ragged2e' not found -- expect bad formatting}%
431 }%
432 }
433 \fi
434 \@ifundefined{RaggedRight}%
435 {%
436 \let\RaggedLeft\raggedleft
437 \let\RaggedRight\raggedright
438 \let\Centering\centering
439 }{}
440 }
441 % \end{macrocode}
442 %
443 %
444 % \subsection{User-level macros (environments)}
445 %
446 % \begin{environment}{SCfigure}
447 % Simply passes the first (optional) parameter and the required one,
448 % in this case `figure', to |SC@float|\,.
449 % The figure caption should be bottom aligned.
450 % \begin{macrocode}
451
452 %\newcommand*\SCfigureVpos{b}% 2002/06/14
453 \@ifdefinable\SC@figure@vpos{\def\SC@figure@vpos{b}}
454 \newenvironment{SCfigure}{\SC@float[\SC@figure@vpos]{figure}}{\endSC@float}
455 \newenvironment{SCfigure*}{\SC@dblfloat[\SC@figure@vpos]{figure}}{\endSC@dblfloat}
456
457 % \end{macrocode}
458 % \end{environment}
459 %
460 % \begin{environment}{SCtable}
461 % Simply passes the first (optional) parameter and the required one,
462 % in this case `table', to |SC@float|\,.
463 % The table caption should be top aligned.
464 % \begin{macrocode}
465
466 %\newcommand*\SCtableVpos{t}% 2002/06/14
467 \@ifdefinable\SC@table@vpos{\def\SC@table@vpos{t}}
468 \newenvironment{SCtable}{\SC@float[\SC@table@vpos]{table}}{\endSC@float}
469 \newenvironment{SCtable*}{\SC@dblfloat[\SC@table@vpos]{table}}{\endSC@dblfloat}
470
471 % \end{macrocode}
472 % \end{environment}
473 %
474 % \begin{environment}{wide}
475 % This is an environment that allows to extend the width of the
476 % text body (or of a floating environment) by using the margin space.
477 %
478 % It shouldn't be used in twocolumn text.
479 % \begin{macrocode}
480 %
481 \newenvironment{wide}%
482 {%
483 \@parboxrestore% 2002/06/14 -- SW-Arch.: wozu? 2002/08/24
484 \advance\linewidth\marginparwidth
485 \advance\linewidth\marginparsep
486 \ifx\label\SC@label
487 %<+debug> \typeout{WIDE: inside SCfloat}%
488 \SC@widetrue
489 \else
490 %<+debug> \typeout{WIDE: outside SCfloat}%
491 \begin{lrbox}\SC@BOX % \begin necessary: --> \@noitemerr
492 \minipage\linewidth
493 \fi
494 }%
495 {%
496 \ifx\label\SC@label
497 %<+debug>
498 \typeout{WIDE: inside SCfloat}%
499 %\renewcommand*{\isSC@WIDEi}[2]{\if@twocolumn ##2\else ##1\fi}%
500 %\renewcommand*{\isSC@WIDEii}[2]{##1}%
501 %\let\isSC@WIDE\isSC@WIDEi
502 \else
503 %<+debug>
504 \typeout{WIDE: outside SCfloat}%
505 \endminipage
506 \end{lrbox}% \end necessary: --> \@noitemerr
507 \global\advance\c@SC@C\@ne
508 \SC@orig@label{\SC@IDENT}% nicht \ref... !!!
509 \trivlist \item\relax
510 \isSC@ODD{\def\SC@hpos{l}}{\def\SC@hpos{r}}%
511 %<+debug>
512 \typeout{WIDE: \string\linewidth=\the\linewidth}%
513 \noindent\makebox[\textwidth][\SC@hpos]{\copy\SC@BOX}% \usebox{\SC@BOX}
514 \endtrivlist
515 \fi
516 }
517
518 % \end{macrocode}
519 % \end{environment}
520 %
521 %
522 % \subsection{Internal macros}
523 %
524 % \subsubsection{Collecting arguments}
525 %
526 % The new internal float environment, similar\slash analogous to
527 % \LaTeX's |@float| environment.
528 %
529 % \smallskip
530 % Syntax:
531 % |\SC@float[|\meta{vpos}|]{|\meta{name}|}[|\meta{relwidth}|][|\meta{fps}|]|
532 %
533 % \begin{itemize}
534 % \item
535 % Parameter \meta{vpos} (optional) is the vertical positioning of the
536 % caption.
537 % \item
538 % Parameter \meta{name} (required) is the name of the `original' \LaTeX\
539 % floating environment (e.g., `figure' or `table').
540 % \iffalse
541 % ; or one defined with the
542 % |newfloat| package.
543 % \fi
544 % \item
545 % Parameter \meta{relwidth} (optional) is the desired relative width of the
546 % caption.
547 % \item
548 % Parameter \meta{fps} (optional) is the usual \LaTeX\ float positioning
549 % specifier.
550 % \end{itemize}
551 %
552 % The usual `cascading' programming style is applied
553 % (cf.\ \LaTeX's |\@float|).
554 %
555 % \begin{macro}{\SC@float}
556 % Initially, the first optional parameter is checked for.
557 % \begin{macrocode}
558 \def\SC@float{\SC@SaveCommands\@ifnextchar[\SC@xfloat{\SC@xfloat[c]}}
559 % \end{macrocode}
560 % \end{macro}
561 % \begin{macro}{\SC@xfloat}
562 % Then the first and second parameters are consumed and the third one is
563 % checked for.
564 % \begin{macrocode}
565 \def\SC@xfloat[#1]#2{\@ifnextchar[%
566 {\SC@yfloat{#1}{#2}}%
567 {\SC@zfloat{#1}{#2}{\sidecaptionrelwidth}[\@nameuse{fps@#2}]}}
568 % \end{macrocode}
569 % \end{macro}
570 % \begin{macro}{\SC@yfloat}
571 % Again, the fourth (and last) parameter is checked for.
572 % \begin{macrocode}
573 \def\SC@yfloat#1#2[#3]{\@ifnextchar[%
574 {\SC@zfloat{#1}{#2}{#3}}%
575 {\SC@zfloat{#1}{#2}{#3}[\@nameuse{fps@#2}]}}
576 % \end{macrocode}
577 % \end{macro}
578 %
579 %
580 % \subsubsection{Capturing the float's contents}
581 %
582 % \begin{macro}{\SC@zfloat}
583 % Finally, here is the macro that does all the work.
584 % \begin{macrocode}
585 \def\SC@zfloat#1#2#3[#4]{%
586 \def\SC@vpos{#1}%
587 \expandafter\edef\csname fps@#2\endcsname{#4}%
588 \def\SC@captype{#2}%
589 \ifx#3\@empty\def\SC@fraction{1}\else\def\SC@fraction{#3}\fi%
590 % \end{macrocode}
591 % The |\caption| and |\label| commands must be redefined.
592 % \begin{macrocode}
593 \let\SC@CAPtext\@empty \let\SC@OPTCAPtext\@empty \let\SC@LABtext\@empty%
594 \renewcommand\caption[2][]{\gdef\SC@OPTCAPtext{##1}%
595 \gdef\SC@CAPtext{##2}\ignorespaces}% \SC@justify
596 \let\label=\SC@label
597 \@namedef{fnum@#2}{\mbox{\@nameuse{#2name}~\@nameuse{the#2}}}% caption2 ?
598 % \end{macrocode}
599 % Save the figure or table (or whatever) in a box.
600 % \begin{macrocode}
601 \SC@widefalse
602 \begin{lrbox}\SC@BOX % \begin necessary: --> \@noitemerr
603 %%% \strut
604 }%
605
606 % \end{macrocode}
607 % \end{macro}
608 %
609 % \begin{macro}{\SC@dblfloat}
610 % Analogous to \LaTeX's |\@dblfloat|.
611 % \begin{macrocode}
612 \def\SC@dblfloat{%
613 \SC@SaveCommands%
614 \if@twocolumn\let\reserved@a\SC@dbflt\else\let\reserved@a\SC@float\fi
615 \reserved@a}
616 \def\SC@dbflt{\SC@float}
617 % \end{macrocode}
618 % \end{macro}
619 %
620 %
621 % \subsubsection{Output the float's contents}
622 %
623 % \begin{macro}{\endSC@float}
624 % Outputs the figure or table (or whatever) and the caption.
625 % \begin{macrocode}
626 \def\endSC@float{%
627 %%% \strut
628 \end{lrbox}% \end necessary: --> \@noitemerr
629 %<+debug> \typeout{onecolumn}%
630 \let\isSC@WIDE\isSC@WIDEi%
631 \def\@FLOAT{\@float}\def\end@FLOAT{\end@float}%
632 \isSC@WIDE%
633 {\@tempdima\textwidth % \columnwidth ???
634 \advance\@tempdima\marginparwidth
635 \advance\@tempdima\marginparsep}%
636 {\@tempdima\columnwidth}%
637 %<+debug> \typeout{endSC@float: \string\@tempdima=\the\@tempdima}%
638 \endSC@FLOAT\@tempdima}%
639 % \end{macrocode}
640 % \end{macro}
641 % \begin{macro}{\endSC@dblfloat}
642 % Ditto for |*|\mbox{-}forms of floats.
643 % \begin{macrocode}
644 \def\endSC@dblfloat{%
645 \end{lrbox}% \end necessary: --> \@noitemerr
646 %<+debug> \typeout{twocolumn}%
647 \let\isSC@WIDE\isSC@WIDEii%
648 \def\@FLOAT{\@dblfloat}\def\end@FLOAT{\end@dblfloat}%
649 \isSC@WIDE%
650 {\@tempdima\textwidth%
651 \advance\@tempdima\marginparwidth
652 \advance\@tempdima\marginparsep}%
653 {\@tempdima\textwidth}%
654 %<+debug>
655 \typeout{endSC@dblfloat: \string\@tempdima=\the\@tempdima}%
656 \endSC@FLOAT\@tempdima}%
657 % \end{macrocode}
658 % \end{macro}
659 % \begin{macro}{\endSC@FLOAT}
660 % Sets the caption width. If caption width plus figure\slash table width
661 % (plus separation space) is too large then the caption width is set equal
662 % to the remaining width.
663 % \begin{macrocode}
664 \def\endSC@FLOAT#1{%
665 \SC@calcwidths{#1}%
666 % \end{macrocode}
667 % \begin{macro}{\@FLOAT}
668 % Calls the \LaTeX\ float command with the two minipages inside a main minipage.
669 % \end{macro}
670 % \begin{macrocode}
671 \@FLOAT{\SC@captype}%
672 \abovecaptionskip\z@skip
673 \belowcaptionskip\z@skip
674 % \end{macrocode}
675 % Creates a label for each figure or table (etc.)\ for later determination if
676 % the page is odd or even. The counter |SC@C| must be incremented before.
677 % \begin{macrocode}
678 \global\advance\c@SC@C\@ne
679 \SC@orig@label{\SC@IDENT}% nicht \ref... !!!
680 % \end{macrocode}
681 % \begin{macro}{\isSC@WIDE}
682 % ^^A ???
683 % \end{macro}
684 % \begin{macrocode}
685 \isSC@WIDE%
686 {\ifdim\SC@tempdimb>\textwidth % ???
687 \isSC@ODD{\def\SC@hpos{l}}{\def\SC@hpos{r}}%
688 \else%
689 \def\SC@hpos{c}%
690 \fi
691 \@tempdimc\textwidth}% ???
692 {\@tempdimc\SC@tempdima\def\SC@hpos{c}}%
693 % \end{macrocode}
694 % ^^A ???
695 % \begin{macrocode}
696 \makebox[\@tempdimc][\SC@hpos]{%
697 % \end{macrocode}
698 % \begin{macro}{\SC@FLOAT}
699 % Has two parameters. The first parameter is the minipage with the caption
700 % text inside and the last parameter is the minipage with the body of the figure
701 % or table ^^A (or whatever floating environment object)
702 % inside.
703 % \end{macro}
704 % \begin{macrocode}
705 \SC@FLOAT%
706 {\minipage[\SC@vpos]{\SC@CAPWD}%
707 %% \nointerlineskip %\offinterlineskip%
708 %% \kern0pt\relax
709 \hrule \@height\z@\@depth\z@ %%% Testen, Doku. (Implementierung) !!!
710 %\show\SC@justify@caption
711 %%% \tracingall\tracingonline=0
712 \SC@justify
713 \let\@arrayparboxrestore\relax % sonst Blocksatz! (\@parboxrestore)
714 \let\usecaptionmargin\relax % sonst Pseudo-Blocksatz, nicht-alternierend!
715 % \isSC@ODD {\RaggedRight }{\RaggedLeft }
716 %%% A B C
717 % \isSC@ODD{\typeout{xxxxx ungerade}}{\typeout{xxxxx gerade}}%
718 % \def\@makecaption##1##2{##1: ##2\endgraf}%
719 % \@parboxrestore
720 % \@setminipage
721 \iffalse
722 % DEBUG:
723 \endgraf
724 \@makecaption{\csname fnum@\SC@captype\endcsname}%
725 {\ignorespaces \SC@CAPtext}%
726 \endgraf
727 \else
728 % \ifthenelse{\equal{\SC@OPTCAPtext}{\@empty}}%
729 \ifx\SC@OPTCAPtext\@empty% Noetig?
730 % FM: strut needed twice for multiline captions
731 \SC@orig@caption[\SC@CAPtext]%
732 {\strut\ignorespaces\SC@CAPtext\unskip\strut}% \expandafter\protect
733 \else
734 % FM: strut needed twice for multiline captions
735 % FM: if \SC@CAPtext can contain trailing banks then we also need \unskip
736 % FM: (not checked)
737 \SC@orig@caption[\SC@OPTCAPtext]% \expandafter\protect
738 {\strut\ignorespaces\SC@CAPtext\unskip\strut}% \expandafter\protect
739 \fi
740 \unskip% ??? Dok. !!!
741 \ifx\SC@LABtext\@empty\else
742 \SC@orig@label{\SC@LABtext}\fi% \expandafter\protect
743 \fi
744 %%% X Y Z
745 \hrule \@height\z@\@depth\z@
746 \endminipage}%
747 {\minipage[\SC@vpos]{\SC@BOXWD}%
748 %% \nointerlineskip %\offinterlineskip%
749 %% \kern0pt\relax
750 \hrule \@height\z@\@depth\z@
751 \SC@justify@body
752 \unhbox\SC@BOX % \strut \unhbox/\usebox{\SC@BOX}% TESTEN!
753 % \kern0pt\relax
754 \hrule \@height\z@\@depth\z@
755 \endminipage}%
756 }%
757 \end@FLOAT%
758 }
759 % \end{macrocode}
760 % \end{macro}
761 % \begin{macrocode}
762 \InputIfFileExists{sidecap.cfg}{}{} % hier ? % 2002/06/14
763 %</package>
764 % \end{macrocode}
765 %
766 % ^^A -----------------------------
767 %
768 % \Finale