Debian Codegraph @

texmf-dist/source/latex/ncctools/nccfloats.dtx

raw
1 % \iffalse
2 %%
3 %% File: nccfloats.dtx Copyright (C) 2002--2006 by Alexander I. Rozhenko
4 %%
5 %<package>\NeedsTeXFormat{LaTeX2e}
6 %<package>\ProvidesPackage{nccfloats}
7 %<package> [2006/01/07 v1.2 More Float Management (NCC)]
8 %
9 % \changes{v1.00}{2002/03/23}{This version is uploaded to CTAN}
10 % \changes{v1.01}{2002/05/17}{Handling of side floats improved}
11 % \changes{v1.1}{2004/12/05}{Width parameters can have units now}
12 % \changes{v1.1}{2004/12/05}{Documentation was prepared}
13 % \changes{v1.2}{2006/01/07}{Extend |\FloatStyle| syntax}
14 % \changes{v1.2}{2006/01/07}{Cover base floats with |\FloatStyle|}
15 % \changes{v1.2}{2006/01/07}{Introduce |\newminifloat| command}
16 %
17 %<*driver>
18 \let\makeindex\relax
19 \documentclass{ltxdoc}
20 \usepackage{desclist,nccfloats}
21 \GetFileInfo{nccfloats.sty}
22 \begin{document}
23 \title{The \textsf{nccfloats} package\thanks{This file
24 has version number \fileversion, last
25 revised \filedate.}}
26 \author{Alexander I. Rozhenko\\[email protected]}
27 \date{\filedate}
28 \maketitle
29 \DocInput{nccfloats.dtx}
30 \end{document}
31 %</driver>
32 % \fi
33 %
34 % The standard \LaTeX\ floating environments, namely |figure|
35 % and |table|, allow user to place floating material in a
36 % document. But they do not introduce a style in which this
37 % material must be formatted. In this package, styles are
38 % joined with floats and mini-floats are introduced. Mini-floats
39 % are prepared at a mini-page and allow captions within.
40 % Basing on mini-floats, a number of service commands for
41 % figures and tables are defined. The ability to create
42 % other types of mini-floats is introduced with the
43 % |\newminifloat| command.
44 %
45 % \tableofcontents
46 %
47 % \section{Basic Commands}
48 %
49 % \DescribeMacro{\FloatStyle}
50 % The |\FloatStyle|\oarg{type}\marg{style} command sets a style for
51 % the float of the given \meta{type}. If the \meta{type} is omitted,
52 % the default style is specified. It will be applied to a float or
53 % mini-float if no specialized style was defined.
54 % This command is available in the preamble only.
55 %
56 % To specify the style of a mini-float and of service commands based on it,
57 % add the `|mini|' prefix to the float type. The default styles are
58 % \begin{quote}
59 % |\FloatStyle{}|\\
60 % |\FloatStyle[minifigure]{\footnotesize\centering}|\\
61 % |\FloatStyle[minitable]{\footnotesize\centering}|
62 % \end{quote}
63 % This means that the formatting of floats prepared with standard
64 % |figure| and |table| environments does not changed, but service
65 % commands based on mini-figures and mini-tables use a special
66 % formatting with |\footnotesize| font and the centered alignment.
67 %
68 % \DescribeMacro\normalfloatstyle
69 % This command is applied inside floats or mini-floats to reset
70 % formatting style of subsequent floating material to the standard
71 % formatting with paragraph alignment and the normal font of
72 % normal size.
73 %
74 % \DescribeMacro{\minifig}
75 % \DescribeMacro{\minitabl}
76 % We start with the basic commands, namely |\minifig| and
77 % |\minitabl|. They prepare a material in a mini-page and allow
78 % using the |\caption| command in the body. Their syntax is
79 % similar to the |\parbox| command:
80 % \begin{quote}
81 % |\minifig |\oarg{pos}\oarg{height}\oarg{inner-pos}\marg{width}\marg{body}\\
82 % |\minitabl|\oarg{pos}\oarg{height}\oarg{inner-pos}\marg{width}\marg{body}
83 % \end{quote}
84 % The \meta{pos} is a vertical alignment parameter for
85 % mini-page (|t|, |b|, or |c|) with respect to
86 % surrounding text; the \meta{height} is a mini-page height
87 % required; the \meta{inner-pos} is a vertical alignment
88 % of text inside the mini-page (|t|, |b|, |c|, or |s|);
89 % and the \meta{width} is the mini-page width.
90 % The \meta{body} is prepared in the style specified by the
91 % |\FloatingStyle| command and can contain the |\caption| command inside.
92 %
93 % All other floating extension commands are based on
94 % these two commands.
95 %
96 % \section{Side Figures and Tables}
97 %
98 % For small figures and tables, it is preferable to insert them
99 % inside a text instead of using floating mechanism. The
100 % typographic rules usually require an illustrative material to
101 % occupy an outer side of page. In two-side mode, this means
102 % figure and tables should be on the right side if a page number is
103 % odd and on the left side if page number is even. In one-side
104 % mode, figures and tables must occupy the right side of page.
105 %
106 % \DescribeMacro{\sidefig}
107 % \DescribeMacro{\sidetabl}
108 % The following commands support such a placement:
109 % \begin{quote}
110 % |\sidefig|\oarg{pos}|(|$w_1$|)(|$w_2$|)|\marg{figure}\marg{text}\\
111 % |\sidefig*|\oarg{pos}|(|$w_1$|)(|$w_2$|)|\marg{figure}\marg{text}\\
112 % |\sidetabl|\oarg{pos}|(|$w_1$|)(|$w_2$|)|\marg{table}\marg{text}\\
113 % |\sidetabl*|\oarg{pos}|(|$w_1$|)(|$w_2$|)|\marg{table}\marg{text}
114 % \end{quote}
115 % We use the term \textit{mini-float} for the
116 % small illustrating material (figure or table), however
117 % taking into account that it is not a float at all. It is inserted in
118 % the main flow next to a paragraph box specified in the last
119 % parameter of above described commands.
120 %
121 % The no-star forms of above described commands place a mini-float
122 % next to the specified text on the outer side of page (to the
123 % right for odd page and to the left for even page). In two-column
124 % or one-side mode, mini-float is always posed to the right. The
125 % star-forms provide the reverse placement. By default, mini-float
126 % is vertically centered with respect to the text and the
127 % |\strut| command is inserted at the beginning and at the end
128 % of the \meta{text} to provide normal baseline
129 % distances of the first and last lines of the text from
130 % surrounding text lines.
131 %
132 % All parameters in square and round brackets are optional and mean
133 % the following:
134 % \begin{desclist}{}{}[\meta{pos}]
135 % \item[\meta{pos}] specifies mini-float alignment (|t|,
136 % |b|, or |c|; default is |c|) with respect to text
137 % box and can contain additional chars controlling the text body
138 % preparation: |j| means the last line of the text to be
139 % justified to the right and |n| means suppressing of struts
140 % insertion (they should be inserted manually if necessary);
141 %
142 % \item[$w_1$] is the width of mini-float; and
143 %
144 % \item[$w_2$] is the width of the text box.
145 % \end{desclist}
146 %
147 % You can omit units in the width parameters. In this case,
148 % the width value is considered as a multiple of |\unitlength|
149 % (similarly to the use of length dimensions in the picture environment).
150 %
151 % If both width parameters are absent, the width of both mini-float and
152 % text body is calculated as |(\linewidth-1.5em)/2|. If $w_2$ is absent,
153 % the text body width is calculated as |\linewidth-|$w_1$|-1.5em|.
154 %
155 % The placement of side-floats in the document consists in the following
156 % steps:
157 % \begin{enumerate}
158 % \item Decide where you want to insert a side-float;
159 % \item Insert a |\sidefig| or |\sidetabl| command after a word that finishes
160 % the line before the supposed side-float position;
161 % \item Specify a width of float in its parameter and set the top alignment
162 % as the \meta{pos} parameter (e.g.\ |\sidefig[t](|$w_1$|)|);
163 % \item Prepare the side-float in the first mandatory parameter of the command
164 % (e.g.\ |\sidefig[t](|$w_1$|)|\marg{figure});
165 % \item Enclose enough text going after the command in braces;
166 % \item Translate the document;
167 % \item Find what part of the text is redundant in the \meta{text} parameter;
168 % \item Move it after the close brace;
169 % \item If the same paragraph continues after the close brace, add the |j|
170 % letter to the \meta{pos} parameter. Also change the |t| alignment
171 % to |c| alignment in the \meta{pos} parameter;
172 % \item Translate the document once more;
173 % \item If the side-float has a wrong placement (this can appear when paragraph
174 % with a side-float begins at the end of page), insert the star after
175 % the side-float command and translate the document once more.
176 % \end{enumerate}
177 %
178 % \DescribeMacro{\ifleftsidefloat}
179 % While preparing a side-float, it is sometimes necessary to
180 % provide conditional placement depending on the side a mini-float
181 % is posed. The command
182 % \begin{quote}
183 % |\ifleftsidefloat|\marg{left-clause}\marg{right-clause}
184 % \end{quote}
185 % provides this. It is useful in parameters of |\sidefig| or
186 % |\sidetabl| and processes \meta{left-clause} if the
187 % mini-float is posed to the left and \meta{right-clause}
188 % otherwise.
189 %
190 % Side-floats can be also used within floating environments to pos
191 % a caption near a figure or table.
192 %
193 % \section{Floating Figures and Tables}
194 %
195 % \DescribeMacro{\fig}
196 % \DescribeMacro{\tabl}
197 % The following commands envelop floating
198 % environments:
199 % \begin{quote}
200 % |\fig|\oarg{placement}|(|$w$|)|\marg{body}\\
201 % |\fig*|\oarg{placement}|(|$w$|)|\marg{body}\\
202 % |\tabl|\oarg{placement}|(|$w$|)|\marg{body}\\
203 % |\tabl*|\oarg{placement}|(|$w$|)|\marg{body}
204 % \end{quote}
205 % The \meta{placement} is a float placement parameter
206 % describing places where a float can appear. The default value is
207 % |ht| (here or at the top of page).
208 % The optional $w$ parameter defines a
209 % width of box occupied by the float (the width of nested
210 % |\minifig| or |\minitabl|). If it
211 % is omitted, the float has the maximum width equal to the
212 % |\linewidth|.
213 %
214 % The |\fig| and |\tabl| commands envelop the |figure|
215 % and |table| environments respectively. Their star-forms
216 % envelop |figure*| or |table*| environments respectively.
217 %
218 % \section{Two Floating Figures or Tables Side by Side}
219 %
220 % \DescribeMacro{\figs}
221 % \DescribeMacro{\tabls}
222 % The following commands place two figures or tables side by side.
223 % \begin{quote}
224 % |\figs|\oarg{placement}|(|$w_1$|)(|$w_2$|)|\marg{body1}\marg{body2}\\
225 % |\figs*|\oarg{placement}|(|$w_1$|)(|$w_2$|)|\marg{body1}\marg{body2}\\
226 % |\tabls|\oarg{placement}|(|$w_1$|)(|$w_2$|)|\marg{body1}\marg{body2}\\
227 % |\tabls*|\oarg{placement}|(|$w_1$|)(|$w_2$|)|\marg{body1}\marg{body2}
228 % \end{quote}
229 % The \meta{body1} is a body of the left figure or table and
230 % the \meta{body2} is a body of the right figure or table.
231 % Other parameters are optional. The meaning and default value of
232 % the \meta{placement} parameter is the same as described
233 % above. The $w_1$ and $w_2$ parameters are
234 % widths of left and right boxes. If
235 % they both are omitted, the left and right boxes will have the
236 % width equal to |(\linewidth-1em)/2|. If $w_2$
237 % is omitted, the right box will occupy the rest of horizontal space
238 % minus |1em|. If both parameters are specified, the rest
239 % space is inserted between boxes. If the total width of left and
240 % right floats exceeds the |\linewidth|, the floats will overlap
241 % at the middle (a negative horizontal space is inserted between them).
242 %
243 % In the |\tabls| command, boxes of the left and right bodies are
244 % top-aligned, but, in the |\figs| command, the bottom alignment is
245 % used. The star-forms of this commands are based on the |figure*|
246 % or |table*| environments respectively.
247 %
248 % \section{Declare a Mini-float and Service Commands}
249 %
250 % \DescribeMacro\newminifloat
251 % If a new type of float is introduced, the respective mini-float
252 % and service commands can be helpful for it. To prepare them, use
253 % the following declaration:
254 % \begin{quote}
255 % |\newminifloat|\marg{gen}\marg{type}\marg{placement}\marg{pos}
256 % \end{quote}
257 % Here \meta{gen} is a root for command names to be generated, \meta{type}
258 % is a float type, \meta{placement} is a default placement on the page,
259 % and \meta{pos} is a vertical alignment for pair of floats.
260 %
261 % This command declares 4 commands: |\mini|\meta{gen}, |\side|\meta{gen},
262 % |\|\meta{gen}, and |\|\meta{gen}|s|. For example, the commands
263 % described in previous sections are declared as follows:
264 % \begin{quote}
265 % |\newminifloat{fig}{figure}{ht}{b}|\\
266 % |\newminifloat{tabl}{table}{ht}{t}|
267 % \end{quote}
268 %
269 % \StopEventually{}
270 %
271 % \section{The Implementation}
272 %
273 % The package uses some commands of the |nccboxes| package.
274 % Load it here:
275 % \begin{macrocode}
276 %<*package>
277 \RequirePackage{nccboxes}[2002/03/20]
278 % \end{macrocode}
279 %
280 % \subsection{Float Style}
281 %
282 % \begin{macro}{\FloatStyle}
283 % |\FloatStyle|\oarg{type}\marg{style} specifies a style for
284 % a given float type.
285 % \begin{macrocode}
286 \newcommand*{\FloatStyle}[2][]{%
287 \expandafter\def\csname NCC@fltstyle@#1\endcsname{#2}}
288 \@onlypreamble\FloatStyle
289 % \end{macrocode}
290 % \end{macro}
291 %
292 % \begin{macro}{\NCC@setfltstyle}
293 % |\NCC@setfltstyle|\marg{prefix} applies a style for a
294 % float of |\@captype| type. While selection a style to be
295 % applied it adds the given \meta{prefix} to the float type.
296 % \begin{macrocode}
297 \def\NCC@setfltstyle#1{%
298 \edef\@tempa{NCC@fltstyle@#1\@captype}%
299 \@ifundefined{\@tempa}{\NCC@fltstyle@}{\csname\@tempa\endcsname}%
300 }
301 % \end{macrocode}
302 % We add this style with empty prefix to the |\@floatboxreset|
303 % hook which is applied at the end of preamble of a float.
304 % \begin{macrocode}
305 \g@addto@macro\@floatboxreset{\NCC@setfltstyle{}}
306 % \end{macrocode}
307 % \end{macro}
308 %
309 % \begin{macro}{\normalfloatstyle}
310 % Reset a float style to par-box formatting with normal font of the
311 % normal size.
312 % \begin{macrocode}
313 \newcommand\normalfloatstyle{%
314 \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
315 \parfillskip\@flushglue \let\\\@normalcr
316 \reset@font \normalsize
317 }
318 % \end{macrocode}
319 % \end{macro}
320 %
321 % \subsection{The Kernel}
322 %
323 % \begin{macro}{\NCC@minifloat}
324 % The base for mini-floats
325 % \begin{quote}
326 % |\NCC@minifloat|\oarg{pos}\oarg{height}\oarg{inner-pos}\marg{width}\marg{body}
327 % \end{quote}
328 % It finishes a mini-float with extra |\endgroup| command.
329 % A |\@captype| should be specified before it.
330 % \begin{macrocode}
331 \newcommand*\NCC@minifloat[1][c]{%
332 \@ifnextchar[{\NCC@mflt{#1}}{\NCC@@mflt{#1}\relax[s]}}
333 \def\NCC@mflt#1[#2]{%
334 \@ifnextchar[{\NCC@@mflt{#1}{#2}}{\NCC@mflt{#1}{#2}[#1]}}
335 \long\def\NCC@@mflt#1#2[#3]#4#5{%
336 \@iiiminipage{#1}{#2}[#3]{#4}\normalfloatstyle
337 \NCC@setfltstyle{mini}#5\endminipage\endgroup
338 }
339 % \end{macrocode}
340 % \end{macro}
341 %
342 % \begin{macro}{\NCC@pair}
343 % The command
344 % \begin{quote}
345 % |\NCC@pair|\marg{c1}\marg{c2}\marg{def-dist}\marg{def-place}|*|\oarg{place}|(|$w_1$|)(|$w_2$|)|
346 % \end{quote}
347 % executes \meta{c1}\marg{place}|{|$w_1$|}{|$w_2$|}| if star is absent or
348 % \meta{c2}\marg{place}|{|$w_1$|}{|$w_2$|}| if star presents.
349 % Four first parameters are mandatory. Others a optional.
350 % The \meta{def-dist} parameter contains a default distance
351 % value. It is saved in the |\@tempdimc| register.
352 % The \meta{def-place} parameter contains the default value for
353 % the \meta{place} parameter. If the last one is omitted,
354 % the \meta{def-place} is used instead.
355 % \begin{macrocode}
356 \def\NCC@pair#1#2#3#4{\setlength\@tempdimc{#3}%
357 \@ifstar{\NCC@pair@{#2}{#4}}{\NCC@pair@{#1}{#4}}}
358 \def\NCC@pair@#1#2{\@ifnextchar[{\NCC@pair@@{#1}}{\NCC@pair@@{#1}[#2]}}
359 \def\NCC@pair@@#1[#2]{\def\@tempa{#1{#2}}%
360 \@ifnextchar({\NCC@pair@@@}{\NCC@@pair()()}}
361 \def\NCC@pair@@@(#1){\@ifnextchar({\NCC@@pair(#1)}{\NCC@@pair(#1)()}}
362 \def\NCC@@pair(#1)(#2){\@tempa{#1}{#2}}
363 % \end{macrocode}
364 % \end{macro}
365 %
366 % \begin{macro}{\NCC@setwidth}
367 % The |\NCC@setwidth|\marg{register}\marg{width} command sets
368 % the given \meta{width} for the \meta{register}. If units
369 % in \meta{width} are omitted, the |\unitlength| unit is used.
370 % In other words, if \meta{width} is a real number, it is considered
371 % as a multiple of |\unitlength|.
372 % \begin{macrocode}
373 \def\NCC@setwidth#1#2{\@defaultunits#1#2\unitlength\relax\@nnil}
374 % \end{macrocode}
375 % \end{macro}
376 %
377 % \begin{macro}{\NCC@wcalc}
378 % The |\NCC@wcalc{|$w_1$|}{|$w_2$|}| calculates widths
379 % of left and right boxes in the |\@tempdima| and |\@tempdimb|
380 % registers. The distance between boxes must be specified in
381 % |\@tempdimc| register before the call. The algorithm:
382 % \begin{itemize}
383 % \item If $w_1$ is empty, |\@tempdima:=(\linewidth-\@tempdimc)/2|,
384 % otherwise, |\@tempdima:=|$w_1$;
385 % \item If $w_2$ is empty, |\@tempdimb:=\linewidth-\@tempdima-\@tempdimc|,
386 % otherwise, |\@tempdimb:=|$w_2$;
387 % \item If $w_2$ is nonempty,
388 % |\@tempdimc:=\linewidth-\@tempdima-\@tempdimb|.
389 % \end{itemize}
390 % \begin{macrocode}
391 \def\NCC@wcalc#1#2{%
392 \if!#1!\@tempdima .5\linewidth \advance\@tempdima -.5\@tempdimc
393 \else \NCC@setwidth\@tempdima{#1}%
394 \fi
395 \if!#2!\@tempdimb \linewidth \advance\@tempdimb -\@tempdima
396 \advance\@tempdimb -\@tempdimc
397 \else \NCC@setwidth\@tempdimb{#2}%
398 \@tempdimc \linewidth \advance\@tempdimc -\@tempdima
399 \advance\@tempdimc -\@tempdimb
400 \fi
401 }
402 % \end{macrocode}
403 % \end{macro}
404 %
405 % \subsection{Side Floats}
406 %
407 % \begin{macro}{\ifleftsidefloat}
408 % This command is used in parameters of side-floats.
409 % \begin{macrocode}
410 \newif\ifNCC@smfltleft
411 \newcommand{\ifleftsidefloat}{%
412 \ifNCC@smfltleft
413 \expandafter\@firstoftwo
414 \else
415 \expandafter\@secondoftwo
416 \fi
417 }
418 % \end{macrocode}
419 % \end{macro}
420 %
421 % \begin{macro}{\NCC@sidemfloat}
422 % The command
423 % \begin{quote}
424 % |\NCC@sidemfloat|\marg{command}|*|\oarg{pos}|(|$w_1$|)(|$w_2$|)|\marg{mini-float}\marg{text}
425 % \end{quote}
426 % is used for preparing a side-float. The \meta{command} parameter
427 % contains a |\mini|\meta{gen} command. The \meta{pos} parameter
428 % specifies vertical alignment and additional flags. The
429 % $w_1$ and $w_2$ parameters (if present) specify widthes of
430 % \meta{mini-float} and \meta{text} boxes. Starred version
431 % reverses the position of side-float and text boxes.
432 % The implementation of these commands is based
433 % on the |\NCC@pair| command that parses all optional
434 % parameters. Finally the |\NCC@smflt| command is
435 % executed.
436 % \begin{macrocode}
437 \def\NCC@sidemfloat#1{%
438 \NCC@smfltleftfalse
439 \if@twocolumn \else
440 \if@twoside
441 \ifodd\c@page \else \NCC@smfltlefttrue \fi
442 \fi
443 \fi
444 \NCC@pair{\NCC@smflt{#1}}%
445 {\ifNCC@smfltleft \NCC@smfltleftfalse \else \NCC@smfltlefttrue\fi
446 \NCC@smflt{#1}}%
447 {1.5em}{}%
448 }
449 % \end{macrocode}
450 % \end{macro}
451 %
452 % \begin{macro}{\NCC@smflt}
453 % The command
454 % \begin{quote}
455 % |\NCC@smflt|\marg{command}\marg{pos}|{|$w_1$|}{|$w_2$|}|\marg{mini-float}\marg{text}
456 % \end{quote}
457 % prepares a side-float. The |\@tempdimc| register
458 % contains the default distance between the mini-float and text.
459 % \begin{macrocode}
460 \long\def\NCC@smflt#1#2#3#4#5#6{%
461 % \end{macrocode}
462 % Parse the \meta{pos} parameter. Create a |\NCC@|\meta{letter}
463 % command with empty content for every \meta{letter} from the \meta{pos}.
464 % \begin{macrocode}
465 \let\NCC@t\relax \let\NCC@b\relax \let\NCC@j\relax \let\NCC@n\strut
466 \@tfor\@tempa :=#2\do {%
467 \expandafter\let\csname NCC@\@tempa\endcsname\@empty}%
468 % \end{macrocode}
469 % Define the vertical alignment letter in the |\NCC@c| command.
470 % \begin{macrocode}
471 \ifx\NCC@t\@empty \def\NCC@c{t}\else
472 \ifx\NCC@b\@empty \def\NCC@c{b}\else
473 \def\NCC@c{c}%
474 \fi
475 \fi
476 % \end{macrocode}
477 % Define a justification hook in the |\NCC@j| command.
478 % \begin{macrocode}
479 \ifx\NCC@j\@empty \def\NCC@j{\parfillskip\z@skip}\fi
480 % \end{macrocode}
481 % Define the text starting hook in the |\NCC@t| command.
482 % It will contain the |\parindent| setting command and
483 % the optional |\noindent| command.
484 % \begin{macrocode}
485 \edef\NCC@t{\parindent\the\parindent\ifvmode\else\noindent\fi}%
486 % \end{macrocode}
487 % Complete the current paragraph and leave the horizontal mode.
488 % \begin{macrocode}
489 \ifvmode\else
490 \unskip{\parfillskip\rightskip\par}\vskip -\parskip
491 \fi
492 % \end{macrocode}
493 % Prepare the side-float in |\@tempboxa|:
494 % \begin{macrocode}
495 \setbox\@tempboxa\vbox{\hsize\linewidth\noindent
496 % \end{macrocode}
497 % Calculate widthes of left and right boxes and distance
498 % between them in |\@tempdima|, |\@tempdimb|, and |\@tempdimc|.
499 % \begin{macrocode}
500 \NCC@wcalc{#3}{#4}%
501 % \end{macrocode}
502 % Conditionally put a side-float to the left:
503 % \begin{macrocode}
504 \ifNCC@smfltleft
505 \jparbox{\Strut}[\NCC@c]\@tempdima{#1\@tempdima{#5}}%
506 \nobreak\hskip\@tempdimc
507 \fi
508 % \end{macrocode}
509 % Put a text box:
510 % \begin{macrocode}
511 \jparbox{\NCC@n\Strut}[\NCC@c]\@tempdimb{%
512 \everypar{\NCC@n\everypar{}}\NCC@t#6%
513 \ifvmode \else \unskip\NCC@n\NCC@j\fi}%
514 % \end{macrocode}
515 % Conditionally put a side-float to the right:
516 % \begin{macrocode}
517 \ifNCC@smfltleft \else
518 \nobreak\hskip\@tempdimc
519 \jparbox{\Strut}[\NCC@c]\@tempdima{#1\@tempdima{#5}}%
520 \fi
521 }%
522 % \end{macrocode}
523 % Games with height and depth the |\@temboxa| allow us
524 % produce right line spacing with surrounding text.
525 % \begin{macrocode}
526 \@tempdima\dp\@tempboxa \advance\@tempdima\lineskip
527 \dp\@tempboxa\@tempdima
528 \@tempdima\ht\@tempboxa \advance\@tempdima -\ht\strutbox
529 \noindent \raise-\@tempdima\box\@tempboxa
530 }
531 % \end{macrocode}
532 % \end{macro}
533 %
534 % \subsection{Service Commands}
535 %
536 % \begin{macro}{\NCC@float}
537 % The command
538 % \begin{quote}
539 % |\NCC@float|\marg{type}\marg{def-place}|*|\oarg{placement}|(|$w$|)|\marg{body}
540 % \end{quote}
541 % is the envelope for a mini-float inside a float. The \meta{def-place}
542 % is the default placement specifier.
543 % \begin{macrocode}
544 \def\NCC@float#1#2{\@ifstar{\NCC@flt{#1*}{#2}}{\NCC@flt{#1}{#2}}}
545 \def\NCC@flt#1#2{\@ifnextchar[{\NCC@flt@{#1}}{\NCC@flt@{#1}[#2]}}
546 \def\NCC@flt@#1[#2]{\begin{#1}[#2]\normalfloatstyle\centering
547 \@ifnextchar({\NCC@@flt{#1}}{\NCC@@flt{#1}()}}
548 \long\def\NCC@@flt#1(#2)#3{%
549 \if!#2!\@tempdima\linewidth \else \NCC@setwidth\@tempdima{#2}\fi
550 \begingroup\NCC@minifloat[c]\@tempdima{#3}%
551 \end{#1}%
552 }
553 % \end{macrocode}
554 % \end{macro}
555 %
556 % \begin{macro}{\NCC@floats}
557 % The command
558 % \begin{quote}
559 % |\NCC@floats|\marg{type}\marg{pos}\marg{def-place}|*|\oarg{placement}|(|$w_1$|)(|$w_2$|)|\\
560 % | |\marg{body1}\marg{body2}
561 % \end{quote}
562 % is the envelope for a pair of mini-floats inside a float. The implementation
563 % of these commands is based
564 % on the |\NCC@pair| command that parses all optional
565 % parameters. Finally the |\NCC@flts| command is
566 % executed.
567 % \begin{macrocode}
568 \def\NCC@floats#1#2#3{%
569 \NCC@pair{\NCC@@flts{#1}{#2}}{\NCC@@flts{#1*}{#2}}{1em}{#3}}
570 % \end{macrocode}
571 % \end{macro}
572 %
573 % \begin{macro}{\NCC@flts}
574 % The command
575 % \begin{quote}
576 % |\NCC@flts|\marg{type}\marg{pos}\marg{placement}|{|$w_1$|}{|$w_2$|}|\marg{body1}\marg{body2}
577 % \end{quote}
578 % prepares a pair of floats within \meta{type} environment.
579 % The \meta{pos} contains relative vertical alignment of floats.
580 % The $w_1$ and $w_2$ parameters (if present) specify widthes of
581 % floats. The |\@tempdimc| register contains the default distance
582 % between floats.
583 % \begin{macrocode}
584 \long\def\NCC@@flts#1#2#3#4#5#6#7{%
585 \begin{#1}[#3]\normalfloatstyle\NCC@wcalc{#4}{#5}%
586 \begingroup\NCC@minifloat[#2]\@tempdima{#6}%
587 \nobreak\hskip\@tempdimc
588 \begingroup\NCC@minifloat[#2]\@tempdimb{#7}%
589 \end{#1}%
590 }
591 % \end{macrocode}
592 % \end{macro}
593 %
594 % \subsection{Declare a New Mini-float and Service Commands}
595 %
596 % \begin{macro}{\newminifloat}
597 % The command
598 % \begin{quote}
599 % |\newminifloat|\marg{gen}\marg{type}\marg{def-place}\marg{pos}
600 % \end{quote}
601 % declares a new mini-float and 3 service commands.
602 % \begin{macrocode}
603 \newcommand*\newminifloat[4]{%
604 \edef\@tempa{%
605 % \end{macrocode}
606 % Prepare |\mini|\meta{gen} definition:
607 % \begin{macrocode}
608 \noexpand\newcommand\expandafter\noexpand\csname mini#1\endcsname{%
609 \noexpand\begingroup\noexpand\def\noexpand\@captype{#2}%
610 \noexpand\NCC@minifloat}%
611 % \end{macrocode}
612 % Prepare |\side|\meta{gen} definition:
613 % \begin{macrocode}
614 \noexpand\newcommand\expandafter\noexpand\csname side#1\endcsname{%
615 \noexpand\NCC@sidemfloat{%
616 \expandafter\noexpand\csname mini#1\endcsname}}%
617 % \end{macrocode}
618 % Prepare |\|\meta{gen} definition:
619 % \begin{macrocode}
620 \noexpand\newcommand\expandafter\noexpand\csname #1\endcsname{%
621 \noexpand\NCC@float{#2}{#3}}%
622 % \end{macrocode}
623 % Prepare |\|\meta{gen}|s| definition:
624 % \begin{macrocode}
625 \noexpand\newcommand\expandafter\noexpand\csname #1s\endcsname{%
626 \noexpand\NCC@floats{#2}{#4}{#3}}%
627 }%
628 % \end{macrocode}
629 % Define all commands:
630 % \begin{macrocode}
631 \@tempa
632 }
633 \@onlypreamble\newminifloat
634 % \end{macrocode}
635 % \end{macro}
636 %
637 % \subsection{Base Mini-floats and Defaults}
638 %
639 % \begin{macrocode}
640 \newminifloat{fig}{figure}{ht}{b}
641 \newminifloat{tabl}{table}{ht}{t}
642 \FloatStyle{}
643 \FloatStyle[minifigure]{\footnotesize\centering}
644 \FloatStyle[minitable]{\footnotesize\centering}
645 %</package>
646 % \end{macrocode}
647 \endinput