summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ncctools/nccfloats.sty
blob: 039bf65aa9ab4c530d97df156917642913b48210 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
%%
%% This is file `nccfloats.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% nccfloats.dtx  (with options: `package')
%% 
%% IMPORTANT NOTICE:
%% 
%% This file is a generated file from the sources of the `ncctools'
%% bundle.
%% 
%% You are not allowed to modify this file.
%% 
%% You are allowed to distribute this file if and only if
%% it is distributed with the corresponding source files in
%% the `ncctools' bundle.
%% 
%% For the copying and distribution conditions of the source files,
%% see the README file distributed with the ncctools bundle.
%%
%% File: nccfloats.dtx Copyright (C) 2002--2006 by Alexander I. Rozhenko
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{nccfloats}
         [2006/01/07 v1.2 More Float Management (NCC)]
\RequirePackage{nccboxes}[2002/03/20]
\newcommand*{\FloatStyle}[2][]{%
  \expandafter\def\csname NCC@fltstyle@#1\endcsname{#2}}
\@onlypreamble\FloatStyle
\def\NCC@setfltstyle#1{%
  \edef\@tempa{NCC@fltstyle@#1\@captype}%
  \@ifundefined{\@tempa}{\NCC@fltstyle@}{\csname\@tempa\endcsname}%
}
\g@addto@macro\@floatboxreset{\NCC@setfltstyle{}}
\newcommand\normalfloatstyle{%
  \leftskip\z@skip \rightskip\z@skip \@rightskip\z@skip
  \parfillskip\@flushglue \let\\\@normalcr
  \reset@font \normalsize
}
\newcommand*\NCC@minifloat[1][c]{%
  \@ifnextchar[{\NCC@mflt{#1}}{\NCC@@mflt{#1}\relax[s]}}
\def\NCC@mflt#1[#2]{%
  \@ifnextchar[{\NCC@@mflt{#1}{#2}}{\NCC@mflt{#1}{#2}[#1]}}
\long\def\NCC@@mflt#1#2[#3]#4#5{%
  \@iiiminipage{#1}{#2}[#3]{#4}\normalfloatstyle
  \NCC@setfltstyle{mini}#5\endminipage\endgroup
}
\def\NCC@pair#1#2#3#4{\setlength\@tempdimc{#3}%
  \@ifstar{\NCC@pair@{#2}{#4}}{\NCC@pair@{#1}{#4}}}
\def\NCC@pair@#1#2{\@ifnextchar[{\NCC@pair@@{#1}}{\NCC@pair@@{#1}[#2]}}
\def\NCC@pair@@#1[#2]{\def\@tempa{#1{#2}}%
  \@ifnextchar({\NCC@pair@@@}{\NCC@@pair()()}}
\def\NCC@pair@@@(#1){\@ifnextchar({\NCC@@pair(#1)}{\NCC@@pair(#1)()}}
\def\NCC@@pair(#1)(#2){\@tempa{#1}{#2}}
\def\NCC@setwidth#1#2{\@defaultunits#1#2\unitlength\relax\@nnil}
\def\NCC@wcalc#1#2{%
  \if!#1!\@tempdima .5\linewidth \advance\@tempdima -.5\@tempdimc
  \else  \NCC@setwidth\@tempdima{#1}%
  \fi
  \if!#2!\@tempdimb \linewidth \advance\@tempdimb -\@tempdima
         \advance\@tempdimb -\@tempdimc
  \else  \NCC@setwidth\@tempdimb{#2}%
         \@tempdimc \linewidth \advance\@tempdimc -\@tempdima
         \advance\@tempdimc -\@tempdimb
  \fi
}
\newif\ifNCC@smfltleft
\newcommand{\ifleftsidefloat}{%
  \ifNCC@smfltleft
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\def\NCC@sidemfloat#1{%
  \NCC@smfltleftfalse
  \if@twocolumn \else
    \if@twoside
      \ifodd\c@page \else \NCC@smfltlefttrue \fi
    \fi
  \fi
  \NCC@pair{\NCC@smflt{#1}}%
    {\ifNCC@smfltleft \NCC@smfltleftfalse \else \NCC@smfltlefttrue\fi
     \NCC@smflt{#1}}%
    {1.5em}{}%
}
\long\def\NCC@smflt#1#2#3#4#5#6{%
  \let\NCC@t\relax \let\NCC@b\relax \let\NCC@j\relax \let\NCC@n\strut
  \@tfor\@tempa :=#2\do {%
    \expandafter\let\csname NCC@\@tempa\endcsname\@empty}%
  \ifx\NCC@t\@empty \def\NCC@c{t}\else
   \ifx\NCC@b\@empty \def\NCC@c{b}\else
    \def\NCC@c{c}%
   \fi
  \fi
  \ifx\NCC@j\@empty \def\NCC@j{\parfillskip\z@skip}\fi
  \edef\NCC@t{\parindent\the\parindent\ifvmode\else\noindent\fi}%
  \ifvmode\else
    \unskip{\parfillskip\rightskip\par}\vskip -\parskip
  \fi
  \setbox\@tempboxa\vbox{\hsize\linewidth\noindent
    \NCC@wcalc{#3}{#4}%
    \ifNCC@smfltleft
      \jparbox{\Strut}[\NCC@c]\@tempdima{#1\@tempdima{#5}}%
      \nobreak\hskip\@tempdimc
    \fi
    \jparbox{\NCC@n\Strut}[\NCC@c]\@tempdimb{%
      \everypar{\NCC@n\everypar{}}\NCC@t#6%
      \ifvmode \else \unskip\NCC@n\NCC@j\fi}%
    \ifNCC@smfltleft \else
      \nobreak\hskip\@tempdimc
      \jparbox{\Strut}[\NCC@c]\@tempdima{#1\@tempdima{#5}}%
    \fi
  }%
  \@tempdima\dp\@tempboxa \advance\@tempdima\lineskip
  \dp\@tempboxa\@tempdima
  \@tempdima\ht\@tempboxa \advance\@tempdima -\ht\strutbox
  \noindent \raise-\@tempdima\box\@tempboxa
}
\def\NCC@float#1#2{\@ifstar{\NCC@flt{#1*}{#2}}{\NCC@flt{#1}{#2}}}
\def\NCC@flt#1#2{\@ifnextchar[{\NCC@flt@{#1}}{\NCC@flt@{#1}[#2]}}
\def\NCC@flt@#1[#2]{\begin{#1}[#2]\normalfloatstyle\centering
 \@ifnextchar({\NCC@@flt{#1}}{\NCC@@flt{#1}()}}
\long\def\NCC@@flt#1(#2)#3{%
  \if!#2!\@tempdima\linewidth \else \NCC@setwidth\@tempdima{#2}\fi
  \begingroup\NCC@minifloat[c]\@tempdima{#3}%
  \end{#1}%
}
\def\NCC@floats#1#2#3{%
  \NCC@pair{\NCC@@flts{#1}{#2}}{\NCC@@flts{#1*}{#2}}{1em}{#3}}
\long\def\NCC@@flts#1#2#3#4#5#6#7{%
  \begin{#1}[#3]\normalfloatstyle\NCC@wcalc{#4}{#5}%
    \begingroup\NCC@minifloat[#2]\@tempdima{#6}%
    \nobreak\hskip\@tempdimc
    \begingroup\NCC@minifloat[#2]\@tempdimb{#7}%
  \end{#1}%
}
\newcommand*\newminifloat[4]{%
  \edef\@tempa{%
    \noexpand\newcommand\expandafter\noexpand\csname mini#1\endcsname{%
      \noexpand\begingroup\noexpand\def\noexpand\@captype{#2}%
      \noexpand\NCC@minifloat}%
    \noexpand\newcommand\expandafter\noexpand\csname side#1\endcsname{%
      \noexpand\NCC@sidemfloat{%
        \expandafter\noexpand\csname mini#1\endcsname}}%
    \noexpand\newcommand\expandafter\noexpand\csname #1\endcsname{%
      \noexpand\NCC@float{#2}{#3}}%
    \noexpand\newcommand\expandafter\noexpand\csname #1s\endcsname{%
      \noexpand\NCC@floats{#2}{#4}{#3}}%
  }%
  \@tempa
}
\@onlypreamble\newminifloat
\newminifloat{fig}{figure}{ht}{b}
\newminifloat{tabl}{table}{ht}{t}
\FloatStyle{}
\FloatStyle[minifigure]{\footnotesize\centering}
\FloatStyle[minitable]{\footnotesize\centering}
\endinput
%%
%% End of file `nccfloats.sty'.