Apparently the code to forestall Tk eating events was too aggressive (Tk user input...
[python/dscho.git] / Doc / texinputs / fncychap.sty
blobb0d7b76b742d913d638672df762d110f8befa308
1 %%% Derived from the original fncychap.sty,
2 %%% but changed ``TWELV'' to ``TWELVE''.
4 %%% Copyright Ulf A. Lindgren
5 %%% Department of Applied Electronics
6 %%% Chalmers University of Technology
7 %%% S-412 96 Gothenburg, Sweden
8 %%% E-mail lindgren@ae.chalmers.se
9 %%%
10 %%% Note Permission is granted to modify this file under
11 %%% the condition that it is saved using another
12 %%% file and package name.
13 %%%
14 %%% Revision 1.1
15 %%%
16 %%% Jan. 8th Modified package name base date option
17 %%% Jan. 22th Modified FmN and FmTi for error in book.cls
18 %%% \MakeUppercase{#}->{\MakeUppercase#}
19 %%% Apr. 6th Modified Lenny option to prevent undesired
20 %%% skip of line.
21 %%% Nov. 8th Fixed \@chapapp for AMS
22 %%% Feb. 11th Fixed appendix problem related to Bjarne
23 %%% Last modified Feb. 11th 1998
25 \NeedsTeXFormat{LaTeX2e}[1995/12/01]
26 \ProvidesPackage{fncychap}
27 [1997/04/06 v1.11
28 LaTeX package (Revised chapters)]
30 %%%% DEFINITION OF Chapapp variables
31 \newcommand{\CNV}{\huge\bfseries}
32 \newcommand{\ChNameVar}[1]{\renewcommand{\CNV}{#1}}
35 %%%% DEFINITION OF TheChapter variables
36 \newcommand{\CNoV}{\huge\bfseries}
37 \newcommand{\ChNumVar}[1]{\renewcommand{\CNoV}{#1}}
39 \newif\ifUCN
40 \UCNfalse
41 \newif\ifLCN
42 \LCNfalse
43 \def\ChNameLowerCase{\LCNtrue\UCNfalse}
44 \def\ChNameUpperCase{\UCNtrue\LCNfalse}
45 \def\ChNameAsIs{\UCNfalse\LCNfalse}
47 %%%%% Fix for AMSBook 971008
49 \@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}
52 %%%%% Fix for Bjarne and appendix 980211
54 \newif\ifinapp
55 \inappfalse
56 \renewcommand\appendix{\par
57 \setcounter{chapter}{0}%
58 \setcounter{section}{0}%
59 \inapptrue%
60 \renewcommand\@chapapp{\appendixname}%
61 \renewcommand\thechapter{\@Alph\c@chapter}}
63 %%%%%
65 \newcommand{\FmN}[1]{%
66 \ifUCN
67 {\MakeUppercase#1}\LCNfalse
68 \else
69 \ifLCN
70 {\MakeLowercase#1}\UCNfalse
71 \else #1
72 \fi
73 \fi}
76 %%%% DEFINITION OF Title variables
77 \newcommand{\CTV}{\Huge\bfseries}
78 \newcommand{\ChTitleVar}[1]{\renewcommand{\CTV}{#1}}
80 %%%% DEFINITION OF the basic rule width
81 \newlength{\RW}
82 \setlength{\RW}{1pt}
83 \newcommand{\ChRuleWidth}[1]{\setlength{\RW}{#1}}
85 \newif\ifUCT
86 \UCTfalse
87 \newif\ifLCT
88 \LCTfalse
89 \def\ChTitleLowerCase{\LCTtrue\UCTfalse}
90 \def\ChTitleUpperCase{\UCTtrue\LCTfalse}
91 \def\ChTitleAsIs{\UCTfalse\LCTfalse}
92 \newcommand{\FmTi}[1]{%
93 \ifUCT
95 {\MakeUppercase#1}\LCTfalse
96 \else
97 \ifLCT
98 {\MakeLowercase#1}\UCTfalse
99 \else #1
101 \fi}
105 \newlength{\mylen}
106 \newlength{\myhi}
107 \newlength{\px}
108 \newlength{\py}
109 \newlength{\pyy}
110 \newlength{\pxx}
113 \def\mghrulefill#1{\leavevmode\leaders\hrule\@height #1\hfill\kern\z@}
115 \newcommand{\DOCH}{%
116 \CNV\FmN{\@chapapp}\space \CNoV\thechapter
117 \par\nobreak
118 \vskip 20\p@
120 \newcommand{\DOTI}[1]{%
121 \CTV\FmTi{#1}\par\nobreak
122 \vskip 40\p@
124 \newcommand{\DOTIS}[1]{%
125 \CTV\FmTi{#1}\par\nobreak
126 \vskip 40\p@
129 %%%%%% SONNY DEF
131 \DeclareOption{Sonny}{%
132 \ChNameVar{\Large\sf}
133 \ChNumVar{\Huge}
134 \ChTitleVar{\Large\sf}
135 \ChRuleWidth{0.5pt}
136 \ChNameUpperCase
137 \renewcommand{\DOCH}{%
138 \raggedleft
139 \CNV\FmN{\@chapapp}\space \CNoV\thechapter
140 \par\nobreak
141 \vskip 40\p@}
142 \renewcommand{\DOTI}[1]{%
143 \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
144 \vskip 5\p@
145 \CTV\FmTi{#1}\par\nobreak
146 \mghrulefill{\RW}\par\nobreak
147 \vskip 40\p@}
148 \renewcommand{\DOTIS}[1]{%
149 \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
150 \vskip 5\p@
151 \CTV\FmTi{#1}\par\nobreak
152 \mghrulefill{\RW}\par\nobreak
153 \vskip 40\p@}
156 %%%%%% LENNY DEF
158 \DeclareOption{Lenny}{%
160 \ChNameVar{\fontsize{14}{16}\usefont{OT1}{phv}{m}{n}\selectfont}
161 \ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
162 \ChTitleVar{\Huge\bfseries\rm}
163 \ChRuleWidth{1pt}
164 \renewcommand{\DOCH}{%
165 \settowidth{\px}{\CNV\FmN{\@chapapp}}
166 \addtolength{\px}{2pt}
167 \settoheight{\py}{\CNV\FmN{\@chapapp}}
168 \addtolength{\py}{1pt}
170 \settowidth{\mylen}{\CNV\FmN{\@chapapp}\space\CNoV\thechapter}
171 \addtolength{\mylen}{1pt}
172 \settowidth{\pxx}{\CNoV\thechapter}
173 \addtolength{\pxx}{-1pt}
175 \settoheight{\pyy}{\CNoV\thechapter}
176 \addtolength{\pyy}{-2pt}
177 \setlength{\myhi}{\pyy}
178 \addtolength{\myhi}{-1\py}
179 \par
180 \parbox[b]{\textwidth}{%
181 \rule[\py]{\RW}{\myhi}%
182 \hskip -\RW%
183 \rule[\pyy]{\px}{\RW}%
184 \hskip -\px%
185 \raggedright%
186 \CNV\FmN{\@chapapp}\space\CNoV\thechapter%
187 \hskip1pt%
188 \mghrulefill{\RW}%
189 \rule{\RW}{\pyy}\par\nobreak%
190 \vskip -\baselineskip%
191 \vskip -\pyy%
192 \hskip \mylen%
193 \mghrulefill{\RW}\par\nobreak%
194 \vskip \pyy}%
195 \vskip 20\p@}
198 \renewcommand{\DOTI}[1]{%
199 \raggedright
200 \CTV\FmTi{#1}\par\nobreak
201 \vskip 40\p@}
203 \renewcommand{\DOTIS}[1]{%
204 \raggedright
205 \CTV\FmTi{#1}\par\nobreak
206 \vskip 40\p@}
210 %%%%%%% GLENN DEF
213 \DeclareOption{Glenn}{%
214 \ChNameVar{\bfseries\Large\sf}
215 \ChNumVar{\Huge}
216 \ChTitleVar{\bfseries\Large\rm}
217 \ChRuleWidth{1pt}
218 \ChNameUpperCase
219 \ChTitleUpperCase
220 \renewcommand{\DOCH}{%
221 \settoheight{\myhi}{\CTV\FmTi{Test}}
222 \setlength{\py}{\baselineskip}
223 \addtolength{\py}{\RW}
224 \addtolength{\py}{\myhi}
225 \setlength{\pyy}{\py}
226 \addtolength{\pyy}{-1\RW}
228 \raggedright
229 \CNV\FmN{\@chapapp}\space\CNoV\thechapter
230 \hskip 3pt\mghrulefill{\RW}\rule[-1\pyy]{2\RW}{\py}\par\nobreak}
232 \renewcommand{\DOTI}[1]{%
233 \addtolength{\pyy}{-4pt}
234 \settoheight{\myhi}{\CTV\FmTi{#1}}
235 \addtolength{\myhi}{\py}
236 \addtolength{\myhi}{-1\RW}
237 \vskip -1\pyy
238 \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
239 \raggedleft\CTV\FmTi{#1}\par\nobreak
240 \vskip 80\p@}
242 \renewcommand{\DOTIS}[1]{%
243 \setlength{\py}{10pt}
244 \setlength{\pyy}{\py}
245 \addtolength{\pyy}{\RW}
246 \setlength{\myhi}{\baselineskip}
247 \addtolength{\myhi}{\pyy}
248 \mghrulefill{\RW}\rule[-1\py]{2\RW}{\pyy}\par\nobreak
249 % \addtolength{}{}
250 \vskip -1\baselineskip
251 \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
252 \raggedleft\CTV\FmTi{#1}\par\nobreak
253 \vskip 60\p@}
256 %%%%%%% CONNY DEF
258 \DeclareOption{Conny}{%
259 \ChNameUpperCase
260 \ChTitleUpperCase
261 \ChNameVar{\centering\Huge\rm\bfseries}
262 \ChNumVar{\Huge}
263 \ChTitleVar{\centering\Huge\rm}
264 \ChRuleWidth{2pt}
266 \renewcommand{\DOCH}{%
267 \mghrulefill{3\RW}\par\nobreak
268 \vskip -0.5\baselineskip
269 \mghrulefill{\RW}\par\nobreak
270 \CNV\FmN{\@chapapp}\space \CNoV\thechapter
271 \par\nobreak
272 \vskip -0.5\baselineskip
274 \renewcommand{\DOTI}[1]{%
275 \mghrulefill{\RW}\par\nobreak
276 \CTV\FmTi{#1}\par\nobreak
277 \vskip 60\p@
279 \renewcommand{\DOTIS}[1]{%
280 \mghrulefill{\RW}\par\nobreak
281 \CTV\FmTi{#1}\par\nobreak
282 \vskip 60\p@
286 %%%%%%% REJNE DEF
288 \DeclareOption{Rejne}{%
290 \ChNameUpperCase
291 \ChTitleUpperCase
292 \ChNameVar{\centering\Large\rm}
293 \ChNumVar{\Huge}
294 \ChTitleVar{\centering\Huge\rm}
295 \ChRuleWidth{1pt}
296 \renewcommand{\DOCH}{%
297 \settoheight{\py}{\CNoV\thechapter}
298 \addtolength{\py}{-1pt}
299 \CNV\FmN{\@chapapp}\par\nobreak
300 \vskip 20\p@
301 \setlength{\myhi}{2\baselineskip}
302 \setlength{\px}{\myhi}
303 \addtolength{\px}{-1\RW}
304 \rule[-1\px]{\RW}{\myhi}\mghrulefill{\RW}\hskip
305 10pt\raisebox{-0.5\py}{\CNoV\thechapter}\hskip
306 10pt\mghrulefill{\RW}\rule[-1\px]{\RW}{\myhi}\par\nobreak
307 \vskip -1\p@
309 \renewcommand{\DOTI}[1]{%
310 \setlength{\mylen}{\textwidth}
311 \addtolength{\mylen}{-2\RW}
312 {\vrule width\RW}\parbox{\mylen}{\CTV\FmTi{#1}}{\vrule
313 width\RW}\par\nobreak
314 \vskip
315 -1pt\rule{\RW}{2\baselineskip}\mghrulefill{\RW}\rule{\RW}{2\baselineskip}
316 \vskip 60\p@
318 \renewcommand{\DOTIS}[1]{%
319 \setlength{\py}{\fboxrule}
320 \setlength{\fboxrule}{\RW}
321 \setlength{\mylen}{\textwidth}
322 \addtolength{\mylen}{-2\RW}
323 \fbox{\parbox{\mylen}{\vskip
324 2\baselineskip\CTV\FmTi{#1}\par\nobreak\vskip \baselineskip}}
325 \setlength{\fboxrule}{\py}
326 \vskip 60\p@
331 %%%%%%% BJARNE DEF
333 \DeclareOption{Bjarne}{%
334 \ChNameUpperCase
335 \ChTitleUpperCase
336 \ChNameVar{\raggedleft\normalsize\rm}
337 \ChNumVar{\raggedleft \bfseries\Large}
338 \ChTitleVar{\raggedleft \Large\rm}
339 \ChRuleWidth{1pt}
342 %% Note thechapter -> c@chapter fix appendix bug
344 \newcounter{AlphaCnt}
345 \newcounter{AlphaDecCnt}
346 \newcommand{\AlphaNo}{%
347 \ifcase\number\theAlphaCnt
348 \ifnum\c@chapter=0
349 ZERO\else{}\fi
350 \or ONE\or TWO\or THREE\or FOUR\or FIVE
351 \or SIX\or SEVEN\or EIGHT\or NINE\or TEN
352 \or ELEVEN\or TWELVE\or THIRTEEN\or FOURTEEN\or FIFTEEN
353 \or SIXTEEN\or SEVENTEEN\or EIGHTEEN\or NINETEEN\fi
356 \newcommand{\AlphaDecNo}{%
357 \setcounter{AlphaDecCnt}{0}
358 \@whilenum\number\theAlphaCnt>0\do
359 {\addtocounter{AlphaCnt}{-10}
360 \addtocounter{AlphaDecCnt}{1}}
361 \ifnum\number\theAlphaCnt=0
362 \else
363 \addtocounter{AlphaDecCnt}{-1}
364 \addtocounter{AlphaCnt}{10}
368 \ifcase\number\theAlphaDecCnt\or TEN\or TWENTY\or THIRTY\or
369 FORTY\or FIFTY\or SIXTY\or SEVENTY\or EIGHTY\or NINETY\fi
371 \newcommand{\TheAlphaChapter}{%
373 \ifinapp
374 \thechapter
375 \else
376 \setcounter{AlphaCnt}{\c@chapter}
377 \ifnum\c@chapter<20
378 \AlphaNo
379 \else
380 \AlphaDecNo\AlphaNo
384 \renewcommand{\DOCH}{%
385 \mghrulefill{\RW}\par\nobreak
386 \CNV\FmN{\@chapapp}\par\nobreak
387 \CNoV\TheAlphaChapter\par\nobreak
388 \vskip -1\baselineskip\vskip 5pt\mghrulefill{\RW}\par\nobreak
389 \vskip 20\p@
391 \renewcommand{\DOTI}[1]{%
392 \CTV\FmTi{#1}\par\nobreak
393 \vskip 40\p@
395 \renewcommand{\DOTIS}[1]{%
396 \CTV\FmTi{#1}\par\nobreak
397 \vskip 40\p@
401 \DeclareOption*{%
402 \PackageWarning{fancychapter}{unknown style option}
405 \ProcessOptions* \relax
407 \def\@makechapterhead#1{%
408 \vspace*{50\p@}%
409 {\parindent \z@ \raggedright \normalfont
410 \ifnum \c@secnumdepth >\m@ne
411 \DOCH
413 \interlinepenalty\@M
414 \DOTI{#1}
416 \def\@schapter#1{\if@twocolumn
417 \@topnewpage[\@makeschapterhead{#1}]%
418 \else
419 \@makeschapterhead{#1}%
420 \@afterheading
421 \fi}
422 \def\@makeschapterhead#1{%
423 \vspace*{50\p@}%
424 {\parindent \z@ \raggedright
425 \normalfont
426 \interlinepenalty\@M
427 \DOTIS{#1}
428 \vskip 40\p@
431 \endinput