Oops -- Lib/Test should be Lib/test, of course!
[python/dscho.git] / Doc / texinputs / fncychap.sty
blob4e693b8b943de1ef1ad3e5035f0187e61750a82f
1 %%% Copyright Ulf A. Lindgren
2 %%% Department of Applied Electronics
3 %%% Chalmers University of Technology
4 %%% S-412 96 Gothenburg, Sweden
5 %%% E-mail lindgren@ae.chalmers.se
6 %%%
7 %%% Note Permission is granted to modify this file under
8 %%% the condition that it is saved using another
9 %%% file and package name.
10 %%%
11 %%% Revision 1.1
12 %%%
13 %%% Jan. 8th Modified package name base date option
14 %%% Jan. 22th Modified FmN and FmTi for error in book.cls
15 %%% \MakeUppercase{#}->{\MakeUppercase#}
16 %%% Apr. 6th Modified Lenny option to prevent undesired
17 %%% skip of line.
18 %%% Nov. 8th Fixed \@chapapp for AMS
19 %%% Feb. 11th Fixed appendix problem related to Bjarne
20 %%% Last modified Feb. 11th 1998
22 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
23 \ProvidesPackage{fncychap}
24 [1997/04/06 v1.11
25 LaTeX package (Revised chapters)]
27 %%%% DEFINITION OF Chapapp variables
28 \newcommand{\CNV}{\huge\bfseries}
29 \newcommand{\ChNameVar}[1]{\renewcommand{\CNV}{#1}}
32 %%%% DEFINITION OF TheChapter variables
33 \newcommand{\CNoV}{\huge\bfseries}
34 \newcommand{\ChNumVar}[1]{\renewcommand{\CNoV}{#1}}
36 \newif\ifUCN
37 \UCNfalse
38 \newif\ifLCN
39 \LCNfalse
40 \def\ChNameLowerCase{\LCNtrue\UCNfalse}
41 \def\ChNameUpperCase{\UCNtrue\LCNfalse}
42 \def\ChNameAsIs{\UCNfalse\LCNfalse}
44 %%%%% Fix for AMSBook 971008
46 \@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}
49 %%%%% Fix for Bjarne and appendix 980211
51 \newif\ifinapp
52 \inappfalse
53 \renewcommand\appendix{\par
54 \setcounter{chapter}{0}%
55 \setcounter{section}{0}%
56 \inapptrue%
57 \renewcommand\@chapapp{\appendixname}%
58 \renewcommand\thechapter{\@Alph\c@chapter}}
60 %%%%%
62 \newcommand{\FmN}[1]{%
63 \ifUCN
64 {\MakeUppercase#1}\LCNfalse
65 \else
66 \ifLCN
67 {\MakeLowercase#1}\UCNfalse
68 \else #1
69 \fi
70 \fi}
73 %%%% DEFINITION OF Title variables
74 \newcommand{\CTV}{\Huge\bfseries}
75 \newcommand{\ChTitleVar}[1]{\renewcommand{\CTV}{#1}}
77 %%%% DEFINITION OF the basic rule width
78 \newlength{\RW}
79 \setlength{\RW}{1pt}
80 \newcommand{\ChRuleWidth}[1]{\setlength{\RW}{#1}}
82 \newif\ifUCT
83 \UCTfalse
84 \newif\ifLCT
85 \LCTfalse
86 \def\ChTitleLowerCase{\LCTtrue\UCTfalse}
87 \def\ChTitleUpperCase{\UCTtrue\LCTfalse}
88 \def\ChTitleAsIs{\UCTfalse\LCTfalse}
89 \newcommand{\FmTi}[1]{%
90 \ifUCT
92 {\MakeUppercase#1}\LCTfalse
93 \else
94 \ifLCT
95 {\MakeLowercase#1}\UCTfalse
96 \else #1
97 \fi
98 \fi}
102 \newlength{\mylen}
103 \newlength{\myhi}
104 \newlength{\px}
105 \newlength{\py}
106 \newlength{\pyy}
107 \newlength{\pxx}
110 \def\mghrulefill#1{\leavevmode\leaders\hrule\@height #1\hfill\kern\z@}
112 \newcommand{\DOCH}{%
113 \CNV\FmN{\@chapapp}\space \CNoV\thechapter
114 \par\nobreak
115 \vskip 20\p@
117 \newcommand{\DOTI}[1]{%
118 \CTV\FmTi{#1}\par\nobreak
119 \vskip 40\p@
121 \newcommand{\DOTIS}[1]{%
122 \CTV\FmTi{#1}\par\nobreak
123 \vskip 40\p@
126 %%%%%% SONNY DEF
128 \DeclareOption{Sonny}{%
129 \ChNameVar{\Large\sf}
130 \ChNumVar{\Huge}
131 \ChTitleVar{\Large\sf}
132 \ChRuleWidth{0.5pt}
133 \ChNameUpperCase
134 \renewcommand{\DOCH}{%
135 \raggedleft
136 \CNV\FmN{\@chapapp}\space \CNoV\thechapter
137 \par\nobreak
138 \vskip 40\p@}
139 \renewcommand{\DOTI}[1]{%
140 \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
141 \vskip 5\p@
142 \CTV\FmTi{#1}\par\nobreak
143 \mghrulefill{\RW}\par\nobreak
144 \vskip 40\p@}
145 \renewcommand{\DOTIS}[1]{%
146 \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
147 \vskip 5\p@
148 \CTV\FmTi{#1}\par\nobreak
149 \mghrulefill{\RW}\par\nobreak
150 \vskip 40\p@}
153 %%%%%% LENNY DEF
155 \DeclareOption{Lenny}{%
157 \ChNameVar{\fontsize{14}{16}\usefont{OT1}{phv}{m}{n}\selectfont}
158 \ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
159 \ChTitleVar{\Huge\bfseries\rm}
160 \ChRuleWidth{1pt}
161 \renewcommand{\DOCH}{%
162 \settowidth{\px}{\CNV\FmN{\@chapapp}}
163 \addtolength{\px}{2pt}
164 \settoheight{\py}{\CNV\FmN{\@chapapp}}
165 \addtolength{\py}{1pt}
167 \settowidth{\mylen}{\CNV\FmN{\@chapapp}\space\CNoV\thechapter}
168 \addtolength{\mylen}{1pt}
169 \settowidth{\pxx}{\CNoV\thechapter}
170 \addtolength{\pxx}{-1pt}
172 \settoheight{\pyy}{\CNoV\thechapter}
173 \addtolength{\pyy}{-2pt}
174 \setlength{\myhi}{\pyy}
175 \addtolength{\myhi}{-1\py}
176 \par
177 \parbox[b]{\textwidth}{%
178 \rule[\py]{\RW}{\myhi}%
179 \hskip -\RW%
180 \rule[\pyy]{\px}{\RW}%
181 \hskip -\px%
182 \raggedright%
183 \CNV\FmN{\@chapapp}\space\CNoV\thechapter%
184 \hskip1pt%
185 \mghrulefill{\RW}%
186 \rule{\RW}{\pyy}\par\nobreak%
187 \vskip -\baselineskip%
188 \vskip -\pyy%
189 \hskip \mylen%
190 \mghrulefill{\RW}\par\nobreak%
191 \vskip \pyy}%
192 \vskip 20\p@}
195 \renewcommand{\DOTI}[1]{%
196 \raggedright
197 \CTV\FmTi{#1}\par\nobreak
198 \vskip 40\p@}
200 \renewcommand{\DOTIS}[1]{%
201 \raggedright
202 \CTV\FmTi{#1}\par\nobreak
203 \vskip 40\p@}
207 %%%%%%% GLENN DEF
210 \DeclareOption{Glenn}{%
211 \ChNameVar{\bfseries\Large\sf}
212 \ChNumVar{\Huge}
213 \ChTitleVar{\bfseries\Large\rm}
214 \ChRuleWidth{1pt}
215 \ChNameUpperCase
216 \ChTitleUpperCase
217 \renewcommand{\DOCH}{%
218 \settoheight{\myhi}{\CTV\FmTi{Test}}
219 \setlength{\py}{\baselineskip}
220 \addtolength{\py}{\RW}
221 \addtolength{\py}{\myhi}
222 \setlength{\pyy}{\py}
223 \addtolength{\pyy}{-1\RW}
225 \raggedright
226 \CNV\FmN{\@chapapp}\space\CNoV\thechapter
227 \hskip 3pt\mghrulefill{\RW}\rule[-1\pyy]{2\RW}{\py}\par\nobreak}
229 \renewcommand{\DOTI}[1]{%
230 \addtolength{\pyy}{-4pt}
231 \settoheight{\myhi}{\CTV\FmTi{#1}}
232 \addtolength{\myhi}{\py}
233 \addtolength{\myhi}{-1\RW}
234 \vskip -1\pyy
235 \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
236 \raggedleft\CTV\FmTi{#1}\par\nobreak
237 \vskip 80\p@}
239 \renewcommand{\DOTIS}[1]{%
240 \setlength{\py}{10pt}
241 \setlength{\pyy}{\py}
242 \addtolength{\pyy}{\RW}
243 \setlength{\myhi}{\baselineskip}
244 \addtolength{\myhi}{\pyy}
245 \mghrulefill{\RW}\rule[-1\py]{2\RW}{\pyy}\par\nobreak
246 % \addtolength{}{}
247 \vskip -1\baselineskip
248 \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
249 \raggedleft\CTV\FmTi{#1}\par\nobreak
250 \vskip 60\p@}
253 %%%%%%% CONNY DEF
255 \DeclareOption{Conny}{%
256 \ChNameUpperCase
257 \ChTitleUpperCase
258 \ChNameVar{\centering\Huge\rm\bfseries}
259 \ChNumVar{\Huge}
260 \ChTitleVar{\centering\Huge\rm}
261 \ChRuleWidth{2pt}
263 \renewcommand{\DOCH}{%
264 \mghrulefill{3\RW}\par\nobreak
265 \vskip -0.5\baselineskip
266 \mghrulefill{\RW}\par\nobreak
267 \CNV\FmN{\@chapapp}\space \CNoV\thechapter
268 \par\nobreak
269 \vskip -0.5\baselineskip
271 \renewcommand{\DOTI}[1]{%
272 \mghrulefill{\RW}\par\nobreak
273 \CTV\FmTi{#1}\par\nobreak
274 \vskip 60\p@
276 \renewcommand{\DOTIS}[1]{%
277 \mghrulefill{\RW}\par\nobreak
278 \CTV\FmTi{#1}\par\nobreak
279 \vskip 60\p@
283 %%%%%%% REJNE DEF
285 \DeclareOption{Rejne}{%
287 \ChNameUpperCase
288 \ChTitleUpperCase
289 \ChNameVar{\centering\Large\rm}
290 \ChNumVar{\Huge}
291 \ChTitleVar{\centering\Huge\rm}
292 \ChRuleWidth{1pt}
293 \renewcommand{\DOCH}{%
294 \settoheight{\py}{\CNoV\thechapter}
295 \addtolength{\py}{-1pt}
296 \CNV\FmN{\@chapapp}\par\nobreak
297 \vskip 20\p@
298 \setlength{\myhi}{2\baselineskip}
299 \setlength{\px}{\myhi}
300 \addtolength{\px}{-1\RW}
301 \rule[-1\px]{\RW}{\myhi}\mghrulefill{\RW}\hskip
302 10pt\raisebox{-0.5\py}{\CNoV\thechapter}\hskip
303 10pt\mghrulefill{\RW}\rule[-1\px]{\RW}{\myhi}\par\nobreak
304 \vskip -1\p@
306 \renewcommand{\DOTI}[1]{%
307 \setlength{\mylen}{\textwidth}
308 \addtolength{\mylen}{-2\RW}
309 {\vrule width\RW}\parbox{\mylen}{\CTV\FmTi{#1}}{\vrule
310 width\RW}\par\nobreak
311 \vskip
312 -1pt\rule{\RW}{2\baselineskip}\mghrulefill{\RW}\rule{\RW}{2\baselineskip}
313 \vskip 60\p@
315 \renewcommand{\DOTIS}[1]{%
316 \setlength{\py}{\fboxrule}
317 \setlength{\fboxrule}{\RW}
318 \setlength{\mylen}{\textwidth}
319 \addtolength{\mylen}{-2\RW}
320 \fbox{\parbox{\mylen}{\vskip
321 2\baselineskip\CTV\FmTi{#1}\par\nobreak\vskip \baselineskip}}
322 \setlength{\fboxrule}{\py}
323 \vskip 60\p@
328 %%%%%%% BJARNE DEF
330 \DeclareOption{Bjarne}{%
331 \ChNameUpperCase
332 \ChTitleUpperCase
333 \ChNameVar{\raggedleft\normalsize\rm}
334 \ChNumVar{\raggedleft \bfseries\Large}
335 \ChTitleVar{\raggedleft \Large\rm}
336 \ChRuleWidth{1pt}
339 %% Note thechapter -> c@chapter fix appendix bug
341 \newcounter{AlphaCnt}
342 \newcounter{AlphaDecCnt}
343 \newcommand{\AlphaNo}{%
344 \ifcase\number\theAlphaCnt
345 \ifnum\c@chapter=0
346 ZERO\else{}\fi
347 \or ONE\or TWO\or THREE\or FOUR\or FIVE
348 \or SIX\or SEVEN\or EIGHT\or NINE\or TEN
349 \or ELEVEN\or TWELV\or THIRTEEN\or FOURTEEN\or FIFTEEN
350 \or SIXTEEN\or SEVENTEEN\or EIGHTEEN\or NINETEEN\fi
353 \newcommand{\AlphaDecNo}{%
354 \setcounter{AlphaDecCnt}{0}
355 \@whilenum\number\theAlphaCnt>0\do
356 {\addtocounter{AlphaCnt}{-10}
357 \addtocounter{AlphaDecCnt}{1}}
358 \ifnum\number\theAlphaCnt=0
359 \else
360 \addtocounter{AlphaDecCnt}{-1}
361 \addtocounter{AlphaCnt}{10}
365 \ifcase\number\theAlphaDecCnt\or TEN\or TWENTY\or THIRTY\or
366 FORTY\or FIFTY\or SIXTY\or SEVENTY\or EIGHTY\or NINETY\fi
368 \newcommand{\TheAlphaChapter}{%
370 \ifinapp
371 \thechapter
372 \else
373 \setcounter{AlphaCnt}{\c@chapter}
374 \ifnum\c@chapter<20
375 \AlphaNo
376 \else
377 \AlphaDecNo\AlphaNo
381 \renewcommand{\DOCH}{%
382 \mghrulefill{\RW}\par\nobreak
383 \CNV\FmN{\@chapapp}\par\nobreak
384 \CNoV\TheAlphaChapter\par\nobreak
385 \vskip -1\baselineskip\vskip 5pt\mghrulefill{\RW}\par\nobreak
386 \vskip 20\p@
388 \renewcommand{\DOTI}[1]{%
389 \CTV\FmTi{#1}\par\nobreak
390 \vskip 40\p@
392 \renewcommand{\DOTIS}[1]{%
393 \CTV\FmTi{#1}\par\nobreak
394 \vskip 40\p@
398 \DeclareOption*{%
399 \PackageWarning{fancychapter}{unknown style option}
402 \ProcessOptions* \relax
404 \def\@makechapterhead#1{%
405 \vspace*{50\p@}%
406 {\parindent \z@ \raggedright \normalfont
407 \ifnum \c@secnumdepth >\m@ne
408 \DOCH
410 \interlinepenalty\@M
411 \DOTI{#1}
413 \def\@schapter#1{\if@twocolumn
414 \@topnewpage[\@makeschapterhead{#1}]%
415 \else
416 \@makeschapterhead{#1}%
417 \@afterheading
418 \fi}
419 \def\@makeschapterhead#1{%
420 \vspace*{50\p@}%
421 {\parindent \z@ \raggedright
422 \normalfont
423 \interlinepenalty\@M
424 \DOTIS{#1}
425 \vskip 40\p@
428 \endinput