Statistics
| Branch: | Tag: | Revision:

root / docs / build / latex / fncychap.sty @ 216bb34c

History | View | Annotate | Download (18.3 kB)

1
%%% Copyright   Ulf A. Lindgren
2
%%%
3
%%% Note        Premission is granted to modify this file under
4
%%%             the condition that it is saved using another
5
%%%             file and package name.
6
%%%
7
%%% Revision    1.1 (1997)
8
%%%
9
%%%             Jan. 8th Modified package name base date option
10
%%%             Jan. 22th Modified FmN and FmTi for error in book.cls
11
%%%                  \MakeUppercase{#}->{\MakeUppercase#}
12
%%%             Apr. 6th Modified Lenny option to prevent undesired 
13
%%%                  skip of line.
14
%%%             Nov. 8th Fixed \@chapapp for AMS
15
%%%
16
%%% Revision    1.2 (1998)
17
%%%
18
%%%             Feb. 11th Fixed appendix problem related to Bjarne
19
%%%             Aug. 11th Fixed problem related to 11pt and 12pt 
20
%%%                  suggested by Tomas Lundberg. THANKS!
21
%%%
22
%%% Revision    1.3 (2004)
23
%%%             Sep. 20th problem with frontmatter, mainmatter and
24
%%%                  backmatter, pointed out by Lapo Mori
25
%%%
26
%%% Revision    1.31 (2004)
27
%%%             Sep. 21th problem with the Rejne definition streched text
28
%%%                  caused ugly gaps in the vrule aligned with the title
29
%%%                  text. Kindly pointed out to me by Hendri Adriaens
30
%%%
31
%%% Revision    1.32 (2005)
32
%%%             Jun. 23th compatibility problem with the KOMA class 'scrbook.cls'
33
%%%                  a remedy is a redefinition of '\@schapter' in
34
%%%                  line with that used in KOMA. The problem was pointed
35
%%%                  out to me by Mikkel Holm Olsen
36
%%%
37
%%% Revision    1.33 (2005)
38
%%%             Aug. 9th misspelled ``TWELV'' corrected, the error was pointed
39
%%%                  out to me by George Pearson
40
%%%
41
%%% Revision    1.34 (2007)
42
%%%             Added an alternative to Lenny provided by Peter
43
%%%             Osborne (2005-11-28)
44
%%%             Corrected front, main and back matter, based on input
45
%%%             from Bas van Gils (2006-04-24)
46
%%%             Jul. 30th Added Bjornstrup option provided by Jean-Marc
47
%%%             Francois (2007-01-05).
48
%%%             Reverted to \MakeUppercase{#} see rev 1.1, solved
49
%%%             problem with MakeUppercase and MakeLowercase pointed
50
%%%             out by Marco Feuerstein  (2007-06-06) 
51

    
52

    
53
%%% Last modified   Jul. 2007
54

    
55
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
56
\ProvidesPackage{fncychap}
57
             [2007/07/30 v1.34
58
                 LaTeX package (Revised chapters)]
59

    
60
%%%% For conditional inclusion of color
61
\newif\ifusecolor
62
\usecolorfalse
63

    
64

    
65

    
66
%%%% DEFINITION OF Chapapp variables
67
\newcommand{\CNV}{\huge\bfseries}
68
\newcommand{\ChNameVar}[1]{\renewcommand{\CNV}{#1}}
69

    
70

    
71
%%%% DEFINITION OF TheChapter variables
72
\newcommand{\CNoV}{\huge\bfseries}
73
\newcommand{\ChNumVar}[1]{\renewcommand{\CNoV}{#1}}
74

    
75
\newif\ifUCN
76
\UCNfalse
77
\newif\ifLCN
78
\LCNfalse
79
\def\ChNameLowerCase{\LCNtrue\UCNfalse}
80
\def\ChNameUpperCase{\UCNtrue\LCNfalse}
81
\def\ChNameAsIs{\UCNfalse\LCNfalse}
82

    
83
%%%%% Fix for AMSBook 971008
84

    
85
\@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}
86

    
87

    
88
%%%%% Fix for Bjarne and appendix 980211
89

    
90
\newif\ifinapp
91
\inappfalse
92
\renewcommand\appendix{\par
93
  \setcounter{chapter}{0}%
94
  \setcounter{section}{0}%
95
  \inapptrue%
96
  \renewcommand\@chapapp{\appendixname}%
97
  \renewcommand\thechapter{\@Alph\c@chapter}}
98

    
99
%%%%% Fix for frontmatter, mainmatter, and backmatter 040920
100

    
101
\@ifundefined{@mainmatter}{\newif\if@mainmatter \@mainmattertrue}{}
102

    
103
%%%%%
104

    
105

    
106

    
107
\newcommand{\FmN}[1]{%
108
\ifUCN
109
   {\MakeUppercase{#1}}\LCNfalse
110
\else
111
   \ifLCN
112
      {\MakeLowercase{#1}}\UCNfalse
113
   \else #1
114
   \fi
115
\fi}
116

    
117

    
118
%%%% DEFINITION OF Title variables
119
\newcommand{\CTV}{\Huge\bfseries}
120
\newcommand{\ChTitleVar}[1]{\renewcommand{\CTV}{#1}}
121

    
122
%%%% DEFINITION OF the basic rule width
123
\newlength{\RW}
124
\setlength{\RW}{1pt}
125
\newcommand{\ChRuleWidth}[1]{\setlength{\RW}{#1}}
126

    
127
\newif\ifUCT
128
\UCTfalse
129
\newif\ifLCT
130
\LCTfalse
131
\def\ChTitleLowerCase{\LCTtrue\UCTfalse}
132
\def\ChTitleUpperCase{\UCTtrue\LCTfalse}
133
\def\ChTitleAsIs{\UCTfalse\LCTfalse}
134
\newcommand{\FmTi}[1]{%
135
\ifUCT
136
   {\MakeUppercase{#1}}\LCTfalse
137
\else
138
   \ifLCT
139
      {\MakeLowercase{#1}}\UCTfalse
140
   \else {#1}
141
   \fi
142
\fi}
143

    
144

    
145

    
146
\newlength{\mylen}
147
\newlength{\myhi}
148
\newlength{\px}
149
\newlength{\py}
150
\newlength{\pyy}
151
\newlength{\pxx}
152

    
153

    
154
\def\mghrulefill#1{\leavevmode\leaders\hrule\@height #1\hfill\kern\z@}
155

    
156
\newcommand{\DOCH}{%
157
  \CNV\FmN{\@chapapp}\space \CNoV\thechapter
158
  \par\nobreak
159
  \vskip 20\p@
160
  }
161
\newcommand{\DOTI}[1]{%
162
    \CTV\FmTi{#1}\par\nobreak
163
    \vskip 40\p@
164
    }
165
\newcommand{\DOTIS}[1]{%
166
    \CTV\FmTi{#1}\par\nobreak
167
    \vskip 40\p@
168
    }
169

    
170
%%%%%% SONNY DEF
171

    
172
\DeclareOption{Sonny}{%
173
  \ChNameVar{\Large\sf}
174
  \ChNumVar{\Huge}
175
  \ChTitleVar{\Large\sf}
176
  \ChRuleWidth{0.5pt}
177
  \ChNameUpperCase
178
  \renewcommand{\DOCH}{%
179
    \raggedleft
180
    \CNV\FmN{\@chapapp}\space \CNoV\thechapter
181
    \par\nobreak
182
    \vskip 40\p@}
183
  \renewcommand{\DOTI}[1]{%
184
    \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
185
    \vskip 5\p@
186
    \CTV\FmTi{#1}\par\nobreak
187
    \mghrulefill{\RW}\par\nobreak
188
    \vskip 40\p@}
189
  \renewcommand{\DOTIS}[1]{%
190
    \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
191
    \vskip 5\p@
192
    \CTV\FmTi{#1}\par\nobreak
193
    \mghrulefill{\RW}\par\nobreak
194
    \vskip 40\p@}
195
}
196

    
197
%%%%%% LENNY DEF
198

    
199
\DeclareOption{Lenny}{%
200

    
201
  \ChNameVar{\fontsize{14}{16}\usefont{OT1}{phv}{m}{n}\selectfont}
202
  \ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
203
  \ChTitleVar{\Huge\bfseries\rm}
204
  \ChRuleWidth{1pt}
205
  \renewcommand{\DOCH}{%
206
    \settowidth{\px}{\CNV\FmN{\@chapapp}}
207
    \addtolength{\px}{2pt}
208
    \settoheight{\py}{\CNV\FmN{\@chapapp}}
209
    \addtolength{\py}{1pt}
210

    
211
    \settowidth{\mylen}{\CNV\FmN{\@chapapp}\space\CNoV\thechapter}
212
    \addtolength{\mylen}{1pt}
213
    \settowidth{\pxx}{\CNoV\thechapter}
214
    \addtolength{\pxx}{-1pt}
215

    
216
    \settoheight{\pyy}{\CNoV\thechapter}
217
    \addtolength{\pyy}{-2pt}
218
    \setlength{\myhi}{\pyy}
219
    \addtolength{\myhi}{-1\py}
220
    \par
221
    \parbox[b]{\textwidth}{%
222
    \rule[\py]{\RW}{\myhi}%
223
    \hskip -\RW%
224
    \rule[\pyy]{\px}{\RW}%
225
    \hskip -\px%
226
    \raggedright%
227
    \CNV\FmN{\@chapapp}\space\CNoV\thechapter%
228
    \hskip1pt%
229
    \mghrulefill{\RW}%
230
    \rule{\RW}{\pyy}\par\nobreak%
231
    \vskip -\baselineskip%
232
    \vskip -\pyy%
233
    \hskip \mylen%
234
    \mghrulefill{\RW}\par\nobreak%
235
    \vskip \pyy}%
236
    \vskip 20\p@}
237
 
238

    
239
  \renewcommand{\DOTI}[1]{%
240
    \raggedright
241
    \CTV\FmTi{#1}\par\nobreak
242
    \vskip 40\p@}
243

    
244
  \renewcommand{\DOTIS}[1]{%
245
    \raggedright
246
    \CTV\FmTi{#1}\par\nobreak
247
    \vskip 40\p@}
248
 }
249

    
250
%%%%%% Peter Osbornes' version of LENNY DEF
251

    
252
\DeclareOption{PetersLenny}{%
253

    
254
% five new lengths 
255
\newlength{\bl}                           %  bottom left   : orig \space
256
\setlength{\bl}{6pt}
257
\newcommand{\BL}[1]{\setlength{\bl}{#1}}
258
\newlength{\br}                           %  bottom right  : orig 1pt
259
\setlength{\br}{1pt}
260
\newcommand{\BR}[1]{\setlength{\br}{#1}}
261
\newlength{\tl}                           %  top left      : orig 2pt
262
\setlength{\tl}{2pt}
263
\newcommand{\TL}[1]{\setlength{\tl}{#1}}
264
\newlength{\trr}                           %  top right      :orig 1pt 
265
\setlength{\trr}{1pt}
266
\newcommand{\TR}[1]{\setlength{\trr}{#1}}
267
\newlength{\blrule}                           %  top right      :orig 1pt 
268
\setlength{\trr}{0pt}
269
\newcommand{\BLrule}[1]{\setlength{\blrule}{#1}}
270

    
271

    
272
  \ChNameVar{\fontsize{14}{16}\usefont{OT1}{phv}{m}{n}\selectfont}
273
  \ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
274
  \ChTitleVar{\Huge\bfseries\rm}
275
  \ChRuleWidth{1pt}
276
\renewcommand{\DOCH}{%
277

    
278

    
279
%%%%%%%                                   tweaks for 1--9 and A--Z
280
\ifcase\c@chapter\relax%
281
\or\BL{-3pt}\TL{-4pt}\BR{0pt}\TR{-6pt}%1
282
\or\BL{0pt}\TL{-4pt}\BR{2pt}\TR{-4pt}%2
283
\or\BL{0pt}\TL{-4pt}\BR{2pt}\TR{-4pt}%3
284
\or\BL{0pt}\TL{5pt}\BR{2pt}\TR{-4pt}%4
285
\or\BL{0pt}\TL{3pt}\BR{2pt}\TR{-4pt}%5
286
\or\BL{-1pt}\TL{0pt}\BR{2pt}\TR{-2pt}%6
287
\or\BL{0pt}\TL{-3pt}\BR{2pt}\TR{-2pt}%7
288
\or\BL{0pt}\TL{-3pt}\BR{2pt}\TR{-2pt}%8
289
\or\BL{0pt}\TL{-3pt}\BR{-4pt}\TR{-2pt}%9
290
\or\BL{-3pt}\TL{-3pt}\BR{2pt}\TR{-7pt}%10
291
\or\BL{-6pt}\TL{-6pt}\BR{0pt}\TR{-9pt}%11
292
\or\BL{-6pt}\TL{-6pt}\BR{2pt}\TR{-7pt}%12
293
\or\BL{-5pt}\TL{-5pt}\BR{0pt}\TR{-9pt}%13
294
\or\BL{-6pt}\TL{-6pt}\BR{0pt}\TR{-9pt}%14
295
\or\BL{-3pt}\TL{-3pt}\BR{3pt}\TR{-6pt}%15
296
\or\BL{-3pt}\TL{-3pt}\BR{3pt}\TR{-6pt}%16
297
\or\BL{-5pt}\TL{-3pt}\BR{-8pt}\TR{-6pt}%17
298
\or\BL{-5pt}\TL{-5pt}\BR{0pt}\TR{-9pt}%18
299
\or\BL{-3pt}\TL{-3pt}\BR{-6pt}\TR{-9pt}%19
300
\or\BL{0pt}\TL{0pt}\BR{0pt}\TR{-5pt}%20
301
\fi
302

    
303
\ifinapp\ifcase\c@chapter\relax%
304
\or\BL{0pt}\TL{14pt}\BR{5pt}\TR{-19pt}%A
305
\or\BL{0pt}\TL{-5pt}\BR{-3pt}\TR{-8pt}%B
306
\or\BL{-3pt}\TL{-2pt}\BR{1pt}\TR{-6pt}\BLrule{0pt}%C
307
\or\BL{0pt}\TL{-5pt}\BR{-3pt}\TR{-8pt}\BLrule{0pt}%D
308
\or\BL{0pt}\TL{-5pt}\BR{2pt}\TR{-3pt}%E
309
\or\BL{0pt}\TL{-5pt}\BR{-10pt}\TR{-1pt}%F
310
\or\BL{-3pt}\TL{0pt}\BR{0pt}\TR{-7pt}%G
311
\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%H
312
\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%I
313
\or\BL{2pt}\TL{0pt}\BR{-3pt}\TR{1pt}%J
314
\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%K
315
\or\BL{0pt}\TL{-5pt}\BR{2pt}\TR{-19pt}%L
316
\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%M
317
\or\BL{0pt}\TL{-5pt}\BR{-2pt}\TR{-1pt}%N
318
\or\BL{-3pt}\TL{-2pt}\BR{-3pt}\TR{-11pt}%O
319
\or\BL{0pt}\TL{-5pt}\BR{-9pt}\TR{-3pt}%P
320
\or\BL{-3pt}\TL{-2pt}\BR{-3pt}\TR{-11pt}%Q
321
\or\BL{0pt}\TL{-5pt}\BR{4pt}\TR{-8pt}%R
322
\or\BL{-2pt}\TL{-2pt}\BR{-2pt}\TR{-7pt}%S
323
\or\BL{-3pt}\TL{0pt}\BR{-5pt}\TR{4pt}\BLrule{8pt}%T
324
\or\BL{-7pt}\TL{-11pt}\BR{-5pt}\TR{-7pt}\BLrule{0pt}%U
325
\or\BL{-14pt}\TL{-5pt}\BR{-14pt}\TR{-1pt}\BLrule{14pt}%V
326
\or\BL{-10pt}\TL{-9pt}\BR{-13pt}\TR{-3pt}\BLrule{7pt}%W
327
\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}\BLrule{0pt}%X
328
\or\BL{-6pt}\TL{-4pt}\BR{-7pt}\TR{1pt}\BLrule{7pt}%Y
329
\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}\BLrule{0pt}%Z
330
\fi\fi
331
%%%%%%%
332
    \settowidth{\px}{\CNV\FmN{\@chapapp}}
333
    \addtolength{\px}{\tl}        %MOD change 2pt to \tl
334
    \settoheight{\py}{\CNV\FmN{\@chapapp}}
335
    \addtolength{\py}{1pt}
336

    
337
    \settowidth{\mylen}{\CNV\FmN{\@chapapp}\space\CNoV\thechapter}
338
    \addtolength{\mylen}{\trr}% MOD change 1pt to \tr
339
    \settowidth{\pxx}{\CNoV\thechapter}
340
    \addtolength{\pxx}{-1pt}
341

    
342
    \settoheight{\pyy}{\CNoV\thechapter}
343
    \addtolength{\pyy}{-2pt}
344
    \setlength{\myhi}{\pyy}
345
    \addtolength{\myhi}{-1\py}
346
    \par
347
    \parbox[b]{\textwidth}{%
348
    \rule[\py]{\RW}{\myhi}%
349
    \hskip -\RW%
350
    \rule[\pyy]{\px}{\RW}% 
351
    \hskip -\px%
352
    \raggedright%
353
    \CNV\FmN{\@chapapp}\rule{\blrule}{\RW}\hskip\bl\CNoV\thechapter%MOD 
354
%    \CNV\FmN{\@chapapp}\space\CNoV\thechapter                     %ORIGINAL
355
    \hskip\br%                           %MOD 1pt to \br
356
    \mghrulefill{\RW}% 
357
    \rule{\RW}{\pyy}\par\nobreak% 
358
    \vskip -\baselineskip%
359
    \vskip -\pyy%
360
    \hskip \mylen%
361
    \mghrulefill{\RW}\par\nobreak%
362
    \vskip \pyy}%
363
    \vskip 20\p@}
364
 
365

    
366
  \renewcommand{\DOTI}[1]{%
367
    \raggedright
368
    \CTV\FmTi{#1}\par\nobreak
369
    \vskip 40\p@}
370

    
371
  \renewcommand{\DOTIS}[1]{%
372
    \raggedright
373
    \CTV\FmTi{#1}\par\nobreak
374
    \vskip 40\p@}
375
 }
376

    
377

    
378
%
379

    
380

    
381
%%%%%% BJORNSTRUP DEF
382

    
383
\DeclareOption{Bjornstrup}{%
384
  \usecolortrue
385
  % pzc (Zapf Chancelery) is nice.  ppl (Palatino) is cool too.
386
  \ChNumVar{\fontsize{76}{80}\usefont{OT1}{pzc}{m}{n}\selectfont}
387
  \ChTitleVar{\raggedleft\Large\sffamily\bfseries}
388

    
389
  \setlength{\myhi}{10pt}         % Space between grey box border and text
390
  \setlength{\mylen}{\textwidth}
391
  \addtolength{\mylen}{-2\myhi}
392
  \renewcommand{\DOCH}{%
393
    \settowidth{\py}{\CNoV\thechapter}
394
    \addtolength{\py}{-10pt}      % Amount of space by which the
395
%                                  % number is shifted right
396
    \fboxsep=0pt%
397
    \colorbox[gray]{.85}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}%
398
    \kern-\py\raise20pt%
399
    \hbox{\color[gray]{.5}\CNoV\thechapter}\\%
400
  }
401
  
402
  \renewcommand{\DOTI}[1]{%
403
    \nointerlineskip\raggedright%
404
    \fboxsep=\myhi%
405
    \vskip-1ex%
406
    \colorbox[gray]{.85}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak%
407
    \vskip 40\p@%
408
  }
409

    
410
  \renewcommand{\DOTIS}[1]{%
411
    \fboxsep=0pt
412
    \colorbox[gray]{.85}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}\\%
413
    \nointerlineskip\raggedright%
414
    \fboxsep=\myhi%
415
    \colorbox[gray]{.85}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak%
416
    \vskip 40\p@%
417
  }
418
}
419

    
420

    
421
%%%%%%% GLENN DEF
422

    
423

    
424
\DeclareOption{Glenn}{%
425
  \ChNameVar{\bfseries\Large\sf}
426
  \ChNumVar{\Huge}
427
  \ChTitleVar{\bfseries\Large\rm}
428
  \ChRuleWidth{1pt}
429
  \ChNameUpperCase
430
  \ChTitleUpperCase
431
  \renewcommand{\DOCH}{%
432
    \settoheight{\myhi}{\CTV\FmTi{Test}}
433
    \setlength{\py}{\baselineskip}
434
    \addtolength{\py}{\RW}
435
    \addtolength{\py}{\myhi}
436
    \setlength{\pyy}{\py}
437
    \addtolength{\pyy}{-1\RW}
438
     
439
    \raggedright
440
    \CNV\FmN{\@chapapp}\space\CNoV\thechapter
441
    \hskip 3pt\mghrulefill{\RW}\rule[-1\pyy]{2\RW}{\py}\par\nobreak}
442

    
443
  \renewcommand{\DOTI}[1]{%
444
    \addtolength{\pyy}{-4pt}
445
    \settoheight{\myhi}{\CTV\FmTi{#1}}
446
    \addtolength{\myhi}{\py}
447
    \addtolength{\myhi}{-1\RW}
448
    \vskip -1\pyy
449
    \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
450
    \raggedleft\CTV\FmTi{#1}\par\nobreak
451
    \vskip 80\p@}
452

    
453
\newlength{\backskip}
454
  \renewcommand{\DOTIS}[1]{%
455
%    \setlength{\py}{10pt}
456
%    \setlength{\pyy}{\py}
457
%    \addtolength{\pyy}{\RW}
458
%    \setlength{\myhi}{\baselineskip}
459
%    \addtolength{\myhi}{\pyy}
460
%    \mghrulefill{\RW}\rule[-1\py]{2\RW}{\pyy}\par\nobreak
461
%    \addtolength{}{}
462
%\vskip -1\baselineskip
463
%    \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
464
%    \raggedleft\CTV\FmTi{#1}\par\nobreak
465
%    \vskip 60\p@}
466
%% Fix suggested by Tomas Lundberg
467
    \setlength{\py}{25pt}  % eller vad man vill
468
    \setlength{\pyy}{\py}
469
    \setlength{\backskip}{\py}
470
    \addtolength{\backskip}{2pt}
471
    \addtolength{\pyy}{\RW}
472
    \setlength{\myhi}{\baselineskip}
473
    \addtolength{\myhi}{\pyy}
474
    \mghrulefill{\RW}\rule[-1\py]{2\RW}{\pyy}\par\nobreak
475
    \vskip -1\backskip
476
    \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 3pt %
477
    \raggedleft\CTV\FmTi{#1}\par\nobreak
478
    \vskip 40\p@}
479
 }
480

    
481
%%%%%%% CONNY DEF
482

    
483
\DeclareOption{Conny}{%
484
  \ChNameUpperCase
485
  \ChTitleUpperCase  
486
  \ChNameVar{\centering\Huge\rm\bfseries}
487
  \ChNumVar{\Huge}
488
  \ChTitleVar{\centering\Huge\rm}
489
  \ChRuleWidth{2pt}
490

    
491
  \renewcommand{\DOCH}{%
492
    \mghrulefill{3\RW}\par\nobreak
493
    \vskip -0.5\baselineskip
494
    \mghrulefill{\RW}\par\nobreak
495
    \CNV\FmN{\@chapapp}\space \CNoV\thechapter
496
    \par\nobreak
497
    \vskip -0.5\baselineskip
498
   }
499
  \renewcommand{\DOTI}[1]{%
500
    \mghrulefill{\RW}\par\nobreak
501
    \CTV\FmTi{#1}\par\nobreak
502
    \vskip 60\p@
503
    }
504
  \renewcommand{\DOTIS}[1]{%
505
    \mghrulefill{\RW}\par\nobreak
506
    \CTV\FmTi{#1}\par\nobreak
507
    \vskip 60\p@
508
    }
509
  }
510

    
511
%%%%%%% REJNE DEF
512

    
513
\DeclareOption{Rejne}{%
514

    
515
  \ChNameUpperCase
516
  \ChTitleUpperCase  
517
  \ChNameVar{\centering\Large\rm}
518
  \ChNumVar{\Huge}
519
  \ChTitleVar{\centering\Huge\rm}
520
  \ChRuleWidth{1pt}
521
  \renewcommand{\DOCH}{%
522
    \settoheight{\py}{\CNoV\thechapter}
523
    \parskip=0pt plus 1pt % Set parskip to default, just in case v1.31
524
    \addtolength{\py}{-1pt}
525
    \CNV\FmN{\@chapapp}\par\nobreak
526
    \vskip 20\p@
527
    \setlength{\myhi}{2\baselineskip}
528
    \setlength{\px}{\myhi}
529
    \addtolength{\px}{-1\RW}
530
    \rule[-1\px]{\RW}{\myhi}\mghrulefill{\RW}\hskip
531
    10pt\raisebox{-0.5\py}{\CNoV\thechapter}\hskip 10pt\mghrulefill{\RW}\rule[-1\px]{\RW}{\myhi}\par\nobreak
532
     \vskip -3\p@% Added -2pt vskip to correct for streched text v1.31
533
    }
534
  \renewcommand{\DOTI}[1]{%
535
    \setlength{\mylen}{\textwidth}
536
    \parskip=0pt plus 1pt % Set parskip to default, just in case v1.31
537
    \addtolength{\mylen}{-2\RW}
538
    {\vrule width\RW}\parbox{\mylen}{\CTV\FmTi{#1}}{\vrule width\RW}\par\nobreak%
539
    \vskip -3pt\rule{\RW}{2\baselineskip}\mghrulefill{\RW}\rule{\RW}{2\baselineskip}%
540
    \vskip 60\p@% Added -2pt in vskip to correct for streched text v1.31
541
    }
542
  \renewcommand{\DOTIS}[1]{%
543
    \setlength{\py}{\fboxrule}
544
    \setlength{\fboxrule}{\RW}
545
    \setlength{\mylen}{\textwidth}
546
    \addtolength{\mylen}{-2\RW}
547
    \fbox{\parbox{\mylen}{\vskip 2\baselineskip\CTV\FmTi{#1}\par\nobreak\vskip \baselineskip}} 
548
    \setlength{\fboxrule}{\py}
549
    \vskip 60\p@
550
    }
551
  }
552

    
553

    
554
%%%%%%% BJARNE DEF
555

    
556
\DeclareOption{Bjarne}{%
557
  \ChNameUpperCase
558
  \ChTitleUpperCase  
559
  \ChNameVar{\raggedleft\normalsize\rm}
560
  \ChNumVar{\raggedleft \bfseries\Large}
561
  \ChTitleVar{\raggedleft \Large\rm}
562
  \ChRuleWidth{1pt}
563

    
564

    
565
%% Note thechapter -> c@chapter fix appendix bug
566
%% Fixed misspelled 12
567

    
568
  \newcounter{AlphaCnt}
569
  \newcounter{AlphaDecCnt}
570
  \newcommand{\AlphaNo}{%
571
    \ifcase\number\theAlphaCnt
572
      \ifnum\c@chapter=0
573
        ZERO\else{}\fi
574
    \or ONE\or TWO\or THREE\or FOUR\or FIVE
575
    \or SIX\or SEVEN\or EIGHT\or NINE\or TEN
576
    \or ELEVEN\or TWELVE\or THIRTEEN\or FOURTEEN\or FIFTEEN
577
    \or SIXTEEN\or SEVENTEEN\or EIGHTEEN\or NINETEEN\fi
578
}
579

    
580
  \newcommand{\AlphaDecNo}{%
581
    \setcounter{AlphaDecCnt}{0}
582
    \@whilenum\number\theAlphaCnt>0\do
583
      {\addtocounter{AlphaCnt}{-10}
584
       \addtocounter{AlphaDecCnt}{1}}
585
     \ifnum\number\theAlphaCnt=0
586
     \else
587
       \addtocounter{AlphaDecCnt}{-1}
588
       \addtocounter{AlphaCnt}{10}
589
     \fi
590
     
591
     
592
    \ifcase\number\theAlphaDecCnt\or TEN\or TWENTY\or THIRTY\or
593
    FORTY\or FIFTY\or SIXTY\or SEVENTY\or EIGHTY\or NINETY\fi
594
    }
595
  \newcommand{\TheAlphaChapter}{%
596
    
597
    \ifinapp 
598
      \thechapter
599
    \else
600
      \setcounter{AlphaCnt}{\c@chapter}
601
      \ifnum\c@chapter<20
602
        \AlphaNo
603
      \else
604
        \AlphaDecNo\AlphaNo
605
      \fi
606
    \fi
607
    }  
608
  \renewcommand{\DOCH}{%
609
    \mghrulefill{\RW}\par\nobreak
610
    \CNV\FmN{\@chapapp}\par\nobreak 
611
    \CNoV\TheAlphaChapter\par\nobreak
612
    \vskip -1\baselineskip\vskip 5pt\mghrulefill{\RW}\par\nobreak
613
    \vskip 20\p@
614
    }
615
  \renewcommand{\DOTI}[1]{%
616
    \CTV\FmTi{#1}\par\nobreak
617
    \vskip 40\p@
618
    }
619
  \renewcommand{\DOTIS}[1]{%
620
    \CTV\FmTi{#1}\par\nobreak
621
    \vskip 40\p@
622
    }
623
}
624

    
625
\DeclareOption*{%
626
  \PackageWarning{fancychapter}{unknown style option}
627
  }
628

    
629
\ProcessOptions* \relax
630

    
631
\ifusecolor
632
  \RequirePackage{color} 
633
\fi
634
\def\@makechapterhead#1{%
635
  \vspace*{50\p@}%
636
  {\parindent \z@ \raggedright \normalfont
637
    \ifnum \c@secnumdepth >\m@ne
638
      \if@mainmatter%%%%% Fix for frontmatter, mainmatter, and backmatter 040920
639
        \DOCH
640
      \fi
641
    \fi
642
    \interlinepenalty\@M
643
    \if@mainmatter%%%%% Fix for frontmatter, mainmatter, and backmatter 060424
644
      \DOTI{#1}%
645
    \else%
646
      \DOTIS{#1}%
647
    \fi
648
  }}
649

    
650

    
651
%%% Begin: To avoid problem with scrbook.cls (fncychap version 1.32)
652

    
653
%%OUT:
654
%\def\@schapter#1{\if@twocolumn
655
%                   \@topnewpage[\@makeschapterhead{#1}]%
656
%                 \else
657
%                   \@makeschapterhead{#1}%
658
%                   \@afterheading
659
%                 \fi}
660

    
661
%%IN:
662
\def\@schapter#1{%
663
\if@twocolumn%
664
  \@makeschapterhead{#1}%
665
\else%
666
  \@makeschapterhead{#1}%
667
  \@afterheading%
668
\fi}
669

    
670
%%% End: To avoid problem with scrbook.cls (fncychap version 1.32)
671

    
672
\def\@makeschapterhead#1{%
673
  \vspace*{50\p@}%
674
  {\parindent \z@ \raggedright
675
    \normalfont
676
    \interlinepenalty\@M
677
    \DOTIS{#1}
678
    \vskip 40\p@
679
  }}
680

    
681
\endinput
682

    
683