rtthesis.cls 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098
  1. \ProvidesClass{rtthesis}[2011/12/05 rtthesis Class v. 0.51]
  2. \NeedsTeXFormat{LaTeX2e}
  3. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  4. %%%%%%%%%%%%%%%%%%%%%%%% Class history %%%%%%%%%%%%%%%%%%%%%%%%
  5. % Date Version Comment
  6. % --------------------------------------------------------------
  7. % 2011-12-05 0.51 Bugfix release.
  8. % Last version tagged by Henrik Tidefelt.
  9. %
  10. % 2011-07-03 0.5 Support for Master's theses based on
  11. % Gustaf Hendeby's liuthesis class.
  12. % Some changes to thesis setup.
  13. %
  14. % 2010-05-21 0.41 Minor changes.
  15. %
  16. % 2010-03-24 0.4 Bugfixes and better looks.
  17. % Some changes to thesis setup.
  18. %
  19. % 2009-12-04 0.3 Supporting compilation theses.
  20. %
  21. % 2009-11-27 0.2 Introducing hyperref support and a lot
  22. % more.
  23. % Reworked example environment.
  24. % Example thesis now contains rtthesis
  25. % documentation
  26. %
  27. % 2009-11-17 0.1 Introducing the version history.
  28. % Redefined crop marks.
  29. % UTF-8 compatibility.
  30. %
  31. % 2005-07-17 0.02a Version tagged by Gustaf Hendeby
  32. %
  33. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  34. %%%%%%%%%%%%%%%%%%%%%%%%
  35. %%% USER INTERFACE %%%
  36. %%%%%%%%%%%%%%%%%%%%%%%%
  37. \RequirePackage{keyval}
  38. %%% Title
  39. \define@key{rtthesis}{title}{%
  40. \def\eng@title{#1}%
  41. \let\@title\eng@title%
  42. }
  43. \def\eng@title{\emph{Title in English}}
  44. \let\@title\eng@title
  45. %%% Subtitle
  46. \define@key{rtthesis}{subtitle}{%
  47. \def\eng@subtitle{#1}%
  48. \let\@subtitle\eng@subtitle%
  49. \rteng@subtitletrue%
  50. \let\ifrt@subtitle\ifrteng@subtitle%
  51. }
  52. \def\eng@subtitle{}
  53. \let\@subtitle\eng@subtitle
  54. \newif\ifrteng@subtitle\rteng@subtitlefalse
  55. \let\ifrt@subtitle\ifrteng@subtitle
  56. %%% Title - subtitle separator
  57. \define@key{rtthesis}{subtitlesep}{\gdef\@subtitlesep{#1}}
  58. \def\@subtitlesep{:\enspace}
  59. %%% Year
  60. \define@key{rtthesis}{year}{\def\thesis@year{#1}}
  61. %%% Month
  62. \define@key{rtthesis}{month}{\def\thesis@month{#1}}
  63. %%% Day of month
  64. \define@key{rtthesis}{day}{\def\thesis@day{#1}}
  65. \def\thesis@day{\@latex@warning@no@line{No day-of-month given}}
  66. %%% Author
  67. \define@key{rtthesis}{author}{\def\@author{#1}}
  68. %%% Thesis type. Must be one of "phd", "lic", "msc", or left blank. If present, consistency with the corresponding class option is checked.
  69. \define@key{rtthesis}{type}{\def\thesis@type{#1}}
  70. \def\thesis@type{}
  71. %%% Thesis Number.
  72. \define@key{rtthesis}{thesisNo}{\def\thesisn@{#1}}
  73. %%% ISBN for lic and phd mode
  74. \define@key{rtthesis}{isbn}{\def\@isbn{#1}}
  75. %%% ISRN for msc mode
  76. \define@key{rtthesis}{isrn}{\def\@isrn{#1}}
  77. %%% ISSN number.
  78. \define@key{rtthesis}{issn}{\def\@issn{#1}}
  79. %%% URL for download.
  80. \define@key{rtthesis}{url}{\def\thesis@url{#1}}
  81. \def\thesis@url{}
  82. %%% Master's thesis subject.
  83. \define@key{rtthesis}{subject}{\def\thesis@subject{#1}}
  84. \def\thesis@subject{\emph{\"{A}mnesomr\aa{}de}}
  85. %%% Site where master's thesis work was carried out.
  86. \define@key{rtthesis}{site}{\def\thesis@site{#1}}
  87. \def\thesis@site{\emph{F\"{o}retag}}
  88. %%% City to appear on title page etc
  89. \define@key{rtthesis}{city}{\def\thesis@city{#1}}
  90. \def\thesis@city{}
  91. %%% Division.
  92. \define@key{rtthesis}{division}{\def\thesis@division{#1}}
  93. \def\thesis@division{\emph{Organisatorisk avdelning}}
  94. %%% Department key.
  95. \define@key{rtthesis}{department}{\def\thesis@department{#1}}
  96. \def\thesis@department{}
  97. %%% Master's thesis examiner.
  98. \define@key{rtthesis}{examiner}{\def\thesis@examiner{#1}}
  99. \def\thesis@examiner{\emph{Examinator}}
  100. %%% Master's thesis supervisor(s).
  101. \define@key{rtthesis}{supervisor}{\def\thesis@supervisor{#1}}
  102. \def\thesis@supervisor{\emph{Handledare}}
  103. %%% Swedish title
  104. \define@key{rtthesis}{swetitle}{%
  105. \def\swe@title{#1}%
  106. \let\@title\swe@title%
  107. }
  108. \def\swe@title{\emph{Svensk titel}}
  109. %%% Swedish subtitle
  110. \define@key{rtthesis}{swesubtitle}{%
  111. \def\swe@subtitle{#1}%
  112. \let\@subtitle\swe@subtitle%
  113. \rtswe@subtitletrue%
  114. \let\ifrt@subtitle\ifrtswe@subtitle%
  115. }
  116. \def\swe@subtitle{}
  117. \newif\ifrtswe@subtitle\rtswe@subtitlefalse
  118. %%% Keywords
  119. \define@key{rtthesis}{keywords}{\def\thesis@keywords{#1}}
  120. \def\thesis@keywords{}
  121. %%% Local ID, e.g., LIU-TEK-LIC-YYYY:N number
  122. \define@key{rtthesis}{localID}{\def\local@ID{#1}}
  123. %%%Publisher.
  124. \define@key{rtthesis}{publisher}{\def\publishername{#1}}
  125. \def\publishername{LiU-Tryck, Link\"{o}ping, Sweden}
  126. %%% Mail
  127. \define@key{rtthesis}{username}{\gdef\u@name{#1}}
  128. \define@key{rtthesis}{email}{\gdef\em@il{#1}}
  129. %%% Dedication
  130. \define@key{rtthesis}{dedication}{\gdef\dedic@tion{#1}}
  131. \def\dedic@tion{Intentionally left empty!}
  132. %%% Cover information
  133. \gdef\rtcoverinfo{}
  134. \newcommand*{\rt@selectlanguage@eng}{%
  135. \renewcommand*\@title{\eng@title}%
  136. \renewcommand*\@subtitle{\eng@subtitle}%
  137. \let\ifrt@subtitle\ifrteng@subtitle%
  138. }
  139. \newcommand*{\rt@selectlanguage@swe}{%
  140. \renewcommand*\@title{\swe@title}%
  141. \renewcommand*\@subtitle{\swe@subtitle}%
  142. \let\ifrt@subtitle\ifrtswe@subtitle%
  143. }
  144. \newcommand\setupThesis[1]{%
  145. \setkeys{rtthesis}{#1}%
  146. \def\thesistypephd{phd}
  147. \def\thesistypelic{lic}
  148. \def\thesistypemsc{msc}
  149. \def\thesistypebsc{bsc}
  150. \ifx\thesis@type\@empty
  151. \ClassError{rtthesis}{%
  152. The thesis type must be set via setupThesis, by\MessageBreak
  153. assigning either `phd', `lic', or `msc' to the\MessageBreak
  154. key <type>%
  155. }{%
  156. The thesis type must be set via setupThesis, by\MessageBreak
  157. assigning either `phd', `lic', or `msc' to the\MessageBreak
  158. key <type>%
  159. }%
  160. \else\ifx\thesis@type\thesistypephd
  161. \RequirePackage{rtphd}%
  162. \else\ifx\thesis@type\thesistypelic
  163. \RequirePackage{rtlic}%
  164. \else\ifx\thesis@type\thesistypemsc
  165. \RequirePackage{rtmsc}%
  166. \else\ifx\thesis@type\thesistypebsc
  167. \RequirePackage{rtmsc}%
  168. \else
  169. \ClassError{rtthesis}{%
  170. setupThesis was called with an invalid value for\MessageBreak
  171. the key <type>. Valid values are `phd', `lic'\MessageBreak
  172. and `msc'%
  173. }{%
  174. setupThesis was called with an invalid value for\MessageBreak
  175. the key <type>. Valid values are `phd', `lic'\MessageBreak
  176. and `msc'%
  177. }%
  178. \fi\fi\fi\fi
  179. \AtBeginDocument{%
  180. \ifx\thesis@city\@empty
  181. \def\thesis@city{Link\"{o}ping}%
  182. \fi}
  183. }
  184. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  185. %%% OPTIONS TO book.cls %%%
  186. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  187. \DeclareOption{10pt}{\PassOptionsToClass{10pt}{book}}
  188. \DeclareOption{11pt}{\PassOptionsToClass{11pt}{book}}
  189. \DeclareOption{12pt}{\PassOptionsToClass{12pt}{book}}
  190. \ExecuteOptions{10pt}
  191. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  192. %%% SELECT CROP BOX AND PAGE LAYOUT %%%
  193. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  194. % This must be done before loading crop.sty!
  195. % S5 without intent to use margin paragraphs
  196. \DeclareOption{S5}{
  197. \PassOptionsToPackage{
  198. twoside, papersize={165mm,240mm}, body={125mm,195mm},% S5
  199. bindingoffset=5mm, portrait,% The real binding offset is about 1mm, but the pages tend to bend near the back.
  200. marginparsep=2mm,marginpar=15mm,% 15mm is not very much, except for things as TODO items during writing.
  201. twocolumn=false, vmarginratio={1:1}, hmarginratio={1:1} % One may consider using the default hmarginratio={2:3}, but this can make the text hard to read near the binding. A similar effect may obtained by decreasing bindingoffset to, for instance, 1mm or 0mm, but a negative value would be required to get the same effect as hmarginratio={2:3} (body is closer to the binding side of the paper than the other side).
  202. }{geometry}
  203. }
  204. % S5 with intent to use margin paragraphs.
  205. % Note that the S5 paper is not really wide enough to make a layout with reasonably wide margin paragraphs look good.
  206. % This option is provided primarily as a starting point for layouts using margin paragraphs, and separating the S5MP option from the plain S5 option allows the latter to be designed without the limitations imposed by margin paragraphs.
  207. \DeclareOption{S5MP}{
  208. \PassOptionsToPackage{
  209. twoside, papersize={165mm,240mm}, body={110mm,195mm},% S5
  210. bindingoffset=1mm, portrait,
  211. includemp,marginparsep=4mm,marginpar=25mm,% 15mm is not very much, except for things as TODO items during writing.
  212. twocolumn=false, vmarginratio={1:1}, hmarginratio={3:2}
  213. }{geometry}
  214. }
  215. \DeclareOption{nailing}{
  216. \ExecuteOptions{nobacklist}
  217. \PassOptionsToPackage{
  218. papersize={155mm,230mm}, body={125mm,200mm},% 10mm smaller than S5 along each dimension.
  219. bindingoffset=0mm, portrait,
  220. twocolumn=false, vmarginratio={1:1}, hmarginratio={1:1}
  221. }{geometry}
  222. }
  223. \ExecuteOptions{S5}
  224. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  225. %%% PAPER SIZE AND CROP SETTINGS %%%
  226. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  227. % Note that the paper size is typically bigger than the crop box, and that
  228. % crop marks are used to show which part of the printed paper that contains
  229. % the actual page content.
  230. %
  231. % See the geometry options above for page layout.
  232. %
  233. % We don't really bother about bleed boxes here.
  234. \newcommand*{\@info}{\relax}%
  235. \newif\ifrt@loadCrop
  236. \rt@loadCropfalse
  237. \DeclareOption{pdf}{% Do not load crop.sty, and use whatever paper size that was specified via geometry.sty.
  238. % Since crop.sty typically increases the size of the page to that of a paper that is bigger than the crop box,
  239. % the safest way to implement the 'pdf' option is simply to not load crop.sty at all.
  240. \rt@loadCropfalse
  241. }
  242. \DeclareOption{print}{% Backward compatibility option
  243. \ClassWarningNoLine{rtthesis}{
  244. The class option 'print' has been renamed 'pdf'.\MessageBreak
  245. Since 'pdf' is the default, your problem is solved by\MessageBreak
  246. simply removing the class option 'print'.}
  247. \ExecuteOptions{pdf}
  248. }
  249. \DeclareOption{crop}{% To get cropmarks for s5 centered on a4 paper
  250. \rt@loadCroptrue
  251. \def\rt@CROPmode{cam}
  252. \PassOptionsToPackage{ axes, a4, center }{crop}
  253. \ExecuteOptions{info}
  254. }
  255. \DeclareOption{onA4}{% s5 centered on a4 paper, without crop marks
  256. \rt@loadCroptrue
  257. \PassOptionsToPackage{ noaxes, a4, center }{crop}%
  258. \def\rt@CROPmode{off}
  259. \ExecuteOptions{noInfo}
  260. }
  261. \DeclareOption{draft}{% s5 centered on a4 DRAFT
  262. \rt@loadCroptrue
  263. \PassOptionsToPackage{ a4, center }{crop} % s5 centered on a4 with crops
  264. \def\rt@CROPmode{off}% Turn off the crop marks.
  265. \ClassInfo{rtthesis}{This is a DRAFT mode and should hence NOT be
  266. used for other purposes. Pictures are blank and overfull hboxes
  267. stand out.}
  268. }
  269. %%% These declarations must come after \DeclareOption{crop} and friends!
  270. \DeclareOption{info}{%
  271. \renewcommand*{\@info}{{%
  272. \global\advance\CROP@index\@ne%
  273. \def\x{\discretionary{}{}{\hbox{\kern.5em---\kern.5em}}}%
  274. \advance\paperwidth-20\p@%
  275. \dimen@5mm%
  276. \ifx\CROP@pagecolor\@empty%
  277. \else%
  278. \advance\dimen@\CROP@overlap%
  279. \fi%
  280. \hb@xt@\z@{%
  281. \hss%
  282. \vbox to\z@{%
  283. \centering%
  284. \hsize\paperwidth%
  285. \vss%
  286. \normalfont%
  287. \small%
  288. \CROP@font{%
  289. \texttt{\jobname}:~\the\year-\two@digits{\the\month}-\two@digits{\the\day}\:\:%
  290. \CROP@time\x\the\CROP@index~(``\thepage'')\strut%
  291. }%
  292. \vskip\dimen@%
  293. }%
  294. \hss%
  295. }%
  296. }}%
  297. }
  298. \DeclareOption{noInfo}{\renewcommand*{\@info}{\relax}}
  299. \ExecuteOptions{pdf}
  300. %%%%%%%%%%%%%%%%%%%%%%%%
  301. %%% INPUT ENCODING %%%
  302. %%%%%%%%%%%%%%%%%%%%%%%%
  303. %%% Note: It is too dangerous to have a default value for the encoding, so we
  304. %%% must detect if the user fails to select it explicitly.
  305. \newif\ifrt@InputEncUTFUnspecified
  306. \rt@InputEncUTFUnspecifiedtrue
  307. \newif\ifrt@InputEncUTF
  308. \DeclareOption{latin1}{%
  309. \rt@InputEncUTFfalse
  310. \rt@InputEncUTFUnspecifiedfalse
  311. \PassOptionsToPackage{latin1}{rtlic}%
  312. \PassOptionsToPackage{latin1}{rtphd}%
  313. \PassOptionsToPackage{latin1}{rtthesis-captions}%
  314. \PassOptionsToPackage{latin1}{rtthesis-papers-captions}%
  315. }
  316. \DeclareOption{utf8}{%
  317. \rt@InputEncUTFtrue
  318. \rt@InputEncUTFUnspecifiedfalse
  319. \PassOptionsToPackage{utf8}{rtlic}%
  320. \PassOptionsToPackage{utf8}{rtphd}%
  321. \PassOptionsToPackage{utf8}{rtthesis-captions}%
  322. \PassOptionsToPackage{utf8}{rtthesis-papers-captions}%
  323. }
  324. %%%%%%%%%%%%%%%%%%%%%
  325. %%% THESIS TYPE %%%
  326. %%%%%%%%%%%%%%%%%%%%%
  327. \DeclareOption{phd}{%
  328. \ClassError{rtthesis}{%
  329. The class option `phd' is obsolete. The thesis type\MessageBreak
  330. shall be set via the <type> key in the call to\MessageBreak setupThesis instead%
  331. }{%
  332. The class option `phd' is obsolete. The thesis type\MessageBreak
  333. shall be set via the <type> key in the call to\MessageBreak setupThesis instead%
  334. }%
  335. }
  336. \DeclareOption{lic}{%
  337. \ClassError{rtthesis}{%
  338. The class option `lic' is obsolete. The thesis type\MessageBreak
  339. shall be set via the <type> key in the call to\MessageBreak setupThesis instead%
  340. }{%
  341. The class option `lic' is obsolete. The thesis type\MessageBreak
  342. shall be set via the <type> key in the call to\MessageBreak setupThesis instead%
  343. }%
  344. }
  345. \DeclareOption{nobacklist}{%
  346. \PassOptionsToPackage{noliclist}{rtlic}
  347. \PassOptionsToPackage{nophdlist}{rtphd}
  348. }
  349. %%%%%%%%%%%%%%
  350. %%% FONT %%%
  351. %%%%%%%%%%%%%%
  352. %%% The choice of font has more implications than just loading of different font packages.
  353. %%% One thing to notice is that the theorem font will be changed from italics to slanted when
  354. %%% using KpFonts in order to take full advantage of the slanted small caps.
  355. \newif\ifrt@slantsc
  356. \DeclareOption{kp}{\def\rt@textfont{kpfonts}\rt@slantsctrue}
  357. \DeclareOption{times}{\def\rt@textfont{times}\rt@slantscfalse}
  358. \DeclareOption{lm}{\def\rt@textfont{lm}\rt@slantscfalse}
  359. \ExecuteOptions{kp}
  360. %%%%%%%%%%%%%%%%%%%%%
  361. %%% EXTRA STUFF %%%
  362. %%%%%%%%%%%%%%%%%%%%%
  363. \newsavebox{\@removeenvinment}
  364. \DeclareOption{noextras}{%
  365. \ExecuteOptions{notitlepage,noabstract,nopreface,noacknowledgements,nonotation}%
  366. \OptionNotUsed}
  367. \DeclareOption{notitlepage}{%
  368. \AtEndOfPackage{\let\maketitle=\relax}}
  369. \DeclareOption{noabstract}{%
  370. \AtEndOfPackage{\renewenvironment{abstract}[1][english]{%
  371. \begin{lrbox}{\@removeenvinment}}%
  372. {\end{lrbox}}}}
  373. \DeclareOption{nopreface}{%
  374. \AtEndOfPackage{\renewenvironment{preface}{%
  375. \begin{lrbox}{\@removeenvinment}}%
  376. {\end{lrbox}}}}
  377. \DeclareOption{noacknowledgements}{%
  378. \AtEndOfPackage{\renewenvironment{acknowledgments}{%
  379. \begin{lrbox}{\@removeenvinment}}%
  380. {\end{lrbox}}}}
  381. \DeclareOption{nonotation}{%
  382. \AtEndOfPackage{\renewenvironment{notation}{%
  383. \begin{lrbox}{\@removeenvinment}}%
  384. {\end{lrbox}}}}
  385. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  386. %%% LOOK OF THEOREM-LIKE ENVIRONMENTS %%%
  387. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  388. % Define theorems or not.
  389. \newif\ifrt@deftheorems
  390. \rt@deftheoremstrue
  391. \DeclareOption{notheorems}{\rt@deftheoremsfalse}
  392. % Use same counter for theorem-like environments?
  393. \newif\ifrt@shareTheoremCounter
  394. % Do not use \PassOptionsToPackage to propagate these options to rtthesis-theorems here!
  395. % To make things work the \PassOptionsToPackage code is put just before the \RequirePackage{rtthesis-theorems},
  396. % and uses the final setting of \ifrt@shareTheoremCounter to pass the correct option.
  397. \DeclareOption{sharecounter}{\rt@shareTheoremCountertrue}
  398. \DeclareOption{nosharecounter}{\rt@shareTheoremCounterfalse}
  399. \ExecuteOptions{nosharecounter}
  400. % Put breaks after theorem (and similar) labels?
  401. % The options 'break' and 'nobreak' will be captured by rtthesis-theorems.sty.
  402. % Choice of definition style
  403. % The options 'definition=theorem', 'definition=naked', and 'definition=marks' will be captured by rtthesis-theorems.sty.
  404. %%%%%%%%%%%%%%%%%%%%%%%%%%
  405. %%% HYPERREF SUPPORT %%%
  406. %%%%%%%%%%%%%%%%%%%%%%%%%%
  407. % If hyperref is used, it should be loaded early, and hence it must be loaded by the class.
  408. \newif\ifrt@UseHyperref
  409. \newif\ifrt@UseBackref
  410. \DeclareOption{hyperref}{\rt@UseHyperreftrue
  411. \PassOptionsToPackage{colorlinks=false,pdfborder={0 0 0},bookmarksopen=true,bookmarksopenlevel=1,bookmarksnumbered=true,hyperfootnotes=false,plainpages=false,pdfpagelabels}{hyperref}}
  412. \DeclareOption{nohyperref}{\rt@UseHyperreffalse}
  413. \DeclareOption{backref}{\rt@UseBackreftrue}
  414. \DeclareOption{nobackref}{\rt@UseBackreffalse}
  415. \ExecuteOptions{hyperref}
  416. \ExecuteOptions{nobackref}
  417. % When making the bookmarks, we need to know whether the user plans to have part divisions.
  418. \newcounter{rt@toplevel}
  419. \setcounter{rt@toplevel}{-1}
  420. \DeclareOption{noparts}{\setcounter{rt@toplevel}{0}}
  421. \DeclareOption{parts}{\setcounter{rt@toplevel}{-1}}
  422. \ExecuteOptions{parts}
  423. %%%%%%%%%%%%%%%%%%%%%%%%%%
  424. %%% PARAGRAPH BERAKS %%%
  425. %%%%%%%%%%%%%%%%%%%%%%%%%%
  426. % Use parskip.sty and adjust sectioning commands?
  427. % Note that the sub-packages rtthesis-theorems and rtthesis-example will
  428. % detect that parskip is loaded, so we don't have to pass any options to these
  429. % packages.
  430. \newif\ifrt@parskip
  431. \DeclareOption{noparskip}{\rt@parskipfalse}
  432. \DeclareOption{parskip}{\rt@parskiptrue}
  433. \ExecuteOptions{noparskip}
  434. %%%%%%%%%%%%%%%%%%%%%%%%%%
  435. %%% NATBIB CONFLICTS %%%
  436. %%%%%%%%%%%%%%%%%%%%%%%%%%
  437. \newif\ifrt@usebibunits
  438. \DeclareOption{usebibunits}{\rt@usebibunitstrue}
  439. \DeclareOption{numbers}{%
  440. \ifrt@usebibunits
  441. \ClassError{rtthesis}{%
  442. The natbib option `numbers' is in some unidentified\MessageBreak
  443. conflict with some other package loaded by rtthesis.\MessageBreak
  444. If you know how to resolve the conflict, use option\MessageBreak
  445. `forcenumbers' instead, and inform the rtthesis\MessageBreak
  446. maintainer about your workaround%
  447. }{%
  448. The natbib option `numbers' is in some unidentified\MessageBreak
  449. conflict with some other package loaded by rtthesis.\MessageBreak
  450. If you know how to resolve the conflict, use option\MessageBreak
  451. `forcenumbers' instead, and inform the rtthesis\MessageBreak
  452. maintainer about your workaround%
  453. }
  454. \fi
  455. }
  456. \DeclareOption{forcenumbers}{\PassOptionsToPackage{numbers}{natbib}}
  457. % Process options here
  458. \ProcessOptions\relax
  459. \ifrt@InputEncUTFUnspecified
  460. \ClassError{rtthesis}{%
  461. One of the options `latin1' and `utf8' must be given\MessageBreak
  462. to select the character encoding of the loaded\MessageBreak
  463. captions. Guessing your preference is just too\MessageBreak
  464. dangerous%
  465. }{%
  466. One of the options `latin1' and `utf8' must be given\MessageBreak
  467. to select the character encoding of the loaded\MessageBreak
  468. captions. Guessing your preference is just too\MessageBreak
  469. dangerous%
  470. }
  471. \fi
  472. %%%%%%%%%%%%%%%%%%%%%
  473. %%% SETUP STUFF %%%
  474. %%%%%%%%%%%%%%%%%%%%%
  475. \LoadClass{book}
  476. \RequirePackage[ pdftex=false, dvips=false, vtex=false ]{geometry}[2002/07/08]
  477. \ifrt@loadCrop
  478. \RequirePackage{crop}[2001/11/16]
  479. \crop[\rt@CROPmode,font=\mdseries\upshape\scriptsize]
  480. \let\CROP@info\@info
  481. \else
  482. % Since crop.sty always loads color.sty, we compensate for the loss here.
  483. \RequirePackage{color}
  484. \fi
  485. \RequirePackage{graphicx}
  486. % These packages are likely to work better if loaded before hyperref.
  487. \RequirePackage{url}
  488. % Fonts and input definitions
  489. \RequirePackage[T1]{fontenc}
  490. \RequirePackage{\rt@textfont}
  491. \@ifpackageloaded{kpfonts}{}{% In case KpFonts was not loaded:
  492. \RequirePackage[intlimits]{amsmath}
  493. \RequirePackage{amsfonts, amssymb}
  494. \providecommand{\textothersc}[1]{\textsc{#1}}
  495. }
  496. \ifrt@slantsc
  497. \RequirePackage{slantsc}% For access to slanted and italic smallcaps. Not all fonts support this, but kpfonts do.
  498. \PassOptionsToPackage{slanted}{rtthesis-theorems}
  499. %%% Anyone how knows how to make the slanted small caps can be substituted for italic small caps?
  500. %%% Please help!
  501. %%% The following looks like a nice idea to support small caps in italics, but it doesn't work.
  502. %\AtBeginDocument{\DeclareFontShape{T1}{jkpk}{m}{scit}{ <-> sub * jkpk/m/scsl }{}}
  503. %%% The following attempt to mimic what's inside slantsc also fails. We get the slanted small caps in place of the italics, but at the price of somehow messing up pretty much everything else quite badly!
  504. % \DeclareFontFamily{T1}{jkpk}{}
  505. % \DeclareFontShape{T1}{jkpk}{m}{scsl}{<5><6><7><8><9><10><10.95><12><14.4><17.28><20.74><24.88><29.86><35.83>genb*ecsc}{}
  506. % \DeclareFontShape{T1}{jkpk}{bx}{scsl}{<5><6><7><8><9><10><10.95><12><14.4><17.28><20.74><24.88><29.86><35.83>genb*ecoc}{}
  507. % \DeclareFontShape{T1}{jkpk}{m}{scit}{<->ssub * jkpk/m/scsl}{}
  508. % \DeclareFontShape{T1}{jkpk}{bx}{scit}{<->ssub * jkpk/bx/scsl}{}
  509. %%% End of failing attempts to get the slanted small caps in place of the italics.
  510. \fi
  511. \RequirePackage{courier}
  512. \RequirePackage[scaled]{helvet}
  513. \RequirePackage[activate]{pdfcprot}% Activate hanging punctuation in pdfTeX. This _can_ be fine-tuned, but we don't.
  514. \ifrt@parskip
  515. \RequirePackage{parskip}% There is more stuff related to rt@parskip later in this file, but the parskip package itself produces a warning if loaded too late.
  516. \fi
  517. \newlength{\rt@parskip}
  518. \newlength{\rt@parindent}
  519. \setlength{\rt@parskip}{\parskip}
  520. \setlength{\rt@parindent}{\parindent}
  521. %%% We now load packages that must be loaded before hyperref.
  522. %%% It would be possible to load these packages only when hyperref is requested, but this would make the use of the hyperref class option (to be introduced soon) confusing.
  523. %%% Another option would be to introduce a class option for each class that needs to be loaded before hyperref, but that does not scale well, and users will not know about these options and run into all sorts of package loading order issues.
  524. \RequirePackage{float}
  525. \RequirePackage{index}
  526. \ifrt@usebibunits
  527. \RequirePackage{bibunits}% Load before natbib. We should not pass sectionbib here. It is better to let some magic work out the correct level. At the time of writing, I can't see how this works. But it works.
  528. \fi
  529. \RequirePackage[sort&compress]{natbib}% This should be loaded early. It is much too late to postpone it until a user decision after the class has been loaded.
  530. \RequirePackage{bibentry}% Load after natbib, and before hyperref.
  531. \AtBeginDocument{\relax\nobibliography*}% See the bibentry documentation!
  532. \makeindex
  533. \RequirePackage{xcolor}% So that link border colors may be set.
  534. \RequirePackage{ifthen}
  535. \RequirePackage{calc}
  536. % The package caption.sty is loaded in "incompatibility mode". It doesn't seem to matter where in this file we load
  537. % the package; the compatibility check will be made much later nevertheless.
  538. \RequirePackage[margin=1em, labelfont=bf,
  539. singlelinecheck=true, font=sl,
  540. compatibility=false% Unsupported feature that suppresses the incompatibility checks...
  541. ]{caption}
  542. \captionsetup[figure]{position=bottom}
  543. \captionsetup[table]{position=top}
  544. \ifrt@parskip
  545. % There is some kind of conflict between captions, subfig, and parskip. This fix was found in a LaTeX forum on the WWW.
  546. \DeclareCaptionOption{parskip}[]{}
  547. \fi
  548. \newcommand*{\rtthesis@assertnonobackref}{\relax}
  549. \ifrt@UseBackref
  550. %%% === Beginning of hack ===
  551. %%% Here comes a hack provided at http://qianglee.blogspot.com/2006/08/make-bibentry-compatible-with-backref.html .
  552. %%% The purpose is to make bibentry work together with backref (possibly loaded via hyperref).
  553. %%% Before backref messes up, we need to capture the definitions from natbib, so we load bibentry first, then do the hack,
  554. %%% and finally load hyperref.
  555. %%% Note that this fix assumes that natbib has already been loaded! Who did that?!
  556. \let\BRatbibitem\BR@bibitem
  557. \AtBeginDocument{%
  558. \begingroup
  559. \makeatletter
  560. \let\BR@bibitem\BRatbibitem
  561. \endgroup
  562. }
  563. %%% === End of hack ===
  564. %%% In addition to the problems with bibentry, there seems to be problems with bibunits that we currently have no solution to.
  565. \renewcommand*{\rtthesis@assertnonobackref}{%
  566. \ClassError{rtthesis}{%
  567. The `backref' class option is incompatible with\MessageBreak
  568. features of the bibunits package. If you insist\MessageBreak
  569. to use bibunits features, you need to turn back\MessageBreak
  570. references off using the `nobackref' class option%
  571. }{%
  572. The `backref' class option is incompatible with\MessageBreak
  573. features of the bibunits package. If you insist\MessageBreak
  574. to use bibunits features, you need to turn back\MessageBreak
  575. references off using the `nobackref' class option%
  576. }%
  577. }
  578. \fi
  579. %%% Now, it should be safe to load hyperref. Note that most packages should be loaded after hyperref, so be very careful when moving stuff across this point in the file!
  580. \ifrt@UseHyperref
  581. \ifrt@UseBackref
  582. \PassOptionsToPackage{backref=page}{hyperref}
  583. \fi
  584. \RequirePackage{hyperref}
  585. \AtEndDocument{
  586. \ifthenelse{\value{rt@toplevel}=0}{
  587. %%% In case there are no parts, the part counter should still be at zero.
  588. \ifthenelse{\value{part}=0}{}{\ClassWarningNoLine{rtthesis}{%
  589. Class loaded with indication that there would be no\MessageBreak
  590. part divisions in the document. However, the part\MessageBreak
  591. count is non-zero at the end of the document. Check\MessageBreak
  592. that the PDF bookmarks are OK
  593. }}}{
  594. %%% In case there are parts, the part counter should be non-zero here.
  595. \ifthenelse{\value{part}=0}{\ClassWarningNoLine{rtthesis}{%
  596. Class loaded with indication that there would be part\MessageBreak
  597. divisions in the document. However, the part count is\MessageBreak
  598. still zero at the end of the document. Check that the\MessageBreak
  599. PDF bookmarks are OK
  600. }}{}
  601. }
  602. }
  603. %%% In order to get the PDF bookmarks right, we need to make chapters and sections appear on the part level in the frontmatter and backmatter.
  604. \let\rt@bookfrontmatter\frontmatter
  605. \let\rt@bookmainmatter\mainmatter
  606. \let\rt@bookbackmatter\backmatter
  607. \renewcommand{\frontmatter}{%
  608. \rt@bookfrontmatter
  609. \def\toclevel@chapter{\thert@toplevel}%
  610. \def\toclevel@section{\thert@toplevel}%
  611. }
  612. \renewcommand{\mainmatter}{%
  613. \rt@bookmainmatter
  614. \def\toclevel@chapter{0}
  615. \def\toclevel@section{1}
  616. }
  617. \renewcommand{\backmatter}{%
  618. \rt@bookbackmatter
  619. \def\toclevel@chapter{\thert@toplevel}%
  620. \def\toclevel@section{\thert@toplevel}%
  621. }
  622. % TODO: call \hypersetup AtBeginDocument with info about title, keywords etc.
  623. \else% Not using hyperref.
  624. %%% Provide alternatives to some hyperref commands that one might typically invoke explicitly in case hyperref is present.
  625. \RequirePackage{nohyperref}
  626. %%% The starred forms of \ref, \eqref, and \pageref are missing in nohyperref.sty. These are provided below.
  627. \RequirePackage{suffix}
  628. \ClassWarningNoLine{rtthesis}{%
  629. Adding things that are missing in nohyperref. Some day\MessageBreak
  630. these things will probably be found in nohyperref, and\MessageBreak
  631. then these definitions should be removed from here}
  632. \AtEndOfClass{%
  633. \let\ref@NoStar=\ref
  634. \renewcommand{\ref}{\@ifstar\ref@NoStar\ref@NoStar}%
  635. \let\eqref@NoStar=\eqref
  636. \renewcommand{\eqref}{\@ifstar\eqref@NoStar\eqref@NoStar}%
  637. \let\pageref@NoStar=\pageref
  638. \renewcommand{\pageref}{\@ifstar\pageref@NoStar\pageref@NoStar}%
  639. \let\pdfstringdefDisableCommands=\undef % GH: Ugly hack which should not be neccessary
  640. }
  641. %%%
  642. \ifrt@UseBackref
  643. \ClassWarningNoLine{rtthesis}{%
  644. There seems to be compatibility issues between option\MessageBreak
  645. backref and the bibentry package, when hyperref is not\MessageBreak
  646. loaded. That is, if you use the bibentry package and\MessageBreak
  647. turn hyperref off, it is also recommended that you\MessageBreak
  648. turn back references off using the nobackref class\MessageBreak
  649. option}
  650. \RequirePackage[pageref]{backref}
  651. \fi
  652. %\RequirePackage{nameref}% nameref is automatically loaded by hyperref... but seems not to work without hyperref.
  653. \providecommand{\nameref}[1]{%
  654. \ClassWarning{rtthesis}{%
  655. The command nameref does not work without hyperref\MessageBreak
  656. being loaded. Using plain reference instead,}
  657. \ref{#1}}
  658. \fi
  659. \newcommand{\pdfbookmarkTopLevel}[2]{%
  660. \ifthenelse{\value{rt@toplevel}=0}{%
  661. \pdfbookmark[0]{#1}{#2}%
  662. }{%
  663. \pdfbookmark[-1]{#1}{#2}%
  664. }
  665. }
  666. \providecommand{\backref}{\relax}
  667. \providecommand{\backrefalt}{\relax}
  668. \renewcommand*{\backref}[1]{}
  669. \renewcommand*{\backrefalt}[4]{%
  670. \ifcase #1 %
  671. Not cited.%
  672. \or
  673. Cited on page #2.%
  674. \else
  675. Cited on pages #2.%
  676. \fi
  677. }
  678. % In case we didn't load the backref package (perhaps via hyperref), it may be good to have the following void definitions around.
  679. \providecommand{\backrefparscanfalse}{}
  680. \providecommand{\backrefparscantrue}{}
  681. \RequirePackage{tocloft}% Get control over table of contents etc.
  682. %%% First ensure that we get the usual section* heading, and add a pdf bookmark while we're at it!
  683. \setlength{\cftbeforetoctitleskip}{0pt}
  684. \setlength{\cftaftertoctitleskip}{0pt}
  685. \renewcommand{\cfttoctitlefont}[1]{%
  686. \ifrt@UseHyperref
  687. \pdfbookmarkTopLevel{\contentsname}{thetocanchor}%
  688. \fi
  689. \@makeschapterhead{#1}%
  690. }
  691. %%% ... then we tune the toc...
  692. \AtBeginDocument{\cftpagenumbersoff{part}}
  693. \cftsetpnumwidth{2em}
  694. \ifrt@parskip
  695. \setlength{\cftparskip}{0.3ex}
  696. \fi
  697. \renewcommand{\cftmarktoc}{\markboth{\contentsname}{\contentsname}} % Needed to not get CONTENTS (with capital letters) in the header of the Contents, should be loaded after tocloft
  698. \RequirePackage[margin=.5em, font={sl,small}]{subfig} % Must be loaded after tocloft.
  699. % tocbibind shall be loaded after hyperref. Otherwise, some pdf bookmarks will be missing (like the one for the index).
  700. \RequirePackage[ chapter, nottoc ]{tocbibind} % Fix heading in bibs etc
  701. \renewcommand*\tocetcmark[1]{\markboth{#1}{#1}}
  702. \RequirePackage{sectsty} %Redefine section captions
  703. \newcommand*{\chapternamefont} [1]
  704. {\gdef\SS@chapnamefont{\SS@sectid{1}\SS@nopart\SS@makeulinepartchap#1}}
  705. \renewcommand*{\chapterfont}[1]
  706. {\chapternumberfont{#1}
  707. \chapternamefont{#1}
  708. \chaptertitlefont{#1}}
  709. \allsectionsfont{\sffamily}
  710. % Make ragged right for *section headings, for better behavior with
  711. % long titles
  712. \sectionfont{\sffamily\raggedright}
  713. \subsectionfont{\sffamily\raggedright}
  714. \subsubsectionfont{\sffamily\raggedright}
  715. \DeclareRobustCommand\em% New look to emphasis text
  716. {\@nomath\em \ifdim \fontdimen\@ne\font >\z@
  717. \upshape \else \slshape \fi}
  718. % Select the input encoding to be used in the document, and from this point in the class file too.
  719. % I need to comment a bit on this...
  720. % It is really strange how the input encoding works before inputenc.sty is loaded. If we don't load inputenc.sty until
  721. % the end of the class, it seems like the other packages that we load may use latin-1, and the packages will work even
  722. % if we later switch input encoding to utf-8. However, if we make the selection of latin-1 explicit here by loading
  723. % inputenc.sty with option "latin1" at this point, then the packages encoded in latin-1 will not work if we later switch
  724. % to utf-8.
  725. %
  726. % It is because of this strange behavior that I prefer to make the choice of input encoding explicit here. Then we know what
  727. % encoding to use in the packages that are loaded by the class.
  728. %
  729. % The strange behavior could be related to how inputenc.sty is currently implemented. That is, that the actual encoding
  730. % doesn't change until LaTeX encounters a character outside the lower 8-bit range. Exactly how this would explain things, I
  731. % don't know, but even if I did, this seems like a detail of implementation and not something that this class should rely on.
  732. \ifrt@InputEncUTF
  733. \RequirePackage[utf8]{inputenc}
  734. \RequirePackage{rtthesis-utf8-ext}% Add additional characters.
  735. \else
  736. \RequirePackage[latin1]{inputenc}
  737. \fi
  738. \RequirePackage[swedish, english]{babel}
  739. \AtBeginDocument{\relax\selectlanguage{english}}% Can't see why the \relax is needed here. However, it really was needed at one point, so be very careful if you plan to remove it! Hint: to detect problems after removing it, select a language that does not exist, turn off the hyperref option, and play around with other options as well, and make sure that the document always fails to compile due to the bad language name.
  740. \RequirePackage{rtthesis-papers}
  741. \RequirePackage{rtthesis-captions}
  742. \RequirePackage{rtthesis-papers-captions}
  743. %%% Theorem environments %%%
  744. %Only specify theorems if the notheorems option is not specified
  745. \ifrt@shareTheoremCounter
  746. \PassOptionsToPackage{sharecounter}{rtthesis-theorems}%
  747. \else
  748. \PassOptionsToPackage{nosharecounter}{rtthesis-theorems}%
  749. \fi
  750. \ifrt@deftheorems
  751. \RequirePackage{rtthesis-theorems}% Load after parskip!
  752. \fi
  753. \RequirePackage{rtthesis-example}% Load after parskip!
  754. % Page headers
  755. \RequirePackage{fancyhdr}
  756. \fancypagestyle{plain}{%
  757. \fancyhf{}%
  758. \fancyfoot[C]{\mdseries\small\thepage}%
  759. \renewcommand*\headrulewidth{0pt}}
  760. \fancypagestyle{rtthesisheadings}{%
  761. \fancyhf{}
  762. \fancyhead[LE,RO]{\normalfont\bfseries\thepage}%
  763. \fancyhead[RE]{\normalfont\mdseries\small\leftmark}%
  764. \fancyhead[LO]{\normalfont\mdseries\small\rightmark}%
  765. \renewcommand*\chaptermark[1]{\markboth{\@chapappname~\thechapter\quad##1}{}}%
  766. \renewcommand*\sectionmark[1]{\markright{\thesection\quad##1}}%
  767. \renewcommand*\headrulewidth{0.3pt}}
  768. \pagestyle{rtthesisheadings}
  769. \renewcommand*\chaptermark[1]{\markboth{\@chapappname~\thechapter\quad#1}{}}%
  770. \renewcommand*\sectionmark[1]{\markright{\thesection\quad#1}}%
  771. % Stuff that comes handy
  772. \newcommand*\clearemptydoublepage{\clearpage\if@twoside \ifodd\c@page\else
  773. \thispagestyle{empty}\hbox{}\newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
  774. %%%%%%%%%%%%%%%%%%%%%%%
  775. %%% ABSTRACT ETC. %%%
  776. %%%%%%%%%%%%%%%%%%%%%%%
  777. \newenvironment{abstract}[1][english]{%
  778. \clearemptydoublepage%
  779. \begin{otherlanguage}{#1}%
  780. \ifrt@UseHyperref
  781. \phantomsection\pdfbookmarkTopLevel{\abstractname}{theabsanchor-#1}%
  782. \fi
  783. \section*{\abstractname}%
  784. \markboth{\abstractname}{\abstractname}%
  785. \thispagestyle{plain}}{%
  786. \end{otherlanguage}%
  787. \clearemptydoublepage}
  788. \newenvironment{preface}{%
  789. \clearemptydoublepage
  790. \thispagestyle{plain}%
  791. \ifrt@UseHyperref
  792. \phantomsection\pdfbookmarkTopLevel{\prefacename}{theprefaceanchor}%
  793. \fi
  794. \section*{\prefacename}%
  795. \markboth{\prefacename}{\prefacename}}{%
  796. \clearemptydoublepage}
  797. \newenvironment{acknowledgments}{%
  798. \clearemptydoublepage
  799. \thispagestyle{plain}%
  800. \ifrt@UseHyperref
  801. \phantomsection\pdfbookmarkTopLevel{\acknowledgmentsname}{theackanchor}%
  802. \fi
  803. \section*{\acknowledgmentsname}%
  804. \markboth{\acknowledgmentsname}{\acknowledgmentsname}}{%
  805. \clearemptydoublepage}
  806. \newenvironment{notation}[1][]{%
  807. \def\notationtabularstyle{#1}
  808. \def\notationtabularstylenew{new}
  809. \def\notationtabularstyleold{old}
  810. \ifx\notationtabularstyle\@empty
  811. % Do not redefine the notationtabular environment in this case.
  812. \else\ifx\notationtabularstyle\notationtabularstylenew
  813. \renewenvironment{notationtabular}{\notationtabular@modern}{\endnotationtabular@modern}
  814. \else\ifx\notationtabularstyle\notationtabularstyleold
  815. \renewenvironment{notationtabular}{\notationtabular@old}{\endnotationtabular@old}
  816. \else
  817. \ClassError{rtthesis}{%
  818. Bad option value to notation environment.\MessageBreak
  819. Legal values are "old" and "new"%
  820. }{%
  821. Bad option value ("\notationtabularstyle") to\MessageBreak
  822. notation environment. Legal values are\MessageBreak
  823. "old" and "new"%
  824. }%
  825. \fi\fi\fi
  826. % The notation is put on chapter level, to match the table of contents which usually comes before.
  827. \clearemptydoublepage
  828. \thispagestyle{plain}%
  829. \ifrt@UseHyperref
  830. \phantomsection
  831. \fi
  832. \addcontentsline{toc}{chapter}{\notationname}
  833. \chapter*{\notationname}%
  834. \markboth{\notationname}{\notationname}}{%
  835. \clearemptydoublepage}
  836. %%% Make good-looking tables.
  837. \RequirePackage{array}
  838. \RequirePackage{booktabs}
  839. \let\otoprule\toprule
  840. \newenvironment{notationtabular@modern}[3]{%
  841. \addvspace{1\baselineskip}
  842. \begin{tabular}{>{\centering}m{0.18\textwidth} p{0.67\textwidth}}
  843. \multicolumn{2}{l}{\rlap{\hspace*{-3ex}\raisebox{1ex}{\textbf{\textothersc{#1}}}}}\\
  844. \toprule%
  845. \textbf{#2} & \textbf{#3} \\
  846. \otoprule%
  847. }{%
  848. \bottomrule%
  849. \end{tabular}
  850. }
  851. \newenvironment{notationtabular@old}[3]{%
  852. \addvspace{1\baselineskip}
  853. \begin{tabular}{>{\centering}m{0.18\textwidth}|p{0.67\textwidth}}
  854. \multicolumn{2}{l}{\rlap{\hspace*{-3ex}\raisebox{1ex}{\textbf{\textothersc{#1}}}}}\\
  855. \hline
  856. \textbf{#2} & \parbox{\linewidth}{\centering\textbf{#3}} \\
  857. \hline
  858. \hline}{%
  859. \hline
  860. \end{tabular}
  861. }
  862. \newenvironment{notationtabular}{\notationtabular@modern}{\endnotationtabular@modern}
  863. %%%%%%%%%%%%%%%%%%%%%%%
  864. %%% CHAPTER HEADS %%%
  865. %%%%%%%%%%%%%%%%%%%%%%%
  866. %%% Minor changes compared to book.cls:
  867. %%% - Using \clearemptydoublepage instead of \cleardoublepage
  868. %%% - Using \thispagestyle{empty} instead of \thispagestyle{plain}
  869. \renewcommand\part{\if@openright\clearemptydoublepage\else\clearpage\fi
  870. \thispagestyle{empty}%
  871. \if@twocolumn
  872. \onecolumn
  873. \@tempswatrue
  874. \else
  875. \@tempswafalse
  876. \fi
  877. \null\vfil
  878. \secdef\@part\@spart}
  879. \renewcommand\chapter{\if@openright\clearemptydoublepage\else\clearpage\fi
  880. \thispagestyle{plain}%
  881. \global\@topnum\z@
  882. \@afterindentfalse
  883. \secdef\@chapter\@schapter}
  884. \DeclareFontFamily{OT1}{cmrd}{}
  885. \DeclareFontShape{OT1}{cmrd}{bm}{n}{ <-> s * [2.0] cmr10}{}
  886. \renewcommand*\@makechapterhead[1]{%
  887. \vspace*{14mm}%
  888. \noindent%
  889. \parbox[t][80pt][b]{\textwidth}{%
  890. \ifnum \c@secnumdepth >\m@ne%
  891. \if@mainmatter%
  892. \flushright%
  893. \begingroup%
  894. \bfseries%
  895. \fontsize{1.5cm}{3cm}\selectfont\SS@chapnamefont\@chapappname%
  896. {\fontsize{4cm}{4.2cm}\selectfont\SS@chapnumfont{~\thechapter}}\\%
  897. \endgroup%
  898. \fi%
  899. \fi%
  900. \rule{\textwidth}{1pt}%
  901. }\\[0pt]%
  902. \parbox[t][70pt][t]{\textwidth}{%
  903. \addvspace{6pt}%
  904. \flushright\sffamily\huge\bfseries\SS@chaptitlefont #1}%
  905. \vspace*{10pt}\par%
  906. }
  907. \renewcommand*\@makeschapterhead[1]{%
  908. \vspace*{14mm}%
  909. \noindent%
  910. %%% One of the following two lines should be commented out, depending on whether one wants to allocate vertical space as if there would have been a chapter number.
  911. % \parbox[t][80pt][b]{\textwidth}{\rule{\textwidth}{1pt}}\\[0pt]%%% Allocate "chapter number" space.
  912. \rule{\textwidth}{1pt}\\[0pt]%%% Do not allocate "chapter number" space.
  913. %%%
  914. \parbox[t][70pt][t]{\textwidth}{%
  915. \addvspace{6pt}%
  916. \flushright\huge\sffamily\bfseries\SS@chaptitlefont{#1}}%
  917. \vspace*{10pt}\markboth{#1}{}\par%
  918. }
  919. \newcommand*\@makechapterparthead[1]{%
  920. \vspace*{14mm}%
  921. \noindent%
  922. \rule{\textwidth}{1pt}\\[0pt]%
  923. \parbox[t][70pt][t]{\textwidth}{%
  924. \addvspace{6pt}%
  925. \flushright\huge\sffamily\bfseries\SS@chaptitlefont{#1}}%
  926. \vspace*{10pt}\par%
  927. }
  928. \RequirePackage{appendix}
  929. \newenvironment{chapter-appendix}{%
  930. \clearpage
  931. \begin{subappendices}%
  932. \thispagestyle{plain}%
  933. \@makechapterparthead{\appendixname}%
  934. }{%
  935. \end{subappendices}
  936. }
  937. % The following command may be used to set a prefix for the chapter number in a chapter heading.
  938. % It may be useful for appendices, but exactly how it should be used is unclear at the time of
  939. % writing.
  940. \newcommand*\setchapapp[1]{\gdef\@chapappname{#1}}
  941. \setchapapp{\relax}
  942. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  943. %%% parskip.sty with adjusted spacing after sectioning commands %%%
  944. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  945. \ifrt@parskip
  946. %%% The package was loaded early on, due to package ordering reasons.
  947. %%% Adjust spacing around sectioning headings.
  948. \RequirePackage{titlesec}
  949. \titlespacing{\section}{0pt}{1em}{0.5ex}
  950. \titlespacing{\subsection}{0pt}{0.5ex}{0ex}
  951. \titlespacing{\subsubsection}{0pt}{0ex}{0ex}
  952. \titlespacing{\paragraph}{0pt}{0pt}{1.5ex}
  953. %%% Adjust spacing around equations.
  954. \addto{\normalsize}{%
  955. \setlength{\abovedisplayskip}{1.0\parskip}%
  956. \setlength{\belowdisplayskip}{1.0\parskip}%
  957. \setlength{\abovedisplayshortskip}{0.8\parskip}%
  958. \setlength{\belowdisplayshortskip}{0.8\parskip}%
  959. }
  960. \fi
  961. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%