fncychap.sty 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  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. %%% Last modified Jul. 2007
  52. \NeedsTeXFormat{LaTeX2e}[1995/12/01]
  53. \ProvidesPackage{fncychap}
  54. [2007/07/30 v1.34
  55. LaTeX package (Revised chapters)]
  56. %%%% For conditional inclusion of color
  57. \newif\ifusecolor
  58. \usecolorfalse
  59. %%%% DEFINITION OF Chapapp variables
  60. \newcommand{\CNV}{\huge\bfseries}
  61. \newcommand{\ChNameVar}[1]{\renewcommand{\CNV}{#1}}
  62. %%%% DEFINITION OF TheChapter variables
  63. \newcommand{\CNoV}{\huge\bfseries}
  64. \newcommand{\ChNumVar}[1]{\renewcommand{\CNoV}{#1}}
  65. \newif\ifUCN
  66. \UCNfalse
  67. \newif\ifLCN
  68. \LCNfalse
  69. \def\ChNameLowerCase{\LCNtrue\UCNfalse}
  70. \def\ChNameUpperCase{\UCNtrue\LCNfalse}
  71. \def\ChNameAsIs{\UCNfalse\LCNfalse}
  72. %%%%% Fix for AMSBook 971008
  73. \@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}
  74. %%%%% Fix for Bjarne and appendix 980211
  75. \newif\ifinapp
  76. \inappfalse
  77. \renewcommand\appendix{\par
  78. \setcounter{chapter}{0}%
  79. \setcounter{section}{0}%
  80. \inapptrue%
  81. \renewcommand\@chapapp{\appendixname}%
  82. \renewcommand\thechapter{\@Alph\c@chapter}}
  83. %%%%% Fix for frontmatter, mainmatter, and backmatter 040920
  84. \@ifundefined{@mainmatter}{\newif\if@mainmatter \@mainmattertrue}{}
  85. %%%%%
  86. \newcommand{\FmN}[1]{%
  87. \ifUCN
  88. {\MakeUppercase{#1}}\LCNfalse
  89. \else
  90. \ifLCN
  91. {\MakeLowercase{#1}}\UCNfalse
  92. \else #1
  93. \fi
  94. \fi}
  95. %%%% DEFINITION OF Title variables
  96. \newcommand{\CTV}{\Huge\bfseries}
  97. \newcommand{\ChTitleVar}[1]{\renewcommand{\CTV}{#1}}
  98. %%%% DEFINITION OF the basic rule width
  99. \newlength{\RW}
  100. \setlength{\RW}{1pt}
  101. \newcommand{\ChRuleWidth}[1]{\setlength{\RW}{#1}}
  102. \newif\ifUCT
  103. \UCTfalse
  104. \newif\ifLCT
  105. \LCTfalse
  106. \def\ChTitleLowerCase{\LCTtrue\UCTfalse}
  107. \def\ChTitleUpperCase{\UCTtrue\LCTfalse}
  108. \def\ChTitleAsIs{\UCTfalse\LCTfalse}
  109. \newcommand{\FmTi}[1]{%
  110. \ifUCT
  111. {\MakeUppercase{#1}}\LCTfalse
  112. \else
  113. \ifLCT
  114. {\MakeLowercase{#1}}\UCTfalse
  115. \else {#1}
  116. \fi
  117. \fi}
  118. \newlength{\mylen}
  119. \newlength{\myhi}
  120. \newlength{\px}
  121. \newlength{\py}
  122. \newlength{\pyy}
  123. \newlength{\pxx}
  124. \def\mghrulefill#1{\leavevmode\leaders\hrule\@height #1\hfill\kern\z@}
  125. \newcommand{\DOCH}{%
  126. \CNV\FmN{\@chapapp}\space \CNoV\thechapter
  127. \par\nobreak
  128. \vskip 20\p@
  129. }
  130. \newcommand{\DOTI}[1]{%
  131. \CTV\FmTi{#1}\par\nobreak
  132. \vskip 40\p@
  133. }
  134. \newcommand{\DOTIS}[1]{%
  135. \CTV\FmTi{#1}\par\nobreak
  136. \vskip 40\p@
  137. }
  138. %%%%%% SONNY DEF
  139. \DeclareOption{Sonny}{%
  140. \ChNameVar{\Large\sf\bfseries}
  141. \ChNumVar{\Huge\bfseries}
  142. \ChTitleVar{\Large\sf\bfseries}
  143. \ChRuleWidth{0.5pt}
  144. \ChNameUpperCase
  145. \renewcommand{\DOCH}{%
  146. \raggedleft
  147. \CNV\FmN{\@chapapp}\space \CNoV\thechapter
  148. \par\nobreak
  149. \vskip 40\p@}
  150. \renewcommand{\DOTI}[1]{%
  151. \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
  152. \vskip 5\p@
  153. \CTV\FmTi{#1}\par\nobreak
  154. \mghrulefill{\RW}\par\nobreak
  155. \vskip 40\p@}
  156. \renewcommand{\DOTIS}[1]{%
  157. \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
  158. \vskip 5\p@
  159. \CTV\FmTi{#1}\par\nobreak
  160. \mghrulefill{\RW}\par\nobreak
  161. \vskip 40\p@}
  162. }
  163. %%%%%% LENNY DEF
  164. \DeclareOption{Lenny}{%
  165. \ChNameVar{\fontsize{14}{16}\usefont{OT1}{phv}{m}{n}\selectfont}
  166. \ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
  167. \ChTitleVar{\Huge\bfseries\rm}
  168. \ChRuleWidth{1pt}
  169. \renewcommand{\DOCH}{%
  170. \settowidth{\px}{\CNV\FmN{\@chapapp}}
  171. \addtolength{\px}{2pt}
  172. \settoheight{\py}{\CNV\FmN{\@chapapp}}
  173. \addtolength{\py}{1pt}
  174. \settowidth{\mylen}{\CNV\FmN{\@chapapp}\space\CNoV\thechapter}
  175. \addtolength{\mylen}{1pt}
  176. \settowidth{\pxx}{\CNoV\thechapter}
  177. \addtolength{\pxx}{-1pt}
  178. \settoheight{\pyy}{\CNoV\thechapter}
  179. \addtolength{\pyy}{-2pt}
  180. \setlength{\myhi}{\pyy}
  181. \addtolength{\myhi}{-1\py}
  182. \par
  183. \parbox[b]{\textwidth}{%
  184. \rule[\py]{\RW}{\myhi}%
  185. \hskip -\RW%
  186. \rule[\pyy]{\px}{\RW}%
  187. \hskip -\px%
  188. \raggedright%
  189. \CNV\FmN{\@chapapp}\space\CNoV\thechapter%
  190. \hskip1pt%
  191. \mghrulefill{\RW}%
  192. \rule{\RW}{\pyy}\par\nobreak%
  193. \vskip -\baselineskip%
  194. \vskip -\pyy%
  195. \hskip \mylen%
  196. \mghrulefill{\RW}\par\nobreak%
  197. \vskip \pyy}%
  198. \vskip 20\p@}
  199. \renewcommand{\DOTI}[1]{%
  200. \raggedright
  201. \CTV\FmTi{#1}\par\nobreak
  202. \vskip 40\p@}
  203. \renewcommand{\DOTIS}[1]{%
  204. \raggedright
  205. \CTV\FmTi{#1}\par\nobreak
  206. \vskip 40\p@}
  207. }
  208. %%%%%% Peter Osbornes' version of LENNY DEF
  209. \DeclareOption{PetersLenny}{%
  210. % five new lengths
  211. \newlength{\bl} % bottom left : orig \space
  212. \setlength{\bl}{6pt}
  213. \newcommand{\BL}[1]{\setlength{\bl}{#1}}
  214. \newlength{\br} % bottom right : orig 1pt
  215. \setlength{\br}{1pt}
  216. \newcommand{\BR}[1]{\setlength{\br}{#1}}
  217. \newlength{\tl} % top left : orig 2pt
  218. \setlength{\tl}{2pt}
  219. \newcommand{\TL}[1]{\setlength{\tl}{#1}}
  220. \newlength{\trr} % top right :orig 1pt
  221. \setlength{\trr}{1pt}
  222. \newcommand{\TR}[1]{\setlength{\trr}{#1}}
  223. \newlength{\blrule} % top right :orig 1pt
  224. \setlength{\trr}{0pt}
  225. \newcommand{\BLrule}[1]{\setlength{\blrule}{#1}}
  226. \ChNameVar{\fontsize{14}{16}\usefont{OT1}{phv}{m}{n}\selectfont}
  227. \ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
  228. \ChTitleVar{\Huge\bfseries\rm}
  229. \ChRuleWidth{1pt}
  230. \renewcommand{\DOCH}{%
  231. %%%%%%% tweaks for 1--9 and A--Z
  232. \ifcase\c@chapter\relax%
  233. \or\BL{-3pt}\TL{-4pt}\BR{0pt}\TR{-6pt}%1
  234. \or\BL{0pt}\TL{-4pt}\BR{2pt}\TR{-4pt}%2
  235. \or\BL{0pt}\TL{-4pt}\BR{2pt}\TR{-4pt}%3
  236. \or\BL{0pt}\TL{5pt}\BR{2pt}\TR{-4pt}%4
  237. \or\BL{0pt}\TL{3pt}\BR{2pt}\TR{-4pt}%5
  238. \or\BL{-1pt}\TL{0pt}\BR{2pt}\TR{-2pt}%6
  239. \or\BL{0pt}\TL{-3pt}\BR{2pt}\TR{-2pt}%7
  240. \or\BL{0pt}\TL{-3pt}\BR{2pt}\TR{-2pt}%8
  241. \or\BL{0pt}\TL{-3pt}\BR{-4pt}\TR{-2pt}%9
  242. \or\BL{-3pt}\TL{-3pt}\BR{2pt}\TR{-7pt}%10
  243. \or\BL{-6pt}\TL{-6pt}\BR{0pt}\TR{-9pt}%11
  244. \or\BL{-6pt}\TL{-6pt}\BR{2pt}\TR{-7pt}%12
  245. \or\BL{-5pt}\TL{-5pt}\BR{0pt}\TR{-9pt}%13
  246. \or\BL{-6pt}\TL{-6pt}\BR{0pt}\TR{-9pt}%14
  247. \or\BL{-3pt}\TL{-3pt}\BR{3pt}\TR{-6pt}%15
  248. \or\BL{-3pt}\TL{-3pt}\BR{3pt}\TR{-6pt}%16
  249. \or\BL{-5pt}\TL{-3pt}\BR{-8pt}\TR{-6pt}%17
  250. \or\BL{-5pt}\TL{-5pt}\BR{0pt}\TR{-9pt}%18
  251. \or\BL{-3pt}\TL{-3pt}\BR{-6pt}\TR{-9pt}%19
  252. \or\BL{0pt}\TL{0pt}\BR{0pt}\TR{-5pt}%20
  253. \fi
  254. \ifinapp\ifcase\c@chapter\relax%
  255. \or\BL{0pt}\TL{14pt}\BR{5pt}\TR{-19pt}%A
  256. \or\BL{0pt}\TL{-5pt}\BR{-3pt}\TR{-8pt}%B
  257. \or\BL{-3pt}\TL{-2pt}\BR{1pt}\TR{-6pt}\BLrule{0pt}%C
  258. \or\BL{0pt}\TL{-5pt}\BR{-3pt}\TR{-8pt}\BLrule{0pt}%D
  259. \or\BL{0pt}\TL{-5pt}\BR{2pt}\TR{-3pt}%E
  260. \or\BL{0pt}\TL{-5pt}\BR{-10pt}\TR{-1pt}%F
  261. \or\BL{-3pt}\TL{0pt}\BR{0pt}\TR{-7pt}%G
  262. \or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%H
  263. \or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%I
  264. \or\BL{2pt}\TL{0pt}\BR{-3pt}\TR{1pt}%J
  265. \or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%K
  266. \or\BL{0pt}\TL{-5pt}\BR{2pt}\TR{-19pt}%L
  267. \or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%M
  268. \or\BL{0pt}\TL{-5pt}\BR{-2pt}\TR{-1pt}%N
  269. \or\BL{-3pt}\TL{-2pt}\BR{-3pt}\TR{-11pt}%O
  270. \or\BL{0pt}\TL{-5pt}\BR{-9pt}\TR{-3pt}%P
  271. \or\BL{-3pt}\TL{-2pt}\BR{-3pt}\TR{-11pt}%Q
  272. \or\BL{0pt}\TL{-5pt}\BR{4pt}\TR{-8pt}%R
  273. \or\BL{-2pt}\TL{-2pt}\BR{-2pt}\TR{-7pt}%S
  274. \or\BL{-3pt}\TL{0pt}\BR{-5pt}\TR{4pt}\BLrule{8pt}%T
  275. \or\BL{-7pt}\TL{-11pt}\BR{-5pt}\TR{-7pt}\BLrule{0pt}%U
  276. \or\BL{-14pt}\TL{-5pt}\BR{-14pt}\TR{-1pt}\BLrule{14pt}%V
  277. \or\BL{-10pt}\TL{-9pt}\BR{-13pt}\TR{-3pt}\BLrule{7pt}%W
  278. \or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}\BLrule{0pt}%X
  279. \or\BL{-6pt}\TL{-4pt}\BR{-7pt}\TR{1pt}\BLrule{7pt}%Y
  280. \or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}\BLrule{0pt}%Z
  281. \fi\fi
  282. %%%%%%%
  283. \settowidth{\px}{\CNV\FmN{\@chapapp}}
  284. \addtolength{\px}{\tl} %MOD change 2pt to \tl
  285. \settoheight{\py}{\CNV\FmN{\@chapapp}}
  286. \addtolength{\py}{1pt}
  287. \settowidth{\mylen}{\CNV\FmN{\@chapapp}\space\CNoV\thechapter}
  288. \addtolength{\mylen}{\trr}% MOD change 1pt to \tr
  289. \settowidth{\pxx}{\CNoV\thechapter}
  290. \addtolength{\pxx}{-1pt}
  291. \settoheight{\pyy}{\CNoV\thechapter}
  292. \addtolength{\pyy}{-2pt}
  293. \setlength{\myhi}{\pyy}
  294. \addtolength{\myhi}{-1\py}
  295. \par
  296. \parbox[b]{\textwidth}{%
  297. \rule[\py]{\RW}{\myhi}%
  298. \hskip -\RW%
  299. \rule[\pyy]{\px}{\RW}%
  300. \hskip -\px%
  301. \raggedright%
  302. \CNV\FmN{\@chapapp}\rule{\blrule}{\RW}\hskip\bl\CNoV\thechapter%MOD
  303. % \CNV\FmN{\@chapapp}\space\CNoV\thechapter %ORIGINAL
  304. \hskip\br% %MOD 1pt to \br
  305. \mghrulefill{\RW}%
  306. \rule{\RW}{\pyy}\par\nobreak%
  307. \vskip -\baselineskip%
  308. \vskip -\pyy%
  309. \hskip \mylen%
  310. \mghrulefill{\RW}\par\nobreak%
  311. \vskip \pyy}%
  312. \vskip 20\p@}
  313. \renewcommand{\DOTI}[1]{%
  314. \raggedright
  315. \CTV\FmTi{#1}\par\nobreak
  316. \vskip 40\p@}
  317. \renewcommand{\DOTIS}[1]{%
  318. \raggedright
  319. \CTV\FmTi{#1}\par\nobreak
  320. \vskip 40\p@}
  321. }
  322. %
  323. %%%%%% BJORNSTRUP DEF
  324. \DeclareOption{Bjornstrup}{%
  325. \usecolortrue
  326. % pzc (Zapf Chancelery) is nice. ppl (Palatino) is cool too.
  327. \ChNumVar{\fontsize{76}{80}\usefont{OT1}{pzc}{m}{n}\selectfont}
  328. \ChTitleVar{\raggedleft\Large\sffamily\bfseries}
  329. \setlength{\myhi}{10pt} % Space between grey box border and text
  330. \setlength{\mylen}{\textwidth}
  331. \addtolength{\mylen}{-2\myhi}
  332. \renewcommand{\DOCH}{%
  333. \settowidth{\py}{\CNoV\thechapter}
  334. \addtolength{\py}{-10pt} % Amount of space by which the
  335. % % number is shifted right
  336. \fboxsep=0pt%
  337. \colorbox[gray]{.85}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}%
  338. \kern-\py\raise20pt%
  339. \hbox{\color[gray]{.5}\CNoV\thechapter}\\%
  340. }
  341. \renewcommand{\DOTI}[1]{%
  342. \nointerlineskip\raggedright%
  343. \fboxsep=\myhi%
  344. \vskip-1ex%
  345. \colorbox[gray]{.85}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak%
  346. \vskip 40\p@%
  347. }
  348. \renewcommand{\DOTIS}[1]{%
  349. \fboxsep=0pt
  350. \colorbox[gray]{.85}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}\\%
  351. \nointerlineskip\raggedright%
  352. \fboxsep=\myhi%
  353. \colorbox[gray]{.85}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak%
  354. \vskip 40\p@%
  355. }
  356. }
  357. %%%%%%% GLENN DEF
  358. \DeclareOption{Glenn}{%
  359. \ChNameVar{\bfseries\Large\sf}
  360. \ChNumVar{\Huge}
  361. \ChTitleVar{\bfseries\Large\rm}
  362. \ChRuleWidth{1pt}
  363. \ChNameUpperCase
  364. \ChTitleUpperCase
  365. \renewcommand{\DOCH}{%
  366. \settoheight{\myhi}{\CTV\FmTi{Test}}
  367. \setlength{\py}{\baselineskip}
  368. \addtolength{\py}{\RW}
  369. \addtolength{\py}{\myhi}
  370. \setlength{\pyy}{\py}
  371. \addtolength{\pyy}{-1\RW}
  372. \raggedright
  373. \CNV\FmN{\@chapapp}\space\CNoV\thechapter
  374. \hskip 3pt\mghrulefill{\RW}\rule[-1\pyy]{2\RW}{\py}\par\nobreak}
  375. \renewcommand{\DOTI}[1]{%
  376. \addtolength{\pyy}{-4pt}
  377. \settoheight{\myhi}{\CTV\FmTi{#1}}
  378. \addtolength{\myhi}{\py}
  379. \addtolength{\myhi}{-1\RW}
  380. \vskip -1\pyy
  381. \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
  382. \raggedleft\CTV\FmTi{#1}\par\nobreak
  383. \vskip 80\p@}
  384. \newlength{\backskip}
  385. \renewcommand{\DOTIS}[1]{%
  386. % \setlength{\py}{10pt}
  387. % \setlength{\pyy}{\py}
  388. % \addtolength{\pyy}{\RW}
  389. % \setlength{\myhi}{\baselineskip}
  390. % \addtolength{\myhi}{\pyy}
  391. % \mghrulefill{\RW}\rule[-1\py]{2\RW}{\pyy}\par\nobreak
  392. % \addtolength{}{}
  393. %\vskip -1\baselineskip
  394. % \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
  395. % \raggedleft\CTV\FmTi{#1}\par\nobreak
  396. % \vskip 60\p@}
  397. %% Fix suggested by Tomas Lundberg
  398. \setlength{\py}{25pt} % eller vad man vill
  399. \setlength{\pyy}{\py}
  400. \setlength{\backskip}{\py}
  401. \addtolength{\backskip}{2pt}
  402. \addtolength{\pyy}{\RW}
  403. \setlength{\myhi}{\baselineskip}
  404. \addtolength{\myhi}{\pyy}
  405. \mghrulefill{\RW}\rule[-1\py]{2\RW}{\pyy}\par\nobreak
  406. \vskip -1\backskip
  407. \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 3pt %
  408. \raggedleft\CTV\FmTi{#1}\par\nobreak
  409. \vskip 40\p@}
  410. }
  411. %%%%%%% CONNY DEF
  412. \DeclareOption{Conny}{%
  413. \ChNameUpperCase
  414. \ChTitleUpperCase
  415. \ChNameVar{\centering\Huge\rm\bfseries}
  416. \ChNumVar{\Huge}
  417. \ChTitleVar{\centering\Huge\rm}
  418. \ChRuleWidth{2pt}
  419. \renewcommand{\DOCH}{%
  420. \mghrulefill{3\RW}\par\nobreak
  421. \vskip -0.5\baselineskip
  422. \mghrulefill{\RW}\par\nobreak
  423. \CNV\FmN{\@chapapp}\space \CNoV\thechapter
  424. \par\nobreak
  425. \vskip -0.5\baselineskip
  426. }
  427. \renewcommand{\DOTI}[1]{%
  428. \mghrulefill{\RW}\par\nobreak
  429. \CTV\FmTi{#1}\par\nobreak
  430. \vskip 60\p@
  431. }
  432. \renewcommand{\DOTIS}[1]{%
  433. \mghrulefill{\RW}\par\nobreak
  434. \CTV\FmTi{#1}\par\nobreak
  435. \vskip 60\p@
  436. }
  437. }
  438. %%%%%%% REJNE DEF
  439. \DeclareOption{Rejne}{%
  440. \ChNameUpperCase
  441. \ChTitleUpperCase
  442. \ChNameVar{\centering\Large\rm}
  443. \ChNumVar{\Huge}
  444. \ChTitleVar{\centering\Huge\rm}
  445. \ChRuleWidth{1pt}
  446. \renewcommand{\DOCH}{%
  447. \settoheight{\py}{\CNoV\thechapter}
  448. \parskip=0pt plus 1pt % Set parskip to default, just in case v1.31
  449. \addtolength{\py}{-1pt}
  450. \CNV\FmN{\@chapapp}\par\nobreak
  451. \vskip 20\p@
  452. \setlength{\myhi}{2\baselineskip}
  453. \setlength{\px}{\myhi}
  454. \addtolength{\px}{-1\RW}
  455. \rule[-1\px]{\RW}{\myhi}\mghrulefill{\RW}\hskip
  456. 10pt\raisebox{-0.5\py}{\CNoV\thechapter}\hskip 10pt\mghrulefill{\RW}\rule[-1\px]{\RW}{\myhi}\par\nobreak
  457. \vskip -3\p@% Added -2pt vskip to correct for streched text v1.31
  458. }
  459. \renewcommand{\DOTI}[1]{%
  460. \setlength{\mylen}{\textwidth}
  461. \parskip=0pt plus 1pt % Set parskip to default, just in case v1.31
  462. \addtolength{\mylen}{-2\RW}
  463. {\vrule width\RW}\parbox{\mylen}{\CTV\FmTi{#1}}{\vrule width\RW}\par\nobreak%
  464. \vskip -3pt\rule{\RW}{2\baselineskip}\mghrulefill{\RW}\rule{\RW}{2\baselineskip}%
  465. \vskip 60\p@% Added -2pt in vskip to correct for streched text v1.31
  466. }
  467. \renewcommand{\DOTIS}[1]{%
  468. \setlength{\py}{\fboxrule}
  469. \setlength{\fboxrule}{\RW}
  470. \setlength{\mylen}{\textwidth}
  471. \addtolength{\mylen}{-2\RW}
  472. \fbox{\parbox{\mylen}{\vskip 2\baselineskip\CTV\FmTi{#1}\par\nobreak\vskip \baselineskip}}
  473. \setlength{\fboxrule}{\py}
  474. \vskip 60\p@
  475. }
  476. }
  477. %%%%%%% BJARNE DEF
  478. \DeclareOption{Bjarne}{%
  479. \ChNameUpperCase
  480. \ChTitleUpperCase
  481. \ChNameVar{\raggedleft\normalsize\rm}
  482. \ChNumVar{\raggedleft \bfseries\Large}
  483. \ChTitleVar{\raggedleft \Large\rm}
  484. \ChRuleWidth{1pt}
  485. %% Note thechapter -> c@chapter fix appendix bug
  486. %% Fixed misspelled 12
  487. \newcounter{AlphaCnt}
  488. \newcounter{AlphaDecCnt}
  489. \newcommand{\AlphaNo}{%
  490. \ifcase\number\theAlphaCnt
  491. \ifnum\c@chapter=0
  492. ZERO\else{}\fi
  493. \or ONE\or TWO\or THREE\or FOUR\or FIVE
  494. \or SIX\or SEVEN\or EIGHT\or NINE\or TEN
  495. \or ELEVEN\or TWELVE\or THIRTEEN\or FOURTEEN\or FIFTEEN
  496. \or SIXTEEN\or SEVENTEEN\or EIGHTEEN\or NINETEEN\fi
  497. }
  498. \newcommand{\AlphaDecNo}{%
  499. \setcounter{AlphaDecCnt}{0}
  500. \@whilenum\number\theAlphaCnt>0\do
  501. {\addtocounter{AlphaCnt}{-10}
  502. \addtocounter{AlphaDecCnt}{1}}
  503. \ifnum\number\theAlphaCnt=0
  504. \else
  505. \addtocounter{AlphaDecCnt}{-1}
  506. \addtocounter{AlphaCnt}{10}
  507. \fi
  508. \ifcase\number\theAlphaDecCnt\or TEN\or TWENTY\or THIRTY\or
  509. FORTY\or FIFTY\or SIXTY\or SEVENTY\or EIGHTY\or NINETY\fi
  510. }
  511. \newcommand{\TheAlphaChapter}{%
  512. \ifinapp
  513. \thechapter
  514. \else
  515. \setcounter{AlphaCnt}{\c@chapter}
  516. \ifnum\c@chapter<20
  517. \AlphaNo
  518. \else
  519. \AlphaDecNo\AlphaNo
  520. \fi
  521. \fi
  522. }
  523. \renewcommand{\DOCH}{%
  524. \mghrulefill{\RW}\par\nobreak
  525. \CNV\FmN{\@chapapp}\par\nobreak
  526. \CNoV\TheAlphaChapter\par\nobreak
  527. \vskip -1\baselineskip\vskip 5pt\mghrulefill{\RW}\par\nobreak
  528. \vskip 20\p@
  529. }
  530. \renewcommand{\DOTI}[1]{%
  531. \CTV\FmTi{#1}\par\nobreak
  532. \vskip 40\p@
  533. }
  534. \renewcommand{\DOTIS}[1]{%
  535. \CTV\FmTi{#1}\par\nobreak
  536. \vskip 40\p@
  537. }
  538. }
  539. \DeclareOption*{%
  540. \PackageWarning{fancychapter}{unknown style option}
  541. }
  542. \ProcessOptions* \relax
  543. \ifusecolor
  544. \RequirePackage{color}
  545. \fi
  546. \def\@makechapterhead#1{%
  547. \vspace*{50\p@}%
  548. {\parindent \z@ \raggedright \normalfont
  549. \ifnum \c@secnumdepth >\m@ne
  550. \if@mainmatter%%%%% Fix for frontmatter, mainmatter, and backmatter 040920
  551. \DOCH
  552. \fi
  553. \fi
  554. \interlinepenalty\@M
  555. \if@mainmatter%%%%% Fix for frontmatter, mainmatter, and backmatter 060424
  556. \DOTI{#1}%
  557. \else%
  558. \DOTIS{#1}%
  559. \fi
  560. }}
  561. %%% Begin: To avoid problem with scrbook.cls (fncychap version 1.32)
  562. %%OUT:
  563. %\def\@schapter#1{\if@twocolumn
  564. % \@topnewpage[\@makeschapterhead{#1}]%
  565. % \else
  566. % \@makeschapterhead{#1}%
  567. % \@afterheading
  568. % \fi}
  569. %%IN:
  570. \def\@schapter#1{%
  571. \if@twocolumn%
  572. \@makeschapterhead{#1}%
  573. \else%
  574. \@makeschapterhead{#1}%
  575. \@afterheading%
  576. \fi}
  577. %%% End: To avoid problem with scrbook.cls (fncychap version 1.32)
  578. \def\@makeschapterhead#1{%
  579. \vspace*{50\p@}%
  580. {\parindent \z@ \raggedright
  581. \normalfont
  582. \interlinepenalty\@M
  583. \DOTIS{#1}
  584. \vskip 40\p@
  585. }}
  586. \endinput