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
7 %%% Note Permission is granted to modify this file under
8 %%% the condition that it is saved using another
9 %%% file and package name.
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
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
}
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}}
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
53 \renewcommand\appendix{\par
54 \setcounter{chapter
}{0}%
55 \setcounter{section
}{0}%
57 \renewcommand\@chapapp
{\appendixname}%
58 \renewcommand\thechapter{\@Alph
\c@chapter
}}
62 \newcommand{\FmN}[1]{%
64 {\MakeUppercase#1}\LCNfalse
67 {\MakeLowercase#1}\UCNfalse
73 %%%% DEFINITION OF Title variables
74 \newcommand{\CTV}{\Huge\bfseries}
75 \newcommand{\ChTitleVar}[1]{\renewcommand{\CTV}{#1}}
77 %%%% DEFINITION OF the basic rule width
80 \newcommand{\ChRuleWidth}[1]{\setlength{\RW}{#1}}
86 \def\ChTitleLowerCase{\LCTtrue\UCTfalse}
87 \def\ChTitleUpperCase{\UCTtrue\LCTfalse}
88 \def\ChTitleAsIs{\UCTfalse\LCTfalse}
89 \newcommand{\FmTi}[1]{%
92 {\MakeUppercase#1}\LCTfalse
95 {\MakeLowercase#1}\UCTfalse
110 \def\mghrulefill#1{\leavevmode\leaders\hrule\@height
#1\hfill\kern\z@
}
113 \CNV\FmN{\@chapapp
}\space \CNoV\thechapter
117 \newcommand{\DOTI}[1]{%
118 \CTV\FmTi{#1}\par\nobreak
121 \newcommand{\DOTIS}[1]{%
122 \CTV\FmTi{#1}\par\nobreak
128 \DeclareOption{Sonny
}{%
129 \ChNameVar{\Large\sf}
131 \ChTitleVar{\Large\sf}
134 \renewcommand{\DOCH}{%
136 \CNV\FmN{\@chapapp
}\space \CNoV\thechapter
139 \renewcommand{\DOTI}[1]{%
140 \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
142 \CTV\FmTi{#1}\par\nobreak
143 \mghrulefill{\RW}\par\nobreak
145 \renewcommand{\DOTIS}[1]{%
146 \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
148 \CTV\FmTi{#1}\par\nobreak
149 \mghrulefill{\RW}\par\nobreak
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}
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}
177 \parbox[b
]{\textwidth}{%
178 \rule[\py]{\RW}{\myhi}%
180 \rule[\pyy]{\px}{\RW}%
183 \CNV\FmN{\@chapapp
}\space\CNoV\thechapter%
186 \rule{\RW}{\pyy}\par\nobreak%
187 \vskip -
\baselineskip%
190 \mghrulefill{\RW}\par\nobreak%
195 \renewcommand{\DOTI}[1]{%
197 \CTV\FmTi{#1}\par\nobreak
200 \renewcommand{\DOTIS}[1]{%
202 \CTV\FmTi{#1}\par\nobreak
210 \DeclareOption{Glenn
}{%
211 \ChNameVar{\bfseries\Large\sf}
213 \ChTitleVar{\bfseries\Large\rm}
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}
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}
235 \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
236 \raggedleft\CTV\FmTi{#1}\par\nobreak
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
247 \vskip -
1\baselineskip
248 \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
249 \raggedleft\CTV\FmTi{#1}\par\nobreak
255 \DeclareOption{Conny
}{%
258 \ChNameVar{\centering\Huge\rm\bfseries}
260 \ChTitleVar{\centering\Huge\rm}
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
269 \vskip -
0.5\baselineskip
271 \renewcommand{\DOTI}[1]{%
272 \mghrulefill{\RW}\par\nobreak
273 \CTV\FmTi{#1}\par\nobreak
276 \renewcommand{\DOTIS}[1]{%
277 \mghrulefill{\RW}\par\nobreak
278 \CTV\FmTi{#1}\par\nobreak
285 \DeclareOption{Rejne
}{%
289 \ChNameVar{\centering\Large\rm}
291 \ChTitleVar{\centering\Huge\rm}
293 \renewcommand{\DOCH}{%
294 \settoheight{\py}{\CNoV\thechapter}
295 \addtolength{\py}{-
1pt
}
296 \CNV\FmN{\@chapapp
}\par\nobreak
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
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
312 -
1pt
\rule{\RW}{2\baselineskip}\mghrulefill{\RW}\rule{\RW}{2\baselineskip}
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}
330 \DeclareOption{Bjarne
}{%
333 \ChNameVar{\raggedleft\normalsize\rm}
334 \ChNumVar{\raggedleft \bfseries\Large}
335 \ChTitleVar{\raggedleft \Large\rm}
339 %% Note thechapter -> c@chapter fix appendix bug
341 \newcounter{AlphaCnt
}
342 \newcounter{AlphaDecCnt
}
343 \newcommand{\AlphaNo}{%
344 \ifcase\number\theAlphaCnt
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
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}{%
373 \setcounter{AlphaCnt
}{\c@chapter
}
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
388 \renewcommand{\DOTI}[1]{%
389 \CTV\FmTi{#1}\par\nobreak
392 \renewcommand{\DOTIS}[1]{%
393 \CTV\FmTi{#1}\par\nobreak
399 \PackageWarning{fancychapter
}{unknown style option
}
402 \ProcessOptions*
\relax
404 \def\@makechapterhead
#1{%
406 {\parindent \z@
\raggedright \normalfont
407 \ifnum \c@secnumdepth >
\m@ne
413 \def\@schapter
#1{\if@twocolumn
414 \@topnewpage
[\@makeschapterhead
{#1}]%
416 \@makeschapterhead
{#1}%
419 \def\@makeschapterhead
#1{%
421 {\parindent \z@
\raggedright