Projet

Général

Profil

Télécharger (12,1 ko) Statistiques
| Branche: | Révision:

root / larpe / tags / release-1.1.1 / doc / en / fncychap.sty @ d03cb81c

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

    
42

    
43
%%% Last modified   Aug. 9th 2005
44

    
45
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
46
\ProvidesPackage{fncychap}
47
             [2004/09/21 v1.33
48
                 LaTeX package (Revised chapters)]
49

    
50
%%%% DEFINITION OF Chapapp variables
51
\newcommand{\CNV}{\huge\bfseries}
52
\newcommand{\ChNameVar}[1]{\renewcommand{\CNV}{#1}}
53

    
54

    
55
%%%% DEFINITION OF TheChapter variables
56
\newcommand{\CNoV}{\huge\bfseries}
57
\newcommand{\ChNumVar}[1]{\renewcommand{\CNoV}{#1}}
58

    
59
\newif\ifUCN
60
\UCNfalse
61
\newif\ifLCN
62
\LCNfalse
63
\def\ChNameLowerCase{\LCNtrue\UCNfalse}
64
\def\ChNameUpperCase{\UCNtrue\LCNfalse}
65
\def\ChNameAsIs{\UCNfalse\LCNfalse}
66

    
67
%%%%% Fix for AMSBook 971008
68

    
69
\@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}
70

    
71

    
72
%%%%% Fix for Bjarne and appendix 980211
73

    
74
\newif\ifinapp
75
\inappfalse
76
\renewcommand\appendix{\par
77
  \setcounter{chapter}{0}%
78
  \setcounter{section}{0}%
79
  \inapptrue%
80
  \renewcommand\@chapapp{\appendixname}%
81
  \renewcommand\thechapter{\@Alph\c@chapter}}
82

    
83
%%%%% Fix for frontmatter, mainmatter, and backmatter 040920
84

    
85
\@ifundefined{@mainmatter}{\newif\if@mainmatter \@mainmattertrue}{}
86

    
87
%%%%%
88

    
89

    
90

    
91
\newcommand{\FmN}[1]{%
92
\ifUCN
93
   {\MakeUppercase#1}\LCNfalse
94
\else
95
   \ifLCN
96
      {\MakeLowercase#1}\UCNfalse
97
   \else #1
98
   \fi
99
\fi}
100

    
101

    
102
%%%% DEFINITION OF Title variables
103
\newcommand{\CTV}{\Huge\bfseries}
104
\newcommand{\ChTitleVar}[1]{\renewcommand{\CTV}{#1}}
105

    
106
%%%% DEFINITION OF the basic rule width
107
\newlength{\RW}
108
\setlength{\RW}{1pt}
109
\newcommand{\ChRuleWidth}[1]{\setlength{\RW}{#1}}
110

    
111
\newif\ifUCT
112
\UCTfalse
113
\newif\ifLCT
114
\LCTfalse
115
\def\ChTitleLowerCase{\LCTtrue\UCTfalse}
116
\def\ChTitleUpperCase{\UCTtrue\LCTfalse}
117
\def\ChTitleAsIs{\UCTfalse\LCTfalse}
118
\newcommand{\FmTi}[1]{%
119
\ifUCT
120
   {\MakeUppercase#1}\LCTfalse
121
\else
122
   \ifLCT
123
      {\MakeLowercase#1}\UCTfalse
124
   \else {#1}
125
   \fi
126
\fi}
127

    
128

    
129

    
130
\newlength{\mylen}
131
\newlength{\myhi}
132
\newlength{\px}
133
\newlength{\py}
134
\newlength{\pyy}
135
\newlength{\pxx}
136

    
137

    
138
\def\mghrulefill#1{\leavevmode\leaders\hrule\@height #1\hfill\kern\z@}
139

    
140
\newcommand{\DOCH}{%
141
  \CNV\FmN{\@chapapp}\space \CNoV\thechapter
142
  \par\nobreak
143
  \vskip 20\p@
144
  }
145
\newcommand{\DOTI}[1]{%
146
    \CTV\FmTi{#1}\par\nobreak
147
    \vskip 40\p@
148
    }
149
\newcommand{\DOTIS}[1]{%
150
    \CTV\FmTi{#1}\par\nobreak
151
    \vskip 40\p@
152
    }
153

    
154
%%%%%% SONNY DEF
155

    
156
\DeclareOption{Sonny}{%
157
  \ChNameVar{\Large\sf}
158
  \ChNumVar{\Huge}
159
  \ChTitleVar{\Large\sf}
160
  \ChRuleWidth{0.5pt}
161
  \ChNameUpperCase
162
  \renewcommand{\DOCH}{%
163
    \raggedleft
164
    \CNV\FmN{\@chapapp}\space \CNoV\thechapter
165
    \par\nobreak
166
    \vskip 40\p@}
167
  \renewcommand{\DOTI}[1]{%
168
    \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
169
    \vskip 5\p@
170
    \CTV\FmTi{#1}\par\nobreak
171
    \mghrulefill{\RW}\par\nobreak
172
    \vskip 40\p@}
173
  \renewcommand{\DOTIS}[1]{%
174
    \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
175
    \vskip 5\p@
176
    \CTV\FmTi{#1}\par\nobreak
177
    \mghrulefill{\RW}\par\nobreak
178
    \vskip 40\p@}
179
}
180

    
181
%%%%%% LENNY DEF
182

    
183
\DeclareOption{Lenny}{%
184

    
185
  \ChNameVar{\fontsize{14}{16}\usefont{OT1}{phv}{m}{n}\selectfont}
186
  \ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
187
  \ChTitleVar{\Huge\bfseries\rm}
188
  \ChRuleWidth{1pt}
189
  \renewcommand{\DOCH}{%
190
    \settowidth{\px}{\CNV\FmN{\@chapapp}}
191
    \addtolength{\px}{2pt}
192
    \settoheight{\py}{\CNV\FmN{\@chapapp}}
193
    \addtolength{\py}{1pt}
194

    
195
    \settowidth{\mylen}{\CNV\FmN{\@chapapp}\space\CNoV\thechapter}
196
    \addtolength{\mylen}{1pt}
197
    \settowidth{\pxx}{\CNoV\thechapter}
198
    \addtolength{\pxx}{-1pt}
199

    
200
    \settoheight{\pyy}{\CNoV\thechapter}
201
    \addtolength{\pyy}{-2pt}
202
    \setlength{\myhi}{\pyy}
203
    \addtolength{\myhi}{-1\py}
204
    \par
205
    \parbox[b]{\textwidth}{%
206
    \rule[\py]{\RW}{\myhi}%
207
    \hskip -\RW%
208
    \rule[\pyy]{\px}{\RW}%
209
    \hskip -\px%
210
    \raggedright%
211
    \CNV\FmN{\@chapapp}\space\CNoV\thechapter%
212
    \hskip1pt%
213
    \mghrulefill{\RW}%
214
    \rule{\RW}{\pyy}\par\nobreak%
215
    \vskip -\baselineskip%
216
    \vskip -\pyy%
217
    \hskip \mylen%
218
    \mghrulefill{\RW}\par\nobreak%
219
    \vskip \pyy}%
220
    \vskip 20\p@}
221
 
222

    
223
  \renewcommand{\DOTI}[1]{%
224
    \raggedright
225
    \CTV\FmTi{#1}\par\nobreak
226
    \vskip 40\p@}
227

    
228
  \renewcommand{\DOTIS}[1]{%
229
    \raggedright
230
    \CTV\FmTi{#1}\par\nobreak
231
    \vskip 40\p@}
232
 }
233

    
234

    
235
%%%%%%% GLENN DEF
236

    
237

    
238
\DeclareOption{Glenn}{%
239
  \ChNameVar{\bfseries\Large\sf}
240
  \ChNumVar{\Huge}
241
  \ChTitleVar{\bfseries\Large\rm}
242
  \ChRuleWidth{1pt}
243
  \ChNameUpperCase
244
  \ChTitleUpperCase
245
  \renewcommand{\DOCH}{%
246
    \settoheight{\myhi}{\CTV\FmTi{Test}}
247
    \setlength{\py}{\baselineskip}
248
    \addtolength{\py}{\RW}
249
    \addtolength{\py}{\myhi}
250
    \setlength{\pyy}{\py}
251
    \addtolength{\pyy}{-1\RW}
252
     
253
    \raggedright
254
    \CNV\FmN{\@chapapp}\space\CNoV\thechapter
255
    \hskip 3pt\mghrulefill{\RW}\rule[-1\pyy]{2\RW}{\py}\par\nobreak}
256

    
257
  \renewcommand{\DOTI}[1]{%
258
    \addtolength{\pyy}{-4pt}
259
    \settoheight{\myhi}{\CTV\FmTi{#1}}
260
    \addtolength{\myhi}{\py}
261
    \addtolength{\myhi}{-1\RW}
262
    \vskip -1\pyy
263
    \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
264
    \raggedleft\CTV\FmTi{#1}\par\nobreak
265
    \vskip 80\p@}
266

    
267
\newlength{\backskip}
268
  \renewcommand{\DOTIS}[1]{%
269
%    \setlength{\py}{10pt}
270
%    \setlength{\pyy}{\py}
271
%    \addtolength{\pyy}{\RW}
272
%    \setlength{\myhi}{\baselineskip}
273
%    \addtolength{\myhi}{\pyy}
274
%    \mghrulefill{\RW}\rule[-1\py]{2\RW}{\pyy}\par\nobreak
275
%    \addtolength{}{}
276
%\vskip -1\baselineskip
277
%    \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
278
%    \raggedleft\CTV\FmTi{#1}\par\nobreak
279
%    \vskip 60\p@}
280
%% Fix suggested by Tomas Lundberg
281
    \setlength{\py}{25pt}  % eller vad man vill
282
    \setlength{\pyy}{\py}
283
    \setlength{\backskip}{\py}
284
    \addtolength{\backskip}{2pt}
285
    \addtolength{\pyy}{\RW}
286
    \setlength{\myhi}{\baselineskip}
287
    \addtolength{\myhi}{\pyy}
288
    \mghrulefill{\RW}\rule[-1\py]{2\RW}{\pyy}\par\nobreak
289
    \vskip -1\backskip
290
    \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 3pt %
291
    \raggedleft\CTV\FmTi{#1}\par\nobreak
292
    \vskip 40\p@}
293
 }
294

    
295
%%%%%%% CONNY DEF
296

    
297
\DeclareOption{Conny}{%
298
  \ChNameUpperCase
299
  \ChTitleUpperCase  
300
  \ChNameVar{\centering\Huge\rm\bfseries}
301
  \ChNumVar{\Huge}
302
  \ChTitleVar{\centering\Huge\rm}
303
  \ChRuleWidth{2pt}
304

    
305
  \renewcommand{\DOCH}{%
306
    \mghrulefill{3\RW}\par\nobreak
307
    \vskip -0.5\baselineskip
308
    \mghrulefill{\RW}\par\nobreak
309
    \CNV\FmN{\@chapapp}\space \CNoV\thechapter
310
    \par\nobreak
311
    \vskip -0.5\baselineskip
312
   }
313
  \renewcommand{\DOTI}[1]{%
314
    \mghrulefill{\RW}\par\nobreak
315
    \CTV\FmTi{#1}\par\nobreak
316
    \vskip 60\p@
317
    }
318
  \renewcommand{\DOTIS}[1]{%
319
    \mghrulefill{\RW}\par\nobreak
320
    \CTV\FmTi{#1}\par\nobreak
321
    \vskip 60\p@
322
    }
323
  }
324

    
325
%%%%%%% REJNE DEF
326

    
327
\DeclareOption{Rejne}{%
328

    
329
  \ChNameUpperCase
330
  \ChTitleUpperCase  
331
  \ChNameVar{\centering\Large\rm}
332
  \ChNumVar{\Huge}
333
  \ChTitleVar{\centering\Huge\rm}
334
  \ChRuleWidth{1pt}
335
  \renewcommand{\DOCH}{%
336
    \settoheight{\py}{\CNoV\thechapter}
337
    \parskip=0pt plus 1pt % Set parskip to default, just in case v1.31
338
    \addtolength{\py}{-1pt}
339
    \CNV\FmN{\@chapapp}\par\nobreak
340
    \vskip 20\p@
341
    \setlength{\myhi}{2\baselineskip}
342
    \setlength{\px}{\myhi}
343
    \addtolength{\px}{-1\RW}
344
    \rule[-1\px]{\RW}{\myhi}\mghrulefill{\RW}\hskip
345
    10pt\raisebox{-0.5\py}{\CNoV\thechapter}\hskip 10pt\mghrulefill{\RW}\rule[-1\px]{\RW}{\myhi}\par\nobreak
346
     \vskip -3\p@% Added -2pt vskip to correct for streched text v1.31
347
    }
348
  \renewcommand{\DOTI}[1]{%
349
    \setlength{\mylen}{\textwidth}
350
    \parskip=0pt plus 1pt % Set parskip to default, just in case v1.31
351
    \addtolength{\mylen}{-2\RW}
352
    {\vrule width\RW}\parbox{\mylen}{\CTV\FmTi{#1}}{\vrule width\RW}\par\nobreak%
353
    \vskip -3pt\rule{\RW}{2\baselineskip}\mghrulefill{\RW}\rule{\RW}{2\baselineskip}%
354
    \vskip 60\p@% Added -2pt in vskip to correct for streched text v1.31
355
    }
356
  \renewcommand{\DOTIS}[1]{%
357
    \setlength{\py}{\fboxrule}
358
    \setlength{\fboxrule}{\RW}
359
    \setlength{\mylen}{\textwidth}
360
    \addtolength{\mylen}{-2\RW}
361
    \fbox{\parbox{\mylen}{\vskip 2\baselineskip\CTV\FmTi{#1}\par\nobreak\vskip \baselineskip}} 
362
    \setlength{\fboxrule}{\py}
363
    \vskip 60\p@
364
    }
365
  }
366

    
367

    
368
%%%%%%% BJARNE DEF
369

    
370
\DeclareOption{Bjarne}{%
371
  \ChNameUpperCase
372
  \ChTitleUpperCase  
373
  \ChNameVar{\raggedleft\normalsize\rm}
374
  \ChNumVar{\raggedleft \bfseries\Large}
375
  \ChTitleVar{\raggedleft \Large\rm}
376
  \ChRuleWidth{1pt}
377

    
378

    
379
%% Note thechapter -> c@chapter fix appendix bug
380
%% Fixed misspelled 12
381

    
382
  \newcounter{AlphaCnt}
383
  \newcounter{AlphaDecCnt}
384
  \newcommand{\AlphaNo}{%
385
    \ifcase\number\theAlphaCnt
386
      \ifnum\c@chapter=0
387
        ZERO\else{}\fi
388
    \or ONE\or TWO\or THREE\or FOUR\or FIVE
389
    \or SIX\or SEVEN\or EIGHT\or NINE\or TEN
390
    \or ELEVEN\or TWELVE\or THIRTEEN\or FOURTEEN\or FIFTEEN
391
    \or SIXTEEN\or SEVENTEEN\or EIGHTEEN\or NINETEEN\fi
392
}
393

    
394
  \newcommand{\AlphaDecNo}{%
395
    \setcounter{AlphaDecCnt}{0}
396
    \@whilenum\number\theAlphaCnt>0\do
397
      {\addtocounter{AlphaCnt}{-10}
398
       \addtocounter{AlphaDecCnt}{1}}
399
     \ifnum\number\theAlphaCnt=0
400
     \else
401
       \addtocounter{AlphaDecCnt}{-1}
402
       \addtocounter{AlphaCnt}{10}
403
     \fi
404
     
405
     
406
    \ifcase\number\theAlphaDecCnt\or TEN\or TWENTY\or THIRTY\or
407
    FORTY\or FIFTY\or SIXTY\or SEVENTY\or EIGHTY\or NINETY\fi
408
    }
409
  \newcommand{\TheAlphaChapter}{%
410
    
411
    \ifinapp 
412
      \thechapter
413
    \else
414
      \setcounter{AlphaCnt}{\c@chapter}
415
      \ifnum\c@chapter<20
416
        \AlphaNo
417
      \else
418
        \AlphaDecNo\AlphaNo
419
      \fi
420
    \fi
421
    }  
422
  \renewcommand{\DOCH}{%
423
    \mghrulefill{\RW}\par\nobreak
424
    \CNV\FmN{\@chapapp}\par\nobreak 
425
    \CNoV\TheAlphaChapter\par\nobreak
426
    \vskip -1\baselineskip\vskip 5pt\mghrulefill{\RW}\par\nobreak
427
    \vskip 20\p@
428
    }
429
  \renewcommand{\DOTI}[1]{%
430
    \CTV\FmTi{#1}\par\nobreak
431
    \vskip 40\p@
432
    }
433
  \renewcommand{\DOTIS}[1]{%
434
    \CTV\FmTi{#1}\par\nobreak
435
    \vskip 40\p@
436
    }
437
}
438

    
439
\DeclareOption*{%
440
  \PackageWarning{fancychapter}{unknown style option}
441
  }
442

    
443
\ProcessOptions* \relax
444

    
445
\def\@makechapterhead#1{%
446
  \vspace*{50\p@}%
447
  {\parindent \z@ \raggedright \normalfont
448
    \ifnum \c@secnumdepth >\m@ne
449
      \if@mainmatter%%%%% Fix for frontmatter, mainmatter, and backmatter 040920
450
        \DOCH
451
      \fi
452
    \fi
453
    \interlinepenalty\@M
454
    \DOTI{#1}
455
  }}
456

    
457

    
458
%%% Begin: To avoid problem with scrbook.cls (fncychap version 1.32)
459

    
460
%%OUT:
461
%\def\@schapter#1{\if@twocolumn
462
%                   \@topnewpage[\@makeschapterhead{#1}]%
463
%                 \else
464
%                   \@makeschapterhead{#1}%
465
%                   \@afterheading
466
%                 \fi}
467

    
468
%%IN:
469
\def\@schapter#1{%
470
\if@twocolumn%
471
  \@makeschapterhead{#1}%
472
\else%
473
  \@makeschapterhead{#1}%
474
  \@afterheading%
475
\fi}
476

    
477
%%% End: To avoid problem with scrbook.cls (fncychap version 1.32)
478

    
479
\def\@makeschapterhead#1{%
480
  \vspace*{50\p@}%
481
  {\parindent \z@ \raggedright
482
    \normalfont
483
    \interlinepenalty\@M
484
    \DOTIS{#1}
485
    \vskip 40\p@
486
  }}
487

    
488
\endinput
489

    
490

    
(4-4/5)