rtthesis-doc.tex 70 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920
  1. \chapter{\rtthesis documentation and \LaTeX{} tips}\label{cha:rtthesis}
  2. This document is not only an example that you can use to get started with the \rtthesis class, it also contains written instructions for how to use the class, and some general tips on how to use \LaTeX{} to produce a beautiful thesis. As we do so in this chapter, we also get the opportunity to look at some theorem-like environments, which you can alter the look of by changing the options given to the \rtthesis class.
  3. \section{Basic setup}\label{sec:basic-setup}
  4. %
  5. You must decide on an input encoding from start, and select the corresponding class option from \tableref{tab:inputenc} on \pagepageref{tab:inputenc}. You must also tell \rtthesis whether you intend to use part sectioning or not, see \tableref{tab:part-options}. There are many more class options, but they will be mentioned below where there is room for a more detailed discussion for the corresponding features.
  6. Information about the thesis, which is needed to produce the thesis itself as well as the thesis cover and the “spikblad”, is passed to \rtthesis using the command \texcommand{setupThesis}. The command is called in the following way, where the most common key-value pairs are listed in \tableref{tab:setupThesis} (the remaining key-value pairs concern master's theses, see \sectionref{sec:msc})):
  7. \begin{minipage}{1.0\linewidth}
  8. \verbatimsize
  9. \begin{verbatim}
  10. \setupThesis{
  11. key1=value1,
  12. key2=value2,
  13. ...
  14. }
  15. \end{verbatim}
  16. \end{minipage}
  17. If a PhD thesis has an interesting illustration on the cover, it is customary to provide a caption for the illustration. The caption will be printed on the back of the title page, and is set up by redefining the command \texcommand{rtcoverinfo}. For instance, it may look like this:
  18. \begin{minipage}{1.0\linewidth}
  19. \verbatimsize
  20. \begin{verbatim}
  21. \renewcommand{\rtcoverinfo}{\textbf{Cover illustration:} Block
  22. diagram showing the structure of the control scheme proposed in
  23. \chapterref{cha:cool-control}}
  24. \end{verbatim}
  25. \end{minipage}
  26. \begin{table}[tbp]
  27. \centering
  28. \caption{\label{tab:part-options}%
  29. Class options that inform \rtthesis whether part sectioning will be used or not.}
  30. \begin{tabular}{l p{0.5\linewidth}}
  31. \toprule%
  32. \textbf{Class option} & \textbf{Meaning} \\
  33. \otoprule%
  34. \classoption{parts} & Prepare for \texcommand{part} as the topmost sectioning command.\\
  35. \classoption{noparts} & Prepare for \texcommand{chapter} as the topmost sectioning command.\\
  36. \bottomrule%
  37. \end{tabular}
  38. \end{table}
  39. \begin{table}[tbp]
  40. \centering
  41. \caption{\label{tab:setupThesis}%
  42. Key-value pairs recognized by \texcommand{setupThesis}. Note that values that include white space are surrounded by braces.}
  43. \begin{tabular}{>{\ttfamily}r !{\texttt{=}} >{\ttfamily}l p{0.5\linewidth}}
  44. \toprule%
  45. \textbf{Key} & \textbf{Example value} & \textbf{Comment} \\
  46. \otoprule%
  47. author & \{My Name\} & \\
  48. title & \{Thesis title\} & \\
  49. subtitle & \{Good stuff\} & Optional. \\
  50. city & Norrköping & Default: \emph{Linköping} \\
  51. year & 2010 & \\
  52. isbn & isbn-isbn-isbn-isbn & \\
  53. type & phd & Must be either \emph{phd}, \emph{lic}, or \emph{msc}. \\
  54. thesisNo & 9999 & Number in series (the series is determined by the choice of thesis type). \\
  55. localID & 11 & Only used for licentiate's theses. It is the last part of the local identifier \emph{\mbox{LIU-TEK-LIC-2010:11}} in this case.\\
  56. username & isyusername & Used to generate the author's email address. \\
  57. dedication & \{To my parents!\} & \\
  58. \bottomrule%
  59. \end{tabular}
  60. \end{table}
  61. \section{Page layout and related options}\label{sec:page-layout}
  62. %
  63. Theses are restricted to the S5 paper size. How the S5 page is organized is up to you, but \rtthesis only allows you to choose from two predefined layouts, and only one of them is recommended. To get your own layout you should make a copy of \textfilename{rtthesis.cls} and modify the code for one of the existing class options for layout. The class options for page layout are given in \tableref{tab:page-layout}.
  64. At the time of writing, the printers used by LiU-Tryck print on A4 paper (physical size), which is then cropped to S5 (logical size). Similarly, when you print draft versions of your thesis on your office printer, it is very likely that the used physical paper size will be A4. Hence, it makes sense to let \rtthesis control how the S5 logical page is placed on the A4 physical paper. In this case, \rtthesis will produce a \textsc{pdf} with pages in the A4 format, with content restricted to the S5 format. On the other hand, when you produce a \textsc{pdf} that is meant to be read on a computer screen, the page size should be exactly S5. When targeting the A4 physical format, it is possible to get crop marks for the S5 box, and to put some information about each page outside the S5 box. The related class options are given in \tableref{tab:page-layout}.
  65. To ensure that you really get the page layout you think when you send your thesis file to the printer's, the best option \emph{should} be to use the \classoption{crop} option. However, they will tell you differently, since they think it's \emph{their} job to position the logical page on A4 and add crop marks. Unfortunately, there is a lot of manual work in the process, so there is a (substantial?!) risk that the content of your pages will be shifted with respect to the S5 box of your layout\ldots
  66. \begin{table}[tbp]
  67. \centering
  68. \caption{\label{tab:page-layout}%
  69. Class options related to page layout. The most important one to remember is \classoption{crop} (since \classoption{S5} and \classoption{pdf} are default).}
  70. \begin{tabular}{l p{0.5\linewidth}}
  71. \toprule%
  72. \textbf{Class option} & \textbf{Meaning} \\
  73. \otoprule%
  74. \classoption{S5} & Recommended layout. Margin paragraphs are tiny (see \sectionref{sec:research:history} for examples), and should only be used for comments that will be removed in the final version of the thesis. Default.\\
  75. \classoption{S5MP} & Layout to use if you are serious about margin paragraphs. Not recommended, since the S5 format is too narrow to really fit margin paragraphs of reasonable width. \\
  76. \classoption{nailing} & Layout for the “spikblad”. Not for theses! \\
  77. \midrule%
  78. \classoption{pdf} & Produce pages in the S5 format. Default.\\
  79. \classoption{onA4} & Logical S5 page on a \textsc{pdf} page of size A4.\\
  80. \classoption{info} & Write information about each page above the logical S5 page.\\
  81. \classoption{crop} & Same as \classoption{onA4} with \classoption{info} and crop marks.\\
  82. \classoption{noInfo} & Turn off the effect of \classoption{info}.\\
  83. \classoption{draft} & Same as \classoption{onA4}, but pictures are blank and overfull \texttt{hbox}es stand out.\\
  84. \bottomrule%
  85. \end{tabular}
  86. \end{table}
  87. Although only weakly related to page layout, this section ends with a tip for how to change the size of the chapter numbers (some users find them much too big). The font is controlled using the \styname{sectsty} package, and it follows that it can be redefined by, for instance,
  88. \begin{minipage}{1.0\linewidth}
  89. \verbatimsize
  90. \begin{verbatim}
  91. \chapternumberfont{\fontsize{60mm}{63mm}\selectfont}
  92. \end{verbatim}
  93. \end{minipage}
  94. \section{Front-matter environments}
  95. There are environments defined for typical sections in the front-matter\footnote{The \emph{front-matter} is everything that goes in the beginning of the thesis, before the page numbered~\emph{1}.}. The most important purpose of providing these environments is that they take care of the table of contents and the \textsc{pdf} bookmarks for you. The environments are \envname{abstract}, \envname{preface}, \envname{acknowledgments}, and \envname{notation}.
  96. The environment \envname{abstract} accepts the language used inside the environment as an optional argument (which defaults to \texttt{english}). If the language is set to \texttt{swedish}, the title of the abstract will be \emph{Populärvetenskaplig sammanfattning}, in accordance with the Linköping University requirements on theses written in English.
  97. Inside the \envname{notation} environment, you can put anything you like, and maybe the \envname{notationtabular} environment provided by \rtthesis suits your needs. In order to define this environment, \rtthesis loads the two packages \styname{array} and \styname{booktabs}, and also defines the command \texcommand{otoprule} to mean the same as \texcommand{toprule}. See \tableref{tab:notationtabular} regarding how to change the look of \envname{notationtabular}.
  98. \begin{table}[tbp]
  99. \centering
  100. \caption{\label{tab:notationtabular}%
  101. Legal option values to the \envname{notation} environment. The options control the look of the \envname{notationtabular} environments used inside the \envname{notation} environment. The initial definition of \envname{notationtabular} is the same as that obtained by passing the option \classoption{new}.}
  102. \begin{tabular}{l p{0.5\linewidth}}
  103. \toprule%
  104. \textbf{Option} & \textbf{Meaning} \\
  105. \otoprule%
  106. \emph{emty} & Do not redefine \envname{notationtabular}. Default.\\
  107. \classoption{old} & Make \envname{notationtabular} produce a plain \LaTeX{} table with double horizontal lines under the table headings, and a vertical line separating the two columns.\\
  108. \classoption{new} & Make \envname{notationtabular} produce a table according to the guidelines in \citet{Mori07Tables} using the \styname{booktabs} package.\\
  109. \bottomrule%
  110. \end{tabular}
  111. \end{table}
  112. There is a class option called \classoption{noextras}, which was intended to inhibit the effect of the \texcommand{maketitle} command, and redefine the front-matter environments to not produce any output. However, the option is not working well at the moment. On the other hand, as the time it takes to compile a thesis on a modern computer is very short, it is rather unclear why someone would like to use this feature anyway.
  113. \section{Abbreviations}
  114. Automatic control is a \LaTeX{}-friendly community. This means that everything you produce is expected to look good. We begin with a basic result.
  115. \begin{theorem}\label{th:abbr-in-sc}
  116. Abbreviations, such as \abbrARMA, look best in small caps.
  117. \begin{proof}
  118. Just compare with “ARMA”.
  119. \end{proof}
  120. \end{theorem}
  121. However, it is important that the small caps match the sorrounding text, compare the statement in the theorem above with the following variation of it, in italics instead of slanted text:
  122. \begin{quotation}
  123. \noindent\textit{Abbreviations, such as \abbrARMA\footnote{This will cause a \LaTeX{} warning.} or {\normalfont\textsc{arma}}, will stick out in a terrible way if you don't watch out!}
  124. \end{quotation}
  125. This is why the \rtthesis class uses slanted text rather than italics in theorems rather when slanted small caps are available.
  126. Unfortunately, \rtthesis does currently not provide a way to make small caps look good in italics, which leads to the following corollary to \theoremref{th:abbr-in-sc}.
  127. \begin{corollary}
  128. One has to make a choice between
  129. \begin{itemize}
  130. \item Beautiful abbreviations using small caps (instead of ordinary upper case).
  131. \item Pretty text typeset in italics (instead of slanted text).
  132. \end{itemize}
  133. \end{corollary}
  134. \section{Definitions}
  135. Let us discuss another theorem-like environment while we have some examples of similar environments to compare with in the previous section. That is, let us discuss the \envname{definition} environment (and the similar environments \envname{assumption} and \envname{remark}). All the theorem-like environments are defined in a separate package, \styname{rtthesis-theorems}, so that they can be used with other document classes as well. The definition below is an example of a definition with a title.
  136. \begin{definition}[Definition]
  137. A \emph{definition} is a precise explanation of the meaning of a word or concept. It may be tempting to include examples in a definition, but a good definition should not depend on examples as part of the definition. However, examples are often useful to clarify a definition, and should appear near the definition.
  138. A short definition may require just a single paragraph, while a more complex definition may require a few paragraphs. Some definitions will also make use of displayed math.
  139. \end{definition}
  140. One problem one has to consider if definitions are not restricted to just one paragraph, is how to show the reader where the definition ends. In theorems, it is common to use italics or slanted text (for brevity, we will not mention italics from here on) to show where the theorem statement ends, but for definitions it may be desirable to use the slanted text to emphasize the word or concept being defined. (It is arguably more clear to highlight the new word or concept using slanted text with upright surrounding text, than vice versa.) To use an upright font for the definitions may also be a way of avoiding to heavy use of slanted text.
  141. Various options related to the appearance of theorem-like things (in \LaTeX{}, a definition is a kind of theorem) are described in \tableref{tab:theorems}. \Tableref{tab:definitions} (used also to illustrate tables) contains some suggestions regarding combinations of options for the \envname{definition} environment and options for paragraph breaks.
  142. \begin{table}[tbp]
  143. \centering
  144. \caption{\label{tab:theorems}%
  145. Class options related appearance of theorem-like environments. The \emph{theorem-like environments} defined by \rtthesis are \envname{theorem}, \envname{proposition}, \envname{lemma}, \envname{corollary}, \envname{definition}, \envname{assumption}, and \envname{remark}. The \emph{definition-like environments} are a subset of the \emph{theorem-like environments}, consisting of the environments \envname{definition}, \envname{assumption}, and \envname{remark}. See also \tableref{tab:fonts} regarding the fonts used in theorems.}
  146. \begin{tabular}{l p{0.5\linewidth}}
  147. \toprule%
  148. \textbf{Class option} & \textbf{Meaning} \\
  149. \otoprule%
  150. \classoption{break} & Put line breaks after the titles of the environments \envname{theorem}, \envname{proposition}, \envname{lemma}, and \envname{corollary}.\\
  151. \classoption{nobreak} & Never put line breaks after titles of theorem-like environments. Default.\\
  152. \midrule%
  153. \classoption{definition=naked} & Definition-like environments look like the surrounding text, and are only isolated by some vertical white space. Default.\\
  154. \classoption{definition=theorem} & Definition-like environments use same font as the \envname{theorem} environment, and are isolated by some vertical white space.\\
  155. \classoption{definition=marks} & Definition-like environments look like the surrounding text, and are isolated by small marks. Strongly recommended if \classoption{parskip} is used.\\
  156. \midrule%
  157. \classoption{nosharecounter} & Use separate numbering sequences for each theorem-like environment and the \envname{example} environment.\\
  158. \classoption{sharecounter} & Use one numbering sequence for theorem-like environments, and the \envname{example} environment.\\
  159. \bottomrule%
  160. \end{tabular}
  161. \end{table}
  162. Sometimes, a definition may be given without a title. The next definition is an example of this, even though it is questionable whether it was a good idea to omit the title in this particular case.
  163. \begin{definition}
  164. An \emph{environment} in \LaTeX{} is a construct that is entered with the command \texcommand{begin\{\ldots\}} and exited with the command \texcommand{end\{\ldots\}}, where “\ldots” should be the name of the environment.
  165. \end{definition}
  166. In \tableref{tab:theorems}, there are three options related particularly to how \envname{definition}, \envname{assumption}, and \envname{remark} are typeset.
  167. \begin{itemize}
  168. \item With \classoption{definition=naked} (default) the definitions are typeset in upright font, and there is nothing on the page that marks the end of the definition.
  169. \item With \classoption{definition=theorem} the definitions are typeset in the same style as theorems. Since theorems are supposed to be typeset in slanted text, this will make it clear where the definition ends.
  170. \item With \classoption{definition=marks} the beginning and end of definitions will be indicated with small marks. Compare how the end of a proof is marked with a square box! The current implementation has some problems with placing the marks if the definition ends with a displayed equation, but this can be compensated for by manual insertion of a \texcommand{vspace} command.
  171. \end{itemize}
  172. You may judge from the following example whether manual insertion of a \texcommand{vspace} command is necessary to make the definition ending with a displayed equation look alright.
  173. \begin{definition}
  174. The factorial (denoted by the postfix operator $!$), defined for natural numbers, is given by
  175. \begin{equation*}
  176. n! =
  177. \begin{cases}
  178. 1, & \text{if $n = 0$} \\
  179. n \cdot (n-1) \cdot \dotsc \cdot 1, & \text{otherwise}
  180. \end{cases}
  181. \end{equation*}
  182. \end{definition}
  183. This paragraph only serves to highlight the vertical white space below the definition ending with a displayed equation. Note that one way to avoid problems with this kind of definitions is to rewrite them so that they don't end with displayed equations.
  184. All definitions in this section have been entered as isolated paragraphs; that is, there is an empty line in the source code of the document before and after each \envname{definition} environment. Although not recommended, \rtthesis supports definitions that are connected with the preceding paragraph, in which case the usual vertical space (if any) between paragraphs will not be inserted. \emph{Be careful so that you don't omit the paragraph breaks by mistakes, since it makes a difference that may be hard for proofreaders to spot!} As an example of a definition written in the same paragraph as the preceding text,
  185. \begin{definition}
  186. A \emph{paragraph} (according to Oxford American Dictionaries) is a distinct section of a piece of writing, usually dealing with a single theme and indicated by a new line, indentation, or numbering.
  187. \end{definition}
  188. There is no paragraph break in the source code between the definition above and this text, but currently this cannot be seen in the typeset document. If you know how to solve this, let the \rtthesis maintainer know! If you want to learn about the \TeX{} mechanisms involved, see \citet{RyckoJackowski93TeXIndentPar}.
  189. \section{Theorem titles}
  190. %
  191. The class lets you control the white space that separates a theorem title from the theorem statement. The options appear in \tableref{tab:theorems}. With the class option \classoption{break} (default), you will get a line break. With \classoption{nobreak}, you will just get horizontal space. Not all types of theorem-like environments will be affected by the \classoption{break} option, so to get things exactly they way you want, you may have to make your own modified copy of the \rtthesis class. Try to recompile the document with the two different options and compare the result!
  192. \section{To share or not to share counters}\label{sec:rtthesis:sharecounter}
  193. %
  194. Other things to think about regarding style include whether to use the same counter for all sorts of theorem-like things. Again, the options appear in \tableref{tab:theorems}. Some like to make the number of important theorems to stand out by having a separate counter (as in \citet{Khalil02NonlinearSystemsBook}), while other prefer to use as few counters as possible in order to make it easy to locate referenced items (as in \citet{Rugh96LinearSystemsBook}). The two alternatives are supported in \rtthesis, via the options \classoption{sharecounter} and \classoption{nosharecounter}.
  195. \section{Completely customized theorem-like environments}\label{sec:rtthesis:custom-theorems}
  196. %
  197. If you don't like the way \rtthesis sets up theorem-like environments (listed in the caption of \tableref{tab:theorems}) for you, you may pass the class option \classoption{notheorems}. Then \styname{amsthm} will not be loaded, none of the theorem-like environments will be defined, and it is up to you to define your own environments. If you decide to do so, using the \styname{amsthm} package will be a good idea.
  198. \section{The \envname{example} environment}
  199. %
  200. The \envname{example} environment defined by the \rtthesis class is \emph{not} a floating environment, but is simply used to highlight that the text inside the environment is just an example of something more general that you have explained before. Just as with the theorem-like environments, the environment is defined in a separate package, \styname{rtthesis-example}, so that it can be used with other document classes as well.
  201. \begin{example}
  202. As an example of the \envname{example} environment, we include a little example here. You can use this example to see how the options described in \sectionref{sec:rtthesis:sharecounter} affects the numbering of the environment.
  203. Depending on where this example ends up in the typeset document, you may also have the chance to see the ugly stretched vertical space that sometimes appears at the top and bottom of the environment.
  204. \end{example}
  205. There are three lengths you may play with the fine tune the appearance of examples, explained in \tableref{tab:example-lengths}. Clearly, it would be possible to introduce additional parameters, but currently the corresponding aspects of the environment are hard-coded into \rtthesis.
  206. \begin{table}[tb]
  207. \centering
  208. \caption{\label{tab:example-lengths}%
  209. The lengths used to control the appearance of the \envname{example} environment. Note that the environment tries to compensate for the current value of \texcommand{parskip}, so you may not always get exactly what you'd expect. Also, the meaning of the distance between the upper stroke and the text is somewhat arbitrary in order to allocate space for the example title.}
  210. \begin{tabular}{>{\small\ttfamily}l p{0.1\textwidth} p{0.4\textwidth}}
  211. \toprule
  212. {\normalsize\normalfont\textbf{Length}} & \textbf{Default} & \textbf{Purpose} \\
  213. \otoprule
  214. $\backslash$exampleLineWidth & $\unit{0.6}{pt}$ & Thickness of the strokes. \\
  215. \midrule
  216. $\backslash$exampleTopBotInnerMargin & $\unit{2}{ex}$ & Vertical space between strokes and contents of the example. \\
  217. \midrule
  218. $\backslash$exampleTopBotOuterMargin & $\unit{1}{em}$ \texttt{plus} $\unit{1}{ex}$ \texttt{minus} $\unit{1}{ex}$ & Vertical space surrounding the example. \\
  219. \bottomrule
  220. \end{tabular}
  221. \end{table}
  222. As is mentioned in the example above, there is sometimes problem with vertical space at the top and bottom of the \envname{example} environment. During the page breaking process (see \sectionref{sec:tipt:page-breaking}) you could consider to add something like
  223. {\verbatimsize
  224. \begin{verbatim}
  225. \vspace{-1\baselineskip}
  226. \end{verbatim}}
  227. to reduce such artifacts. Even better, if you know how to correct this in the definition of the environment, let the \rtthesis maintainer know! The paper \citet{RyckoJackowski93TeXIndentPar} is recommended for anyone interested in the lesser known details of \TeX{} that one has to grasp in order to really solve the problem.
  228. \section{Captions}\label{sec:rtthesis:captions}
  229. %
  230. The \rtthesis class loads the \styname{captions} package to obtain good-looking captions. Captions are set up assuming that table captions will be placed above the table they belong to. Many authors find this confusing since figure captions are always placed below the figure they belong to. If you want to put table captions below the table you need to adjust the spacing around the caption by putting the following line in your personal style file:
  231. {\verbatimsize
  232. \begin{verbatim}
  233. \captionsetup[table]{position=bottom}
  234. \end{verbatim}}
  235. Note that the command above only changes the spacing around the caption. You still have to put the code for each caption relative to the tabular itself consistently with the captions setup. Two tables are included in this document for illustration. \Tableref{tab:definitions} indicates the many combinations of options that the \envname{definition} environment has been designed to work with. The next one, \tableref{tab:chapters} is just a stupid table telling where the different chapters in this document begin. For comparison, a typical automatic control block diagram has been included in \figureref{fig:feedback}.
  236. Some nice guidelines for table creation in \LaTeX{} are given in \citet{Mori07Tables} (it is just two clicks away!).
  237. \begin{table}[p]
  238. \centering
  239. \caption{\label{tab:chapters}%
  240. Different combinations of class options that affects the \envname{definition} environment. The code for this caption appears at the beginning of the \envname{table} environment. It would have had the desired distance to the tabular if the default caption setup of \rtthesis was used, but this document has been set up for table captions below the corresponding tabular.}
  241. \begin{tabular}{c l c}
  242. \toprule%
  243. \textbf{Chapter} & \textbf{Title} & \textbf{Page} \\
  244. \otoprule%
  245. \ref*{cha:intro} & \nameref{cha:intro} & \pageref{cha:intro} \\
  246. \ref*{cha:Research} & \nameref{cha:Research} & \pageref{cha:Research} \\
  247. \ref*{cha:rtthesis} & \nameref{cha:rtthesis} & \pageref{cha:rtthesis} \\
  248. \ref*{cha:boring} & \nameref{cha:boring} & \pageref{cha:boring} \\
  249. \bottomrule%
  250. \end{tabular}
  251. \end{table}
  252. \begin{table}[p]
  253. \centering
  254. \caption{\label{tab:definitions}%
  255. Different combinations of class options that affects the \envname{definition} environment. The code for this caption appears at the end of the \envname{table} environment. It will be too close to the tabular using the default settings of \rtthesis (but note that this document has been setup differently, see \sectionref{sec:rtthesis:captions}).}
  256. \begin{tabular}{>{\bfseries}l c c c}
  257. \toprule%
  258. & \multicolumn{3}{c}{\bfseries\texttt{definition=}} \\
  259. & \bfseries\classoption{naked} & \bfseries\classoption{theorem} & \bfseries\classoption{marks} \\
  260. \otoprule%
  261. \classoption{noparskip} & OK & Avoid & OK \\
  262. \midrule
  263. \classoption{parskip} & Bad & Avoid & OK \\
  264. \bottomrule%
  265. \end{tabular}
  266. \end{table}
  267. \begin{figure}[p]
  268. \centering
  269. \includegraphics{feedback}
  270. \caption{\label{fig:feedback}%
  271. A simple illustration in a floating \envname{figure} environment. Note that figure captions are always placed under the corresponding figure, and hence that the caption code should always appear at the end of the \envname{figure} environment.}
  272. \end{figure}
  273. \section{Hyperlinks}
  274. %
  275. For readers our the electronically published version of your thesis, as well as yourself while your are working on it, it is very convenient to have working hyperlinks in the document.
  276. \subsection{Basic setup}
  277. %
  278. Basically, hyperlinks are obtained by using the \styname{hypreref} package. However, this package has quite a lot of compatibility issues with other packages, and knowledge about how to deal with these issues is coded into the \rtthesis class. That is, all you should have to do to get hyperlinks in your document is to specify the \classoption{hyperref} option to \rtthesis. The class options related to the linking infrastructure of the document are listed in \tableref{tab:hyperref}.
  279. At the time of writing \rtthesis does not call \texcommand{hypersetup} with information about document title, keywords, and other information provided to \texcommand{setupThesis} (see \tableref{tab:setupThesis}). If someone wants this, it shouldn't be hard to do.
  280. \begin{table}[tbp]
  281. \centering
  282. \caption{\label{tab:hyperref}%
  283. Class options related to (hyper) linking infrastructure.}
  284. \begin{tabular}{l p{0.5\linewidth}}
  285. \toprule%
  286. \textbf{Class option} & \textbf{Meaning} \\
  287. \otoprule%
  288. \classoption{hyperref} & Turn on hyperlinks using the \styname{hyperref} package. Default. \\
  289. \classoption{nohyperref} & Turn off hyperlinks, and compensate for commands no longer provided by the \styname{hyperref} package. \\
  290. \midrule%
  291. \classoption{backref} & Turn on bibliography back references. Default. \\
  292. \classoption{nobackref} & Turn off bibliography back references. (Currently required if you plan to use the features of \styname{bibunits}.)\\
  293. \bottomrule%
  294. \end{tabular}
  295. \end{table}
  296. \subsection{Hyperlinks and electronic publishing}
  297. %
  298. To make your dear hyperlinks survive all the way to the electronic publishing system, you may have to replace the file that is sent to e-press by LiU-tryck. The problem is that LiU-tryck creates a compressed version of the file that is used in the printer, and the compression will remove nice features such as page numbers, hyperlinks, and bookmarks. Fortunately, the guys at e-press seem to be understanding and will accept to publish a file that they receive directly from you.
  299. \subsection{Page number formatting in the index}
  300. %
  301. If you use an index in your thesis, you will often want to change the formatting of certain page numbers in the index. Without \styname{hyperref}, this could look like
  302. {\verbatimsize
  303. \begin{verbatim}
  304. hyperlinks\index{hyperlinks|textit}
  305. \end{verbatim}}
  306. to get the page number for this occurrence of \emph{hyperlinks} to be typeset in italics. The problem with this is that this page number will not be a hyperlink, while other page numbers will be hyperlinks to the correct page. To get both italics and a hyperlink you need to define a special index formatting commands like the following.
  307. {\verbatimsize
  308. \begin{verbatim}
  309. \newcommand{\hyperpageit}[1]{\textit{\hyperpage{#1}}}
  310. \newcommand{\hyperpagebf}[1]{\textbf{\hyperpage{#1}}}
  311. \newcommand{\hyperpagefootnote}[1]{\hyperpage{#1}n}
  312. \end{verbatim}}
  313. Now, you can write
  314. {\verbatimsize
  315. \begin{verbatim}
  316. hyperlinks\index{hyperlinks|hyperpageit}
  317. \end{verbatim}}
  318. to get both italics and a hyperlink. The \rtthesis class will provide a trivial definition of \texcommand{chapter} in case \styname{hyperref} is not loaded, so you may safely start to use the above definitions even if you are not sure whether you will use hyperlinks in the end.
  319. \subsection{Friendlier hyperlinks}
  320. %
  321. The default mechanism for references in \LaTeX{}, being the command \texcommand{ref}, is modified as expected by the \styname{hyperref} package. For instance, the number in “chapter~\ref{cha:rtthesis}” is linked to the beginning of the current chapter (if you click it, be sure to just the \emph{jump back} function of your \textsc{pdf} viewer to get back to here!). However, all of “\hyperref[cha:rtthesis]{this}” is also a link to the same place. That is, it is possible to other things than the number itself as links. We could also make a reference that will never be linked, like in “chapter~\ref*{cha:rtthesis}”.
  322. So, what's so friendly about this? What I'm aiming at is that you can say “\hyperref[cha:rtthesis]{chapter~\ref*{cha:rtthesis}}”. The code for this link is
  323. {\verbatimsize
  324. \begin{verbatim}
  325. \hyperref[cha:rtthesis]{chapter~\ref*{cha:rtthesis}}
  326. \end{verbatim}}
  327. Of course, it is very annoying to repeat the key twice; first to point the hyperlink to the correct place, second to show the number of the chapter. With the \texcommand{autoref} command from the \styname{hyperref} bundle, we get “\autoref{cha:rtthesis}”. This is almost perfect. The problem is that one cannot get an uppercase initial at the beginning of a sentence without redefining “chapter” to “Chapter“,
  328. {\verbatimsize
  329. \begin{verbatim}
  330. \renewcommand{\Chaptername}{Chapter}
  331. \end{verbatim}}
  332. but then we will not get the nice lower case initial in the middle of a sentence. Many authors don't bother about this and use uppercase initials irrespectively of where in a sentence the reference appears.
  333. The only solution I (Henrik Tidefelt) knows of, is to define special commands for each type of reference. A basic solution might look as follows.
  334. {\verbatimsize
  335. \begin{verbatim}
  336. \newcommand{\chapterref}[1]{\hyperref[#1]{chapter~\ref*{#1}}}
  337. \newcommand{\Chapterref}[1]{\hyperref[#1]{Chapter~\ref*{#1}}}
  338. \end{verbatim}}
  339. You should then use \texcommand{chapterref} in the middle of a sentence, and \texcommand{Chapterref} at the beginning of a sentence. I you later decide that you want to have upper case initials everywhere, you just have to change your definitions to
  340. {\verbatimsize
  341. \begin{verbatim}
  342. \newcommand{\chapterref}[1]{\hyperref[#1]{Chapter~\ref*{#1}}}
  343. \newcommand{\Chapterref}[1]{\hyperref[#1]{Chapter~\ref*{#1}}}
  344. \end{verbatim}}
  345. A more complete solution will also provide commands for the plural forms “chapters” and “Chapters”.
  346. It is also nice to use a similar technique for page references. For instance, this chapter starts on \hyperref[cha:rtthesis]{page~\pageref*{cha:rtthesis}}, and such links can be created easily using a command like
  347. {\verbatimsize
  348. \begin{verbatim}
  349. \newcommand{\pagepageref}[1]{\hyperref[#1]{page~\pageref*{#1}}}
  350. \end{verbatim}}
  351. Because of the many possible preferences for how to handle labels and references within documents, \rtthesis does not define any related commands. The current section should give you some ideas of what can be achieved, and now it is up to you to design your own solution or borrow a solution from someone else (or simply stick with \texcommand{autoref} or the 1980's way of doing things)!
  352. \section{Backreferences from the bibliography}
  353. %
  354. By default, \rtthesis uses the \styname{backref} package to put references from the bibliography back into the text. The options for turning this feature on and off are listed in \tableref{tab:hyperref}.
  355. By controlling this feature via the class, the choice whether to use it or not can be made orthogonal to the choice of whether to use \styname{hyperref} or not.
  356. In addition to just loading \styname{backref}, \rtthesis will do a basic setup of the commands used to typeset the list of page numbers for each reference. This behavior can easily be redefined without modifying the \rtthesis class file. See the \styname{backref} documentation for details on how to do this!
  357. \section{Using the \styname{bibentry} package}\label{sec:rtthesis:bibentry}
  358. %
  359. The \styname{bibentry} package makes it possible to use the information in the bibliography to present your publications at any place in the document. In order to work independently of whether you use back references from the bibliography or not, you need to follow the pattern below each time you use the \texcommand{bibentry} command, where \texttt{KEY} is the same key to you publication that you would with use with any other citation command.
  360. \begin{minipage}{1.0\linewidth}
  361. \verbatimsize
  362. \begin{verbatim}
  363. \begin{quotation}
  364. \nocite{KEY}\noindent
  365. \backrefparscanfalse\bibentry{KEY}.\backrefparscantrue
  366. \end{quotation}
  367. \end{verbatim}
  368. \end{minipage}
  369. To use the \envname{quotation} environment is just a suggestion — it will make the reference stand out by using a some what shorter text line width. Note the period that follows the \texcommand{bibentry} command — the command leaves it up to you how to terminate the entry. The \texcommand{nocite} command ensures that the reference appears in the bibliography, which is necessary to produce the entry. The \texcommand{noindent} commands simply prevents the first line in the \envname{quotation} from being indented. The commands \texcommand{backrefparscanfalse} and \texcommand{backrefparscantrue} are related to the \styname{backref} package used to produce back references from the bibliography, and should always surround the \texcommand{bibentry} command. In case you have turned back references off using the \classoption{nobackref}, \rtthesis will provide substitutes for these two commands.
  370. \section{Fonts}
  371. %
  372. Though basically not a task for a \LaTeX{} class, \rtthesis will assist in loading some font packages. There are some class options that control this behavior, described below, and if these options are not good enough for you, you may have to make your own copy of the class and replace the font packages you don't like. Options for font selection are listed in \tableref{tab:fonts}.
  373. One reason, however, for letting \rtthesis handle the font selection is that this makes it possible for the class to do some things more intelligently. At the moment, \rtthesis will help you make use of some of the goodies of KpFonts, if you choose to use that font.
  374. \begin{table}[tbp]
  375. \centering
  376. \caption{\label{tab:fonts}%
  377. Class options related to fonts. When slanted small caps are activated, theorem-like environments will use slanted text instead of italics. The lower part of the table are examples of options that will be understood by the \styname{kpfonts} package, and are only meaningful in combination with the \classoption{kp} option. (Note that options passed to \rtthesis, but that are not understood by \rtthesis will be passed on automatically by \LaTeX{} to loaded packages.)}
  378. \begin{tabular}{l p{0.5\linewidth}}
  379. \toprule%
  380. \textbf{Class option} & \textbf{Meaning} \\
  381. \otoprule%
  382. \classoption{kp} & Use KpFonts (Kepler) and activate slanted small caps. Default.\\
  383. \classoption{times} & Use Times and deactivate slanted small caps.\\
  384. \classoption{lm} & Use Latin Modern and deactivate slanted small caps.\\
  385. \midrule%
  386. \classoption{largesmallcaps} & Let the small caps be slightly higher than an \emph{x}. See the KpFonts documentation!\\
  387. \classoption{intlimits} & Placement of integration limits. See the KpFonts documentation!\\
  388. \classoption{widermath} & Put just a little more horizontal space between entities in math mode. See the KpFonts documentation!\\
  389. \bottomrule%
  390. \end{tabular}
  391. \end{table}
  392. \section{Hanging punctuation}
  393. %
  394. The \rtthesis class automatically loads the \styname{pdfcprot} package with its default settings. It uses a pdf\TeX{} feature to make punctuation hang into the right margin. If you don't like it, make your own copy of the class and comment out the line that loads the package. One reason not to use it would be if your document will be (perhaps only occasionally) typeset using the old \TeX{} program, since this will lead to noticeable differences in the line breaks compared to when pdf\TeX{} is used. No matter what you choose, make your choice \emph{before} you start working with the page breaks in your document!
  395. \section{Paragraph breaks}
  396. %
  397. There are two common ways of visualizing paragraph breaks in a document, illustrated by the two examples below. The look of paragraph breaks is controlled using the class options listed in \tableref{tab:parskip}.
  398. \begin{table}[tbp]
  399. \centering
  400. \caption{\label{tab:parskip}%
  401. Class options related to formatting of paragraph breaks.}
  402. \begin{tabular}{l p{0.5\linewidth}}
  403. \toprule%
  404. \textbf{Class option} & \textbf{Meaning} \\
  405. \otoprule%
  406. \classoption{noparskip} & US style, see \exampleref{ex:paragraph-break-noparskip}. Default.\\
  407. \classoption{parskip} & European style, see \exampleref{ex:paragraph-break-parskip}.\\
  408. \bottomrule%
  409. \end{tabular}
  410. \end{table}
  411. % \begin{example}[Default text]
  412. % This example does not mess with the lengths controlling the paragraph break format. But you bet it ends in vmode!
  413. % \end{example}
  414. % It is good to see what it looks like if one puts text just below an example.
  415. % \begin{example}[Default text]
  416. % This example does not mess with the lengths controlling the paragraph break format. This one ends in hmode!
  417. % \end{example}
  418. \begin{example}[Indented first line]\label{ex:paragraph-break-noparskip}%
  419. \setlength{\parskip}{0pt}%
  420. \setlength{\parindent}{1.5em}%
  421. This style is still the most common. It is particularly dominant in text written in the US.
  422. It is a matter of style whether to omit the indentation of the first line after a sectioning command such as \texcommand{chapter} or \texcommand{subsection}. The omission is typically automated, but can also be enforced using the \texcommand{noindent} command.
  423. One drawback of not having vertical space between paragraphs is that it will be harder for pdf\TeX{} to find good places for page breaks, compared to the option shown below. If you like compact documents, however, this is the option for you!
  424. For testing purposes, this example ends with a paragraph break, so that \TeX{} is in \emph{vmode} at the end. You should always avoid this, but the class will try to compensate for your mistakes\ldots
  425. \end{example}
  426. \begin{example}[Vertical white space]\label{ex:paragraph-break-parskip}%
  427. \setlength{\parskip}{1ex}%
  428. \setlength{\parindent}{0pt}%
  429. This style is still increasing in popularity. It is rather common in modern texts written in Europe, and the style has received special attention from the Netherlands \TeX{} user group \emph{Nederlandstalige \TeX{} Gebruikersgroep, \textsc{ntg}}. Their efforts can be used through their variants of the standard \LaTeX{} classes.
  430. Unfortunately, the \textsc{ntg} classes are not compatible with \rtthesis, and the solution provided by the \styname{parskip} package is only part of the solution. Hence, \rtthesis will do more than just loading the \styname{parskip} package for you if you specify the \classoption{parskip} option.
  431. A good reason to put code related paragraph breaks in the class file is that all the small adjustments that different people come up with can be put in one placed so that they are accessible to future users of the class.
  432. \end{example}
  433. \section{Page breaks}\label{sec:tipt:page-breaking}
  434. %
  435. There is a whole lot to say about how to obtain nice page breaks. You will find some recommendations below, but do not use this document as your ultimate reference on this topic! (This document itself contains some really nasty page breaks --- at least at the time of writing this --- as a result of not paying any attention at all to the problem. It would simply bee too time-consuming to keep adjusting the page breaks each time the document is edited.)
  436. \begin{itemize}
  437. \item
  438. Take no consideration of page breaks until page breaking is the only aspect of your thesis that remains to be taken care of! Page breaking involves a lot of manual intervention of the automatic mechanisms in pdf\TeX{}, and as soon as you have started to intervene, any further changes to the text will risk to ruin your page breaking fixes, and may even lead to worse results than before since the automatic page breaking has been tampered with.
  439. \item
  440. First thing to try is to make changes to the text to help the automatic page breaking mechanism. Try to make sentences longer or shorter depending on the situation. Since this will not tamper with the automatic page breaking mechanism, this option will incur the least loss of maintainability of your document.
  441. \item
  442. Can the location of floats be changed to improve page breaks? Play around with exactly where in your source files the code for the floating environments appears!
  443. \item
  444. You may also try to force early page breaks using the \texcommand{Needspace*} command. For instance, putting
  445. {\verbatimsize
  446. \begin{verbatim}
  447. \Needspace*{2\baselineskip}
  448. \end{verbatim}}
  449. before a paragraph will cause a page break if there is not enough vertical space on the page to hold two lines of text. The good thing about this option is that your intervention will cause no harm if the \texcommand{Needspace*} command appears in the middle of a page. The bad thing about this option is that it may cause remaining vertical space on the broken page to be stretched quite badly. You should always check that the resulting page looks OK!
  450. For more information, and related commands, see the documentation for the \styname{needspace} package!
  451. \item
  452. The last option is to play with the vertical size of individual pages. For instance, putting
  453. {\verbatimsize
  454. \begin{verbatim}
  455. \enlargethispage{2\baselineskip}
  456. \end{verbatim}}
  457. before a paragraph you would like to fit into the current page will make space for two extra lines of text. This avoids the bad stretching of vertical space that the \texcommand{Needspace*} option may cause. However, if you would make other changes that makes tampering with the page size unnecessary, it will be very time-consuming to detect this and remove the no longer needed \texcommand{enlargethispage} command.
  458. \end{itemize}
  459. Note that manual page breaking is a time-consuming task. Make sure to have at least one full day allocated to page breaking before you submit your thesis for print!
  460. \section{Input encoding}
  461. %
  462. Two input encodings are supported, being \mbox{latin-1} and \mbox{\textsc{utf}-8}. The choice of input encoding should be made via the \rtthesis class, so that the class can use the correct encoding to define certain global strings. The input encoding options are listed in \tableref{tab:inputenc}.
  463. \begin{table}[tbp]
  464. \centering
  465. \caption{\label{tab:inputenc}%
  466. Class options related to input encodings. Note that there is no default; \rtthesis requires one of these options to be passed explicitly.}
  467. \begin{tabular}{l p{0.5\linewidth}}
  468. \toprule%
  469. \textbf{Class option} & \textbf{Meaning} \\
  470. \otoprule%
  471. \classoption{latin1} & Simply use \styname{inputenc} with option \classoption{latin1}. \\
  472. \classoption{utf8} & Use \styname{inputenc} with option \classoption{utf8}, and define some additional characters. \\
  473. \bottomrule%
  474. \end{tabular}
  475. \end{table}
  476. Choose \mbox{latin-1} if you depend on lots of files using this encoding, and do not want to change the encoding of these files. Changing the encoding of a file is easy both in Emacs and using the \emph{iconv} command line utility. The \mbox{latin-1} encoding is the default in \rtthesis, but the choice can be made explicit by passing the \classoption{latin1} option to the class.
  477. Choose \mbox{\textsc{utf}-8} to be able to type many more characters directly in your \LaTeX{} sources compared to \mbox{latin-1}. For instance, names of foreign authors often use characters that cannot be entered directly using \mbox{latin-1}. In \mbox{\textsc{utf}-8}, most of these as well as special punctuation characters such as double quotes and various dashes can be entered directly in the source. Use the \classoption{utf8} class option if your files are encoded in \mbox{\textsc{utf}-8}.
  478. The current implementation of \mbox{\textsc{utf}-8} in the \styname{inputenc} package only defines the input encoding for characters that have corresponding glyphs in active fonts (see the \styname{inputenc} documentation for details). This means that some characters that \TeX{} would build by combining several glyphs will not be defined by \styname{inputenc}. If the \classoption{utf8} is given, \rtthesis will define a list of additional characters by inclusion of the package \styname{rtthesis-utf8-ext}. If you need additional characters, you should make your own package similar to \styname{rtthesis-utf8-ext}, and then let the maintainer of \rtthesis know, so that the additional characters may be added to \styname{rtthesis-utf8-ext} so that others can use them in the future. Note that \styname{rtthesis-utf8-ext} may be a useful package also when you are not using the \rtthesis class.
  479. It is easy to set up Emacs so that it uses the \mbox{\textsc{utf}-8} encoding for your \TeX{} files, but it is out of the scope of the current document to give further explanations here.
  480. \section{\rtthesis and \styname{natbib}}
  481. %
  482. Interoperability with different bibliography packages is a tricky issue. It has been a design decision to try to support at least \styname{natbib}, at the cost of loosing compatibility with other packages such as \styname{jurabib}. The core of the problem is package loading order, requiring \styname{natbib} to be loaded very early on in the class. To pass options to \styname{natbib}, pass them as global class options to \rtthesis. Note that the default options for \styname{natbib} are quite reasonable, and see \tableref{tab:natbib} for examples of other options that \styname{natbib} will pick up. If you know how to resolve the conflict with the \styname{natbib} option \classoption{usebibunits}, let the \rtthesis maintainer know!
  483. \begin{table}[tbp]
  484. \centering
  485. \caption{\label{tab:natbib}%
  486. Class options related to the \styname{natbib} package. Note that options can be passed to \styname{natbib} by passing them as global class options to \rtthesis. See the \styname{natbib} documentation for more useful options.}
  487. \begin{tabular}{l p{0.5\linewidth}}
  488. \toprule%
  489. \textbf{Class option} & \textbf{Meaning} \\
  490. \otoprule%
  491. \classoption{authoryear} & Default option of \styname{natbib} --- no need to specify.\\
  492. \classoption{round} & Default option of \styname{natbib} --- no need to specify.\\
  493. \classoption{colon} & Default option of \styname{natbib} --- no need to specify.\\
  494. \midrule%
  495. \classoption{square} & Example of option that \styname{natbib} will pick up (alternative to \classoption{round}).\\
  496. \classoption{comma} & Example of option that \styname{natbib} will pick up (alternative to \classoption{colon}).\\
  497. \midrule%
  498. \classoption{numbers} & Conflicting \styname{natbib} option --- forbidden in combination with \classoption{usebibunits}, see \classoption{forcenumbers} below.\\
  499. \classoption{forcenumbers} & Enforce option \classoption{numbers} to be passed to \styname{natbib} (alternative to \classoption{authoryear}) --- it's up to you to resolve the conflict.\\
  500. \bottomrule%
  501. \end{tabular}
  502. \end{table}
  503. \section{The lists of previous theses}
  504. %
  505. The lists of previous licentiate's and PhD theses can be found in \textfilename{liclist.tex} and \textfilename{phdlist.tex}, respectively, and the appropriate one of the is automatically included at the end of your thesis. Both files are found in the directory\\
  506. \textfilename{\$TEXMFGROUPLOCAL/tex/latex/rt/rtthesis} .
  507. Note that it is \emph{your responsibility} to make sure that your thesis is added to the appropriate list after you have sent it to print but before the next thesis of the same kind is printed. If other people are writing theses at the same time as you, you will have to coordinate your moves in order to make sure that the lists get updated in the correct order. To get your thesis added to the appropriate list, you simply send an email with information about your thesis to the \rtthesis maintainer. The information shall be in one of the following formats:
  508. {\verbatimsize
  509. \begin{verbatim}
  510. \licitem{J.~Doe}{Title}{Thesis No}{YYYY}
  511. \end{verbatim}}
  512. or
  513. {\verbatimsize
  514. \begin{verbatim}
  515. \phditem{J.~Doe}{Title}{Theis No}{YYYY}{ISBN}
  516. \end{verbatim}}
  517. It is a good idea to make a copy of the file you need when it is time to print. If you don't make a copy, and then compile your thesis again at a later time, the list will be wrong because it will include at least one thesis that wasn't prior to yours — namely your own!
  518. \section{Compilation theses}
  519. %
  520. The \rtthesis class aims to support the production of both monographs and compilation theses. There is a compilation thesis example included with \rtthesis. Please have a look at that while reading the sections below!
  521. \subsection{Including publications in your thesis}
  522. %
  523. It is assumed that included publications shall be compiled together with the rest of your thesis, as opposed to being included as exactly the way the look where published. Under this assumption, it is reasonable to expect things such as a suitable chapter numbering, and that the global table of contents includes the sections withing publications. Note that it would be rather difficult to get things such as the table of contents and other infrastructure right if publications were to be included by direct \textsc{pdf} inclusion.
  524. The \envname{papers} environment provided by \rtthesis will redefine commands and set up some additional commands to support the inclusion of \LaTeX{} sources of your publication. It is recommended that the environment is placed in a second part of the thesis. Inside the environment, the \texcommand{chapter} command is redefined to both start a new chapter and set up the title of the publication to be included in the same chapter. Chapters will be labeled with letters instead of numbers, so it is up to you to make a clear distinction between referencing an appendix chapter and a publication chapter.
  525. If the title of a publication is too long to fit in the page header, you may follow the \texcommand{chaptermark} command by a \texcommand{chaptermark} command. Since the \texcommand{chaptermark} command takes an optional argument to be used in the table of contents, there are three different variations of the publication title that can be defined.
  526. The word for publications used by \rtthesis is \emph{paper}; it will appear both on the chapter title page and in page headers. To change this to something else, you simply have to redefine \texcommand{chaptername} to something else inside the \envname{papers} environment.
  527. After setting up the publication title, the \texcommand{author} command should be used to set up the list of authors. It works as usual, but sports two special \rtthesis commands that should be used when there are two author affiliations; put \texcommand{authorleft} immediately after author names who's affiliation should appear to the left below the list of authors, and put \texcommand{authorright} after the other authors. There is currently no support for more than two different affiliations.
  528. In case there is only one affiliation, that affiliation is given by \texcommand{paperaffiliation} (which should be set once and for all to your own affiliation), and you use the \texcommand{email} command to specify the list of email addresses to the authors.
  529. In case of two affiliations, you call the commands \texcommand{affilblockleft} ,\texcommand{affilblockright}, \texcommand{emailleft}, and \texcommand{emailright} with the appropriate arguments. Note that one of the two affiliation block arguments should simply be \texcommand{paperaffiliation}.
  530. Additional information about the publication is given in after \texcommand{item} commands inside the \envname{paperinfo} environment. In addition to the items given, the environment automatically starts with one item displaying the author information (without any marks related to affiliation blocks). Three commands are defined by \rtthesis to simplify consistent formatting of additional information.
  531. \begin{itemize}
  532. \item \texcommand{paperedited{\emph{bib-key}}} — For ordinary publications. The extent to which the publication has been edited should be state clearly. The bibliography entry will be formatted using the technique described in \sectionref{sec:rtthesis:bibentry}.
  533. \item \texcommand{paperprelver{\emph{ISY-report-number}}} — For publications for which there is only a preliminary version available. The preliminary version should be published as a technical report at the department, and as no bibliography keys are involved, the technical report will not be listed in any the bibliography.
  534. \item \texcommand{papertechrep{\emph{ISY-report-number}}} — For publications that are not yet even preliminary versions of something. These too should be published as technical reports at the department, and will not appear in the bibliography.
  535. \end{itemize}
  536. At this point the chapter title page will be finished. The next step is to make a nice title and abstract for your publication on the following odd page. Use \texcommand{maketitle} or \texcommand{maketitletwoaffil} depending on whether you set up one or two affiliation blocks. Then put the publication abstract inside the \envname{abstract} environment.
  537. After this point, you should just be able to include the source of your publication, with \texcommand{section} as the topmost sectioning command (since the publication itself is a chapter of your thesis).
  538. Finally, you must decide where your references should go. Should there be one global bibliography for the whole thesis, or should there be one bibliography for each publication. This is the topic of the next section.
  539. \subsection{Compilation theses and bibliographies}
  540. %
  541. If you are fine with having just one global bibliography for the whole thesis, everything should work out of the box. Hence, this section will try to describe how to do in order to get one bibliography for the background part of your thesis, and one for each publication.
  542. The \rtthesis class only supports this by relying on the \styname{bibunits} package. Due to package loading order issues, it should always be loaded by passing \classoption{usebibunits} to \rtthesis. Note that some of the \styname{bibunits} commands appears to be incompatible with bibliography back references, so you need to pass the \classoption{nobackref} to \rtthesis if you plan to use the \styname{bibunits} features.
  543. \begin{remark}
  544. There is a very interesting package called \styname{biblatex} which is currently in beta version. Hopefully, it will let us drop the messy packages \styname{bibunits} and \styname{backref}. You are invited to try this package, and if you find it to work satisfactory it should probably be incorporated in \rtthesis. Future maintainers of \rtthesis are strongly encouraged to find out what \styname{biblatex} can do for us!
  545. \end{remark}
  546. Use the command \texcommand{defaultbibliography} to specify the bibliography files to use for all of the per-publication bibliographies, and use \texcommand{defaultbibliographystyle} to select the bibliography style, see the \styname{bibunits} documentation for details.
  547. To get an individual bibliography for a publication, you should just have to include that chapter in a \envname{bibunit} environment, and call \texcommand{putbib} where you want the bibliography to appear. Here, the \texcommand{putbib} command will be redefined by \rtthesis in order to make the bibliography appear in the table of contents.
  548. A bibliography for references that appear in the background part of your thesis are produced as usual with the \texcommand{bibliography} command. (It might be good to know that \rtthesis will automatically issue the \texcommand{nobibliography*} command in order to make the \styname{bibentry} package work as you would expect.)
  549. \section{Master's theses}\label{sec:msc}
  550. %
  551. The \styname{liuthesis} class by Gustaf Hendeby was developed for the production of master's theses at Linköping University. The class knows how to create the special pages required by several departments, and in the summer of 2011 this capability was merged into \rtthesis. This makes it convenient to produce a master's thesis at Linköping University using \rtthesis instead of \styname{liuthesis}, allowing a wider audience to benefit from the more active development of \rtthesis.\footnote{The \LaTeX{} class files tend to be maintained by PhD students, and PhD students have a tendency to be more interested in maintaining the class files for writing licentiate's and PhD theses than class files for master's theses.}
  552. This section describes how to use \rtthesis to produce a master's thesis. To begin, pass \emph{msc} as the value for the key \emph{type} in the call to \texcommand{setupThesis}, and select your department using the key \emph{department}. More details are given below, and the reader is encouraged to study the bundled example in order to get a better overall picture.
  553. \subsection{Master's thesis setup}
  554. %
  555. In addition to the pieces of information given to \texcommand{setupThesis} for licentiate's and PhD theses (see \tableref{tab:setupThesis}), there are some that only apply to master's theses. These are listed in \tableref{tab:setupThesis-msc}.
  556. \begin{table}[tbp]
  557. \centering
  558. \caption{\label{tab:setupThesis-msc}%
  559. \texcommand{setupThesis} key-value pairs for master's theses, in addition to those listed in \tableref{tab:setupThesis}. Note that values that include white space are surrounded by braces.}
  560. \begin{tabular}{>{\ttfamily}r !{\texttt{=}} >{\ttfamily}l l}
  561. \toprule%
  562. \textbf{Key} & \textbf{Example value} & \textbf{Comment} \\
  563. \otoprule%
  564. swetitle & \{Svensk titel\} & Title in Swedish\\
  565. swesubtitle & \{Bra grejer\} & Optional Swedish subtitle\\
  566. month & 4 & \\
  567. day & 9 & \\
  568. subject & reglerteknik & \\
  569. site & \{Bosses AB i Linkan\} & \\
  570. division & \{Avdelningenrt\ldots\} & \\
  571. department & isy & See \tableref{tab:department} \\
  572. examiner & \{Lena Lärare\ldots\} & Details given below \\
  573. supervisor & \{Doktorand Si\} & Details given below \\
  574. keywords & \{this, that\} & Appears on library page \\
  575. isrn & LiTH-ISY-EX\ldots & See below \\
  576. url & \{http://\ldots\} & Thesis download \textsc{url}, see below \\
  577. \bottomrule%
  578. \end{tabular}
  579. \end{table}
  580. The value for the key \emph{department} must be one of the special values listed in \tableref{tab:department}. This setting controls both the department name and address, as well as how the special pages of the thesis are formatted. Please help the \rtthesis maintainer to keep the special pages for your department up to date.
  581. In the values for the keys \emph{examiner} and \emph{supervisor}, multiple persons should be separated using \texcommand{AND}, and the affiliation of a person should appear after \texcommand{AT}, like this:
  582. {\verbatimsize
  583. \begin{verbatim}
  584. supervisor={Doktorand Si \AT \textsc{isy}, Linköpings universitet
  585. \AND Ingenjör Så \AT Företaget},
  586. \end{verbatim}}
  587. The \textsc{isrn}\footnote{The \textsc{iso} standard for \textsc{isrn} was withdrawn in 2007, but the report numbering system is still in use at Linköping University.} should be something like
  588. {\verbatimsize
  589. \begin{verbatim}
  590. isrn=LITH-ISY-EX-{}-YY/NNNN-{}-SE
  591. \end{verbatim}}
  592. but the format varies between different departments. Note that if the report identifier contains two or three consecutive dashes, they have to be separated by empty braces in the input to prevent \LaTeX{} from interpreting them as one character. The thesis download \textsc{url} should be something like
  593. {\verbatimsize
  594. \begin{verbatim}
  595. url={http://urn.kb.se/resolve?urn=urn:nbn:se:liu:diva-XXXXX}
  596. \end{verbatim}}
  597. The exact details regarding the report number and \textsc{url} will be given to you by the librarian when you register your thesis.
  598. \begin{table}[tbp]
  599. \centering
  600. \caption{\label{tab:department}%
  601. Recognized values for the key \emph{department} in \tableref{tab:setupThesis-msc}.}
  602. \begin{tabular}{>{\ttfamily}c p{0.45\linewidth} l}
  603. \toprule%
  604. \textbf{department} & \textbf{Department of\ldots} & \textbf{Updated}\\
  605. \otoprule%
  606. ida & Computer and Information Science & Not after 2008-08-01\\
  607. ifm & Physics, Chemistry and Biology & 2011-07-03\\
  608. iei & Management and Engineering & \emph{Out of date!}\\
  609. isy & Electrical Engineering & 2011-07-03\\
  610. itn & Science and Technology & 2011-07-03\\
  611. mai & Mathematics & 2011-07-03\\
  612. \bottomrule%
  613. \end{tabular}
  614. \end{table}
  615. \subsection{Special pages}
  616. %
  617. The requirements on a master's thesis include that certain information go on the front page and title page of the thesis. Further, a library page for cataloging purposes is required at the beginning of the thesis, and a page with copyright information is required at the end. The copyright page is automatically added at the end. The other special pages can be produced using the macros \texcommand{makeFrontPage}, \texcommand{maketitle} (as usual), and \texcommand{makeLibraryPage}. These macros are meant to be invoked more or less immediately after \texcommand{begin\{document\}}, see the bundled example for details. Note that in the printed report, the front page should be replaced by the cover, and the library page is \emph{probably} meant to be on a loose piece of paper inserted between the cover and the title page.
  618. There is no magic that puts the correct abstract on the library page, but the abstract must be given as an argument to \texcommand{makeLibraryPage}. To make sure that this is exactly the same as the abstract in the thesis, it is recommended that you write the abstract text without any surrounding \envname{abstract} environment in a separate file, say \textfilename{svensk-sammanfattning.tex}. Then you can use this file twice, like this:
  619. {\verbatimsize
  620. \begin{verbatim}
  621. \makeLibraryPage{\input{svensk-sammanfattning}}
  622. \begin{abstract}[swedish]
  623. \input{svensk-sammanfattning}
  624. \end{abstract}
  625. \end{verbatim}}
  626. (The bundled example uses this technique.)
  627. \subsection{Choice of language}
  628. %
  629. If your main report language will be Swedish, put
  630. {\verbatimsize
  631. \begin{verbatim}
  632. \selectlanguage{swedish}
  633. \end{verbatim}}
  634. right after
  635. {\verbatimsize
  636. \begin{verbatim}
  637. \begin{document}
  638. \end{verbatim}}
  639. Also make sure to provide the thesis title (and possibly subtitle) in Swedish via the keys \emph{swetitle} and \emph{swesubtitle} to \texcommand{setupThesis}. You may then omit writing an abstract in English.
  640. If your main report language will be English you don't need to change the default choice of language. However, you must provide a thesis title both in English and Swedish, and the thesis should contain abstracts in both English and Swedish.
  641. \section{Compiling the document}
  642. %
  643. Using all the current features of \rtthesis, the following sequence of steps is usually sufficient to compile your document. Let us assume your main file is named \textfilename{main.tex}.
  644. \begin{itemize}
  645. \item
  646. First run
  647. {\verbatimsize
  648. \begin{verbatim}
  649. pdflatex main
  650. \end{verbatim}}
  651. to scan your document for references, labels, and index items.
  652. \item
  653. Then run
  654. {\verbatimsize
  655. \begin{verbatim}
  656. bibtex main
  657. \end{verbatim}}
  658. to extract relevant references from your bibliography file(s). If you are using the \styname{bibunits} package, you also have to process some additional files;
  659. {\verbatimsize
  660. \begin{verbatim}
  661. bibtex bu1; bibtex bu2; ...; bibtex bun
  662. \end{verbatim}}
  663. \item
  664. If you have an index in your document, run
  665. {\verbatimsize
  666. \begin{verbatim}
  667. makeindex main
  668. \end{verbatim}}
  669. to format it.
  670. \item
  671. Then run
  672. {\verbatimsize
  673. \begin{verbatim}
  674. pdflatex main
  675. \end{verbatim}}
  676. to insert references in the typeset document. This will typically move things around, and your page references will be invalidated.
  677. \item
  678. Hopefully, it is enough to run
  679. {\verbatimsize
  680. \begin{verbatim}
  681. pdflatex main
  682. \end{verbatim}}
  683. once more now to get the page references right. You will get a warning if you need to repeat this step.
  684. \end{itemize}
  685. In addition to the steps above, certain auxiliary files must be deleted when certain features of the class are turned on or off. In particular, turning hyperlinks on or off requires the following.
  686. {\verbatimsize
  687. \begin{verbatim}
  688. rm main.aux main.toc main.ind
  689. \end{verbatim}}
  690. \section{Generating a thesis cover and the “spikblad”}
  691. %
  692. A thesis cover can be created by making a file that contains the \texcommand{makecover} command. For example, given that \textfilename{mythesis.sty} invokes the \texcommand{setupThesis} command with the necessary information (see \tableref{tab:setupThesis}), a PhD thesis cover can be made as follows.
  693. \begin{minipage}{1.0\linewidth}
  694. \verbatimsize
  695. \begin{verbatim}
  696. \documentclass[utf8,phd]{rtthesis}
  697. \usepackage{mythesis}
  698. \makecover
  699. \end{verbatim}
  700. \end{minipage}
  701. Note that while all licentiate's theses should have the same cover, there is no standard (but many rules set by the university!) for the PhD theses. The \texcommand{makecover} command gives a “classic” cover that quite a few people have used over the years. This cover might also be useful as a means to compile the information needed when LiU-Tryck (or some other printing company) designs a more artistic cover.
  702. For a dissertation, there should always be a “spikblad” (literally, \emph{nailing sheet}). Such an information sheet can be generated easily if the English abstract is put in a separate file. In this case, the same abstract can be included both in the thesis and in a separate file that defines the “spikblad”. For a licentiate's thesis presentation, a similar information sheet should be produced. The monograph example demonstrates how to created these, see the files \textfilename{spikblad.tex} (for dissertations) and \textfilename{licinfo.tex} (for licentiate's thesis presentations).
  703. \section{Required logotypes (not included with \rtthesis)}
  704. %
  705. \Tableref{tab:logos} lists files with logotype graphics that are needed by \rtthesis. They are not part of the \rtthesis bundle since they are used in many other contexts as well. Users at the Division of Automatic Control should have access to these files via the group's common texmf tree, but in order to be able to work at home you will have to make sure one way or another that the files are installed.
  706. Beware that the university changes logos quite often. Make sure that there are no new versions of the logos you use. If the logos are old, please, let the \rtthesis maintainer know so that the files get updated at the central location.
  707. \begin{table}[tbp]
  708. \centering
  709. \caption{\label{tab:logos}%
  710. Files with logotype graphics used by \rtthesis. Use the command \texttt{kpsewhich} to find where the files are located!}
  711. \begin{tabular}{l p{0.5\linewidth}}
  712. \toprule%
  713. \textbf{Filename} & \textbf{Use} \\
  714. \otoprule%
  715. \textfilename{LinkUniv\usc{}sigill\usc{}sv.pdf} & For the cover and the first page in PhD theses.\\
  716. \textfilename{LiTH\usc{}staende\usc{}eng\usc{}sv.pdf} & For the cover of both licentiate's and PhD theses.\\
  717. \textfilename{rtlogo\usc{}tall.pdf} & For the first page in licentiate's theses.\\
  718. \bottomrule%
  719. \end{tabular}
  720. \end{table}
  721. \section{Compatibility with standard packages}
  722. %
  723. Incompatibilities between different packages is a problem that quickly becomes quite an issue when the list of packages used in a document grows beyond just a few. It may sound strange, but it is because of compatibility problems that \rtthesis includes a rather long list of packages for you. The reason is that this allows knowledge about package loading order requirements and various workarounds, to be encoded in the class file.
  724. No list of packages included by \rtthesis will be presented here, but you should check the class file directly to be sure that you always get the correct answer to whether a package is included or not (or you can just read the compilation output).
  725. Packages with no known compatibility issues will generally not be included by \rtthesis unless needed by the class itself. The following list contains some examples of useful packages that are not included by \rtthesis. They \emph{should} be compatible with \rtthesis. Please let the \rtthesis maintainer know if any of these are no longer compatible, or if you have suggestions for other packages that should be mentioned here.
  726. \begin{itemize}
  727. \item \styname{nextpage} — page break control
  728. \item \styname{algorithm} — code listings
  729. \item \styname{listings} — code listings
  730. \item \styname{SIunits} — physical dimensions
  731. \item \styname{pmat} — partitioned matrices
  732. \item \styname{bm} — bold math
  733. \item \styname{footmisc} — extras for footnotes
  734. \item \styname{dcolumn} — decimal point alignment in tables (the already included \styname{array} can also do this)
  735. \item \styname{lettrine} — start chapter with fancy letter
  736. \item \styname{supertabular} — multi-page tables
  737. \item \styname{longtable} — multi-page tables
  738. \item \styname{multirow} — tabular entries occupying more than one row
  739. \end{itemize}