IntroductionAndTemplate.tex 55 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089
  1. \documentclass[11pt, a4paper, twoside, titlepage]{book}
  2. \usepackage[latin1]{inputenc}
  3. \usepackage{amsmath,amsfonts,amssymb,amsthm,mathtools} % Most people will need these for mathematics
  4. %Figures
  5. \usepackage{graphicx} %Graphics package
  6. \usepackage[center]{caption}
  7. \usepackage{subcaption}
  8. \usepackage{wrapfig} % Wrap text around figures
  9. \usepackage{float} % To place figures correctly
  10. \usepackage{makeidx} % Probably important.
  11. \usepackage{listings} % To include code-snippets
  12. \usepackage{color}
  13. \usepackage{hyperref} % Clickable links to urls, internal and external references etc.
  14. \lstset{
  15. basicstyle=\footnotesize\ttfamily,
  16. identifierstyle=\bfseries\color{green!40!black},
  17. commentstyle=\itshape\color{purple!40!black},
  18. keywordstyle=\color{blue},
  19. stringstyle=\color{orange},
  20. }
  21. \usepackage{pdfpages} % Packages to handle certain issues with the pdf conversion and landscape figures/tables
  22. \usepackage{lscape}
  23. \usepackage[authoryear,square]{natbib} % References/bibliography package
  24. \usepackage{footnote}
  25. \usepackage[titletoc]{appendix} % Appendix + add to table of contents
  26. \usepackage{sidecap}
  27. \usepackage{lipsum} % Make dummy text
  28. % Table packages
  29. \usepackage{tabularx}
  30. \makesavenoteenv{tabular}
  31. \makesavenoteenv{table}
  32. \usepackage{array}
  33. \usepackage{booktabs}
  34. \newcommand*\rot{\rotatebox{90}}
  35. \usepackage{changepage}
  36. \usepackage{verbatim}
  37. \usepackage{cprotect}
  38. \usepackage{cancel}
  39. %Special in-document vector graphics:
  40. \usepackage{tikz}
  41. \usetikzlibrary{shapes.geometric,calc,positioning,3d,intersections,arrows}
  42. \usetikzlibrary{decorations.markings}
  43. \usepackage{pgfplots}
  44. % Custom characters
  45. \newcommand{\slfrac}[2]{\left.#1\middle/#2\right.} % Long on-line fraction-slash: \slfrac
  46. \newcommand{\degree}{\ensuremath{^\circ}} % The 'degree' character : \degree
  47. \DeclareRobustCommand{\orderof}{\ensuremath{\mathcal{O}}} % The 'Order of' character: \orderof
  48. %Epigraph / quote
  49. \usepackage{epigraph}
  50. \setlength\epigraphwidth{.8\textwidth}
  51. \setlength\epigraphrule{0pt}
  52. \title{Typesetting your Master's Thesis with \LaTeX -- A pragmatic approach.}
  53. \author{%
  54. \large
  55. \textsc{Tarjei Antonsen}\\[2mm]
  56. \normalsize University of Troms{\o} \\
  57. \normalsize \href{mailto:tarjei.antonsen@uit.no}{tarjei.antonsen@uit.no}
  58. \vspace{-5mm}
  59. }
  60. \date{October 2014}
  61. \begin{document}
  62. \maketitle
  63. \frontmatter
  64. \chapter*{\centering \begin{normalsize}Abstract\end{normalsize}}
  65. \addcontentsline{toc}{chapter}{Abstract}
  66. \noindent This work is a short introduction to \LaTeX\ and how to typeset and format a Master's thesis in it. The document itself also functions as a most basic template for a Master's thesis. This allows for students to write their own thesis directly in to the template without any extensive additional formatting, in addition to being flexible for personalization and further tweaking. In either scenario, the student should end up with a Master's thesis of high quality; superior to any commercial text editor, without mentioning specific softwares (yes, it is indeed MS Word and OpenOffice).
  67. You are currently reading the abstract which is the summary of the following work. Often the reader will benefit from a short introduction to the subject of which the thesis concerns itself and where the current work contributes to this. The methods used should be introduced, with emphasis on the improving aspects of your method. Important or never before used parameter values can be mentioned -- such as $\rho_s=3000$ kgm$^{-3}$. The most important results and discussions should also be mentioned accordingly to the conclusions. If you have concluded with something which renders the findings of e.g. \citet{tomsic1,havnes07} redundant, you may also mention this as an additional selling point.
  68. \clearpage
  69. \chapter{Acknowledgments}
  70. Above all, I wish to express my sincerest gratitude to my supervisor Prof. Bob Saget.\\
  71. \\
  72. I also love my girlfriend. LOL, JK, don't have one. I am sad.
  73. \\
  74. \\
  75. \qquad \emph{Barack Obama},\\
  76. \qquad \emph{October 2014}
  77. \newpage
  78. \thispagestyle{empty}
  79. \vspace*{\fill}
  80. \epigraph{\itshape Begin at the beginning, the King said gravely, ``I like big butts and I cannot lie''}{---Lewis Carroll, \textit{Sir Mix-A-Lot in Wonderland}}
  81. \tableofcontents
  82. \mainmatter
  83. \chapter{Introduction}
  84. \TeX\ and \LaTeX\ are a typesetting system and document preparation language, respectively, which have become the \emph{de facto} standard in academia. Due to its versatility and the fact that it is highly customizable, \LaTeX\ is also the most common tool to use when typesetting a Master's thesis. In this text we introduce this tool with a pragmatic approach, i.e. we skip the name-dropping of esoteric commands and low level 'programming' in \TeX. Indeed, if I were to comment on every command and macro used in this document, the course would become long and tedious. A certain amount of self study should accompany the understanding of this text.
  85. The first chapter will introduce the work area, i.e. the TeX-file, in which you write your thesis. A standard disposition for a typical Maser's thesis is also presented. Chapter~\ref{chp:refer} introduces the topic of referencing; internally and to literature. The topics are introduced in such a manner that a novice should be able to utilize the basic function of bibliography handling in \LaTeX. For the curious student, hints to the further investigation of built-in functions are given. In chapter~\ref{chp:figtab} we introduce the formatting of figures and tables. The most common types are shown by examples, and the more sophisticated TikZ-package for making in-document vector graphics is also introduced. This last point will not be interesting for the average reader, but it is an option worth looking in to if one wants to include figures of professional quality. A good alternative to this -- importing \LaTeX-figures in vector format from MatLab -- will also be introduced. General typesetting of equations and text will also be discussed.
  86. Note that the very document you are currently reading is in a format that will fit very well with a Master's thesis. The document contains several hints and quick-fixes to common problems with \LaTeX which the average user is very likely to encounter. The pragmatic user can merely use the source code for this introduction as the template for their own thesis. There are currently no definitive rules (or templates) for the appearance of a Master's thesis at UiT. Many students therefore modify their thesis according to personal preferences. This is allowed and can yield a nice result, but my advice is that you keep the thesis to a classical formal looking document -- Less is more (it really isn't, though).
  87. \section{The preamble}
  88. The preamble is basically everything which is specified before the command \verb|\maketitle| in your main document. It mainly consists of a list of \emph{packages} which you want to include to typeset your thesis. The command \verb|\usepackage[Preference]{Name}| will add a certain package with the preference you want. E.g. \verb|\usepackage[center]{caption}| will center your figure captions in floating environments. Do not worry to much about what packages to include. The source code to this text probably contains all the packages you will need (almost too many), and the addition of other packages is done by writing the presented command into the preamble. Most \LaTeX-distributions already have all the normal packages downloaded, so the issue with manually downloading packages can normally be avoided.
  89. The specification of custom commands can also be done in the preamble. For instance, the 'degree' character is not built in, and we can manually make the character by specifying:
  90. \begin{verbatim}
  91. \newcommand{\degree}{\ensuremath{^\circ}}
  92. \end{verbatim}
  93. So that I can say: '$71\degree$ Nord' is a bag of horse manure. However, you will most likely not need to specify many custom commands, and macros, and Google will help you if you absolutely must.
  94. A last, rather important, command is the very first one of the entire document: \verb|\documentclass[11pt, a4paper, twoside, titlepage]{book}|. This command specifies the main style of your entire document. I must comment on two of the specified preferences. The first option '\textbf{11pt}' specifies the font size. I strongly recommend to use 11 pt instead of 12 pt for two reasons: 1) It looks better, 2) Using 12 pt does \emph{not} make your document particularly longer; try it. The option '\textbf{twoside}' is the recommended option to use for documents which are to be \emph{printed} physically on both sides of the sheets. You may have noticed that in this document, the even and odd pages have different margins to overcome the loss of margins towards the middle of the printed book when it is opened.
  95. \section{The main TeX-document}
  96. There isn't really much too you main document. It is just a plain text file in the .tex-format, and if you really wanted to, you could write your entire thesis in any notepad. The biggest advantage with using \LaTeX\ editors and specialized software, is that the code is color coded and usually well-presented. Apart from that, with the ''few'' commands you need when writing a thesis, I always prefer using the most basic programs without 'too many options' (e.g. TeXShop). If you are bombarded with opportunities, the probability of using some unnecessary option will be significant. Many users, however, may save some time by using the built-in macros and shortcuts which many distributions have, and this is of course recommended.
  97. \subsection{Sectional hierarchy of the 'book' format}
  98. A thesis is normally structured into chapters which contain sections and subsections. The primary commands to make a new object of one of these classes are:
  99. \begin{verbatim}
  100. \chapter{...}
  101. \section{...}
  102. \subsection{...}
  103. \subsubsection{...}
  104. \end{verbatim}
  105. \noindent These commands will also add the object to the table of contents. It is of course possible to add an object which is \emph{not} numbered and which is emitted from the table of contents. This is done by simply adding an asterisk before the object name, e.g.:
  106. \begin{verbatim}
  107. \subsection*{Example 1}
  108. \end{verbatim}
  109. \subsection{An alternative main TeX-file -- Modular \LaTeX}
  110. So far we have presented the main TeX document in such a way that it should be written in one large file. Some \LaTeX-users, especially programmers and computer scientists, will insist to treat the thesis main file as exactly this: a \emph{main} file which simply gathers the chapters and where no substance is provided. This is certainly a neat method, but it does offer a problem in that it is by far less searchable than the normal fused file. A Master's thesis usually consists of relatively few and possibly long chapters. It is clear that the benefits of separating chapters will vanish when the chapters in their own sense are long and 'messy'. A problem I often encountered when using external chapters was that when searching for a certain reference, phrase or whatever, which I \emph{knew} was in the thesis somewhere, it often ended up being in a different chapter than in the first or second chapter I searched in. If you still want to include chapters via external files, these two commands will do the task:
  111. \begin{verbatim}
  112. \include{/path/folder/file}
  113. \input{/path/folder/file}
  114. \end{verbatim}
  115. \section{Disposition of a Master's thesis}
  116. The disposition of a thesis is, of course, completely dependent on the type of study and to some degree personal preferences. Many students, including me, have a hard time starting to shape their thesis without a rough outline or plan. I therefore present below a very general setup of a thesis in which each of the points will normally be so important that they deserve an entire chapter:
  117. \begin{description}
  118. \item[I] \hfill \\
  119. \textbf{Introduction}. Breifly describe the history and current state of knowledge of your field. Motivate your study and describe your angle of attack. Mention important results. Finally, give a summary of the outline of the thesis.
  120. \item[II] \hfill \\
  121. \textbf{Background}. Extensively describe the components involved in your thesis; both general and on a more basic level. This must be well referenced and backed up by the literature. Try to include as many new studies as possible, as it shows that you are on par with the current knowledge.
  122. \item[III] \hfill \\
  123. \textbf{Methods}. Your approach to the problem. You may describe how your methods differ from other approaches here.
  124. \item[IV] \hfill \\
  125. \textbf{Theoretical model}. If you have developed or you are using a theoretical model, e.g. in simulations or other considerations, discuss them here. For purely theoretical studies, this is your most important chapter and it will normally overlap with the methodology description. Derivations may be presented here.
  126. \item[V] \hfill \\
  127. \textbf{Results}. Present and thoroughly describe your findings.
  128. \item[VI] \hfill \\
  129. \textbf{Discussion}. Discuss your findings. Assess the successfulness of your approach. Discuss how your work contributes to the current literature.
  130. \item[VII] \hfill \\
  131. \textbf{Conclusions}
  132. \end{description}
  133. \noindent Depending on the type of study, some of these points may be skipped or fused together with others. In most cases, a thesis will not benefit from having many additional chapters than the ones proposed here. To describe the connections between topics which may seem natural to separate between in a single chapter, is certainly an art which is appreciated in the assessment of a thesis as it can show that a candidate has a deep understanding of his field.
  134. \section{A general note on customization of the thesis layout}
  135. As this text is merely a short introduction to thesis writing in \LaTeX, only a handful of commands will be presented, and we offer only the most classic and simple template for a Master's thesis. This will offer students who consult this guide and its corresponding resources many degrees of freedom when it comes to personal styling. This is allowed and encouraged, as long as the graphical expression does not steal attention from the content. As mentioned, UiT has no definite constraints on the thesis layout, but it is recommended that the candidate follow the official graphical profile of the university. The official front page for a Master's thesis and other graphical details may be found at \url{http://uit.no/ansatte/grafiskprofil/artikkel?p_document_id=349513}.
  136. \chapter{Referencing}\label{chp:refer}
  137. \epigraph{\itshape I always wanted to place a lame quote in the start of a chapter. Get to the chapter!}{---Arnold Schwarzenegger, \textit{Mein Kopf}}
  138. \section{Internal references}
  139. By internal references we mean references to chapters, sections, figures, tables, equations etc. which is in your thesis. Two simple commands will get you a long way. First you will need to create a label for the object you want to refer to. In the first line of this chapter I have included the command \verb|\label{chp:refer}|. To cite the chapter, we simply use :
  140. \begin{verbatim}
  141. ~\ref{chp:refer}
  142. \end{verbatim}
  143. which produces this:~\ref{chp:refer}. The \verb|\ref| command should be used for all internal references except when you are referring to equations. The command
  144. \begin{verbatim}
  145. \eqref{very_short_equation}
  146. \end{verbatim}
  147. \noindent can be used to refer to e.g. eq.~\eqref{very_short_equation} below, which is the shortest and most comprehendible equation in the world.
  148. \begin{align}\label{very_short_equation}
  149. \vec{F}_{drag} &= \pi r_d^2 m_g n_g v_{th,g}(\vec{v}_g-\vec{v}_d)\frac{1}{u}\Biggl\{\frac{1}{\sqrt{\pi}}\left(u + \frac{1}{2u}\right)\text{exp}(-u^2)\nonumber \\
  150. &+ \left(1+u^2-\frac{1}{4u^2}\right) \text{erf}(u)\Biggr\}
  151. \end{align}
  152. \section{A proper bibliography}
  153. The standard \LaTeX\ bibliography support has its main limitations in its few formatting options and that the implementation tends to become 'messy' when dealing with several citations. We introduce here how to combine the \textbf{natbib}-package with BibTeX for handling the bibliography, as it offers complete control over the style of both the citations and the bibliography itself.
  154. The main advantage of this method is that all citations are separated from your main document in a database file from which references are imported. This saves your work file hundreds of lines of code. It should also be mentioned that most scientific journals will let you export the citation (online) of almost all their published material in the BibTeX-format -- you will rarely need to physically write down a reference to an article. In addition to this, BibTeX/natbib offers full control over the style in which citations are presented. However, it must be stressed that the classical styles (Harvard Number-Year, Numeric etc.) are recommended for use in a Master's thesis. A few options are discussed below.
  155. \subsection{The bibliography database}
  156. Bibliography management with the tools mentioned above allows us to use multiple database files, however one single file is in most cases preferable. The bibliography database is essentially just a text file -- in the \textbf{.bib} format. An entry in the database consists of fields such as the mandatory author, journal name, volume, year etc. but can also be extended to contain e.g. digital object identifier (DOI). This latter data field is not required but recommended as it makes the lookup of an article much easier. It should be noted that different publication types require different data fields, and BibTeX will automatically format the bibliography entry according to the specified type.
  157. \subsection*{Example}
  158. In this example we show the input and output of one database entry of the type 'article', which is the type you will be referring to the most. As mentioned, other publication types such as 'book', 'phdthesis', 'inproceedings', etc. require a different data field setup. I refer to the WikiBook on this topic -- \url{http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management} -- if you need to manually write in such references. The following input will produce the output seen in figure~\ref{bibentry}:
  159. \begin{verbatim}
  160. @article {havnes96,
  161. author = {Havnes, O. and Tr{\o}im, J. and Blix, T. and
  162. Mortensen, W. and N{\ae}sheim, L. I. and Thrane, E. and
  163. T{\o}nnesen, T.},
  164. title = {First detection of charged dust particles
  165. in the {E}arth's mesosphere},
  166. journal = {Journal of Geophysical Research: Space Physics},
  167. volume = {101},
  168. number = {A5},
  169. issn = {2156-2202},
  170. doi = {10.1029/96JA00003},
  171. pages = {10839--10847},
  172. year = {1996},
  173. }
  174. \end{verbatim}
  175. \begin{figure}[H]
  176. \centering
  177. \includegraphics[width=0.9\textwidth]{Figures/bibentry_example}
  178. \cprotect \caption{An example of a bibliography entry. Note that the first entry, 'havnes96', is the citation key. This is unique and specified by the user.}
  179. \label{bibentry}
  180. \end{figure}
  181. \noindent The only data field here which is not required is the 'doi'-field, but this is strongly recommended. Abstracts and url's (because of their messy presentations -- use DOI) for articles should not be included.
  182. \subsection{How to create and include a database}
  183. The first thing you need is a database file in the .bib-format. Included in the resources of this introduction is an example file named '\verb|database_template.bib|' -- use this.
  184. The next step to conquer \xcancel{the world} bibliography management, is to include your references. This is ridiculously easy with BibTeX. The fastest way to do this is to google the article you are looking for and visit its page at the publisher (normally the top hit). Somewhere on the article home page there should exist a button which says something like 'Export citation' (to BibTeX) -- et voila! Sometimes you must download an entire .bib-file just for the one reference, but remember: Copy/Paste is your friend.
  185. There are a number of other options. The online databases of Google Scholar, Harvard ADSABS, WebOfKnowledge and UiT's own Munin are other portals which offer a fast way to export citations directly.
  186. If you do need to write in a bibliography entry manually, it is often preferable to just write the reference directly into your main .bib-file. Software such as BibDesk and EndNote are bibliography management programs which have GUIs for entering items. In any case, it is good practice to include the reference to a work the second you use it. Never write a reference directly in your text (!) The method described below in section~\ref{citation_style} is the safest way to avoid redundant citations.
  187. \subsection{Citation style and use}\label{citation_style}
  188. The format of a citation is mainly a concern of the \textbf{natbib}-package. The possibilities are endless, and the citation style is frequently a discussion topic among \LaTeX\-users. There are no definite requirements to bibliography style at UiT, but we present here a style inspired by one of the most common formats; The Harvard style with a so-called Author-Year format. If you intend to customize your own thesis' citations and bibliography, my best tip is: do not get too fancy with the references. In any case, the most common styles are listed in \url{http://en.wikibooks.org/wiki/LaTeX/Bibliography_Management#Natbib}.
  189. An important note to students who intend to use the standard style bibliography, is that there might be problems with the format of the bibliography it self. In the standard bibliography styles of natbib, the surnames does not come first even though the list is alphabetical after the surnames. This is fixed in the appended bibliography style \verb|'Template_LastNameFirst_Alphabetical.bst'|. To use this style, just include the file in the same folder as your tex-file.\\
  190. \\
  191. In the preamble the following should be specified:
  192. \begin{verbatim}
  193. \usepackage[authoryear,square]{natbib}
  194. \end{verbatim}
  195. The 'square' denotes the shape of the parenthesis or brackets used. My favorite is square, but 'round' is the most common choice. To include the bibliography style file and the database file, the following should be specified at the end of the document, right before the command \verb|\end{document}|:
  196. \begin{verbatim}
  197. \bibliographystyle{Template_LastNameFirst_Alphabetical}
  198. \bibliography{database_template}
  199. \end{verbatim}
  200. \noindent When citing there are mainly two commands one will need:
  201. \begin{verbatim}
  202. \citet{something00}
  203. \end{verbatim}
  204. \noindent which will produce the standard citation, e.g. Something et al. $\left[2000\right]$, and:
  205. \begin{verbatim}
  206. \citep{havnes96}
  207. \end{verbatim}
  208. \noindent which will produce the citation \citep{havnes96}, i.e. in parenthesis. You may also add comments, such as:
  209. \begin{verbatim}
  210. \citep[see][eq. 6]{havnes96}
  211. \end{verbatim}
  212. \noindent which will produces the citation \citep[see][eq. 6]{havnes96}. For further options, check the WikiBook.
  213. \chapter{Figures and tables}\label{chp:figtab}
  214. The traditional thesis contains a large number of figures, tables and miscellaneous graphical objects. How these are presented and how they look is from a graphical point of view the most important aspect of your thesis -- more important than 'blinging' up your document with all sorts of fancy headers and other details. Now, if you present data from experiments in your figures, the data will speak for itself and the assessment of your work should in principle not include the graphics itself. That being said, a thesis with $\orderof(10)$ well presented figures is a delight to read and will only give plus points in the overall assessment.
  215. In section~\ref{figures} we present different types of figures and give a short tutorial on how to produce different figure styles. Section~\ref{formats} gives a brief introduction to figure formats, general presentation and how to produce \LaTeX\ style figures with MatLab. We also present, in section~\ref{tikz}, a package called TikZ for making vector graphics and plots directly in your TeX document. This option can be time consuming and require a little more than a basic understanding of \LaTeX, but will produce professional looking outputs fitting even for the most well-known scientific journals.
  216. The end of the chapter introduces shortly how to format tables and lists with a few different options.
  217. \section{Figures}\label{figures}
  218. Figure handling with \LaTeX\ usually offers few problems one takes certain precautions. Including the two packages 'float' and 'graphicx' in the preamble;
  219. \begin{verbatim}
  220. \usepackage{graphicx}
  221. \usepackage{float}
  222. \end{verbatim}
  223. \noindent will provide a versatile framework to handle figures, with few issues.
  224. The following lines will import and typeset figure~\ref{reldiff}:
  225. \begin{verbatim}
  226. \begin{figure}[h]
  227. \centering
  228. \includegraphics[width=0.75\textwidth]{Figures/relative_difference_v0450pdf}
  229. \caption{Example figure created with MatLab.}
  230. \label{reldiff}
  231. \end{figure}
  232. \end{verbatim}
  233. \noindent This is a standard setup for importing, typesetting and centering any figure. The width of the figure should be specified by the author, and the specifier \verb|[h]| is the option of placement of the figure/float. This is discussed in more depth below.
  234. \begin{figure}[h]
  235. \centering
  236. \includegraphics[width=0.75\textwidth]{Figures/relative_difference_v0450pdf}
  237. \caption{Example figure created with MatLab.}
  238. \label{reldiff}
  239. \end{figure}
  240. Even though the figure environment will function well with the \verb|[h]| specifier, during the course of the typesetting of your thesis you are likely to encounter a few problems. I'll thus discuss some common issues.
  241. The mentioned specifier \emph{h} means 'approximately here', and \LaTeX\ will look for a way to place the figure as close as possible to where you have specified in the document. This rarely happens -- and it should certainly not. \LaTeX\ will place the figures (or 'floats' as we may call them) according to the most correct syntax per definition. However, for various reasons, the typesetter may not find obvious spots to put the figures, and one might get en error such as \emph{'Too many unprocessed floats'}. The following command:
  242. \begin{verbatim}
  243. \clearpage
  244. \end{verbatim}
  245. \noindent will then force all floats (i.e. figures and tables etc.) to be typeset. This can be smart to do by default in the end of each chapter or long sections to prevent that figures from a certain section gets printed in the next.
  246. Another possible issue is that the choices the typesetter does for you will not always be perfect. On rare occasions you'll possibly need to force the figure to stay exactly where you put it in the text. This kind of tweaking is very common to perform in the finishing stages of the typesetting when no new floats are to be placed or text is to be added. In this case, simply swap the specifier \verb|[h]| with \verb|[H]|, but be careful not to use this option too much. Section~\ref{formats} elaborates on the float specifiers.
  247. \subsection*{Wrapped figures}
  248. \begin{wrapfigure}{r}{0.55\textwidth}
  249. \vspace{-25pt}
  250. \begin{center}
  251. \centering
  252. \includegraphics[width=0.53\textwidth]{Figures/figure_wrapped.pdf}
  253. \end{center}
  254. \vspace{-20pt}
  255. \caption{A wrapped figure often requires
  256. fiddling with parameters.}
  257. \label{wrap}
  258. \vspace{-10pt}
  259. \end{wrapfigure}
  260. This figure type can in certain circumstances be the best way to present a figure, but it can be notoriously tricky to place correctly. If you plan to use this type, you will most probably need to mess around with a few parameters. The few times I have utilized this option I have used the following code which I realize now is total rubbish. It does however work, but can imagine a few other ways to solve this. Google at your own (last) will.\\
  261. {\footnotesize
  262. \noindent \begin{minipage}{\textwidth}
  263. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  264. \subsection*{Wrapped figures}
  265. \begin{wrapfigure}{r}{0.55\textwidth}
  266. \vspace{-25pt}
  267. \begin{center}
  268. \centering
  269. \includegraphics[width=0.53\textwidth]{Figures/figure_wrapped.pdf}
  270. \end{center}
  271. \vspace{-20pt}
  272. \caption{A wrapped figure often requires
  273. fiddling with parameters.}
  274. \label{wrap}
  275. \vspace{-10pt}
  276. \end{wrapfigure}
  277. \end{lstlisting}
  278. \end{minipage}
  279. }
  280. \subsection{Formats and general presentation}\label{formats}
  281. The format, i.e. the file type, of your imported figure should be such that it has a resolution which is higher than the printed thesis which is normally 300 dpi. Said more pragmatically: stay away from jpegs and other compressed formats and use formats with a high resolution, preferably vector graphics. You do not need to save space for your Master's thesis, it deserves only the best quality figures. The best formats are EPS, PDF and TIFF, and if you ask me they are equally good. A minor benefit of the first two formats is that they can be exported from for instance MatLab in a vector format which only saves the graphical objects them selves, which in practice means that plots with only lines and primitive shapes take up almost no space. To directly make \LaTeX\ labels in MatLab use the following syntax:
  282. \begin{verbatim}
  283. ylabel('Some parameter, $\frac{P\cdot m^2}{N}$ ',...
  284. 'FontSize',11,'interpreter','latex')
  285. \end{verbatim}
  286. Now for the issue with where and how to place the figures. We have earlier encountered the standard placement specifier \verb|[h]| which will most often place normal size figures correctly according to good typesetting. A few notes should be made. Tables and figures which span over the entire width of a page look best at the top. The specifier for this is \verb|[t]|. You may also place an object at the bottom of a page by using \verb|[b]|. I refer to the WikiBook on the subject of float handling for further options. An option which will not be discussed here is the \emph{subfigure} environment which allows for placing figures into columns or rows, this is however a common feature to use in many works. The Wiki also covers this. \\
  287. \\
  288. \noindent \textbf{Wiki:}\\
  289. \url{http://en.wikibooks.org/wiki/LaTeX/Floats,_Figures_and_Captions}
  290. \section{TikZ -- Superb looking vector graphics.}\label{tikz}
  291. This section will not include any code (which may be found in the document TeX-file), and will only present a few neat examples of what TikZ can be used to create. Together with the package \textbf{pgfplots}, TikZ is great tool for producing vector graphics directly in a TeX-file. I won't lie, if you choose to pursue this option, you must invest a little time in the figure preparation. Importing your own data series into TikZ is possible and straightforward. The novice way to use TikZ/pgfplots is to browse the large online gallery of pgfplots and find a figure which resembles what you want to produce and modify the given code. Libraries can be found at:\\
  292. \\
  293. \url{http://pgfplots.sourceforge.net/gallery.html} and \\
  294. \url{http://www.texample.net/tikz/}.
  295. \subsection*{A few examples}
  296. \begin{figure}[h]
  297. \centering
  298. \begin{tikzpicture}[scale=0.8, baseline]
  299. \begin{axis}[
  300. axis x line=bottom,
  301. axis y line=left,
  302. axis y discontinuity=crunch,
  303. axis x discontinuity=crunch,
  304. grid=major,
  305. %ymin=0.4e-9,
  306. %xmin=0.008,
  307. xlabel=Height (km),ylabel=Negative current ($\cdot10^{-10}$A),
  308. xticklabels={81,81.05,81.1},xtick={2,7,12},
  309. yticklabels={-3,-5,-8},ytick={1,1.4,1.8},
  310. ]
  311. \addplot[blue,mark=none,
  312. domain=2:4,samples=501]
  313. {ln(x)}node [pos=0.3,pin={-10:$V_{BP}=10V$},inner sep=1pt] {};
  314. \addplot[dashed,blue] plot coordinates {
  315. (4,1.38629)
  316. (4,1.18629)
  317. };
  318. \addplot[blue,mark=none,
  319. domain=4:6,samples=501]
  320. {ln(x)-0.2}node [pos=0.4,pin={-40:$0V$},inner sep=1pt] {};
  321. \addplot[dashed,blue] plot coordinates {
  322. (6,1.5917594)
  323. (6,1.2917594)
  324. };
  325. \addplot[blue,mark=none,
  326. domain=6:8,samples=501]
  327. {ln(x)-0.5}node [pos=0.5,pin={-80:$-10V$},inner sep=1pt] {};
  328. \addplot[dashed,blue] plot coordinates {
  329. (8,1.87944)
  330. (8,1.57944)
  331. };
  332. \addplot[blue,mark=none,
  333. domain=8:10,samples=501]
  334. {ln(x)-0.2}node [pos=0.3,pin={-86:$0V$},inner sep=1pt] {};
  335. \addplot[dashed,blue] plot coordinates {
  336. (10,2.30258)
  337. (10,2.10258)
  338. };
  339. \addplot[blue,mark=none,
  340. domain=10:12,samples=501]
  341. {ln(x)}node [pos=0.3,pin={-86:$10V$},inner sep=1pt] {};
  342. \addplot[blue, dotted,
  343. domain=2:12,samples=501]
  344. {ln(x)};
  345. \end{axis}
  346. \end{tikzpicture}
  347. \caption{Crunched axes and in-figure text.}
  348. \label{detectionoffrags}
  349. \end{figure}
  350. \begin{figure}[h]
  351. \label{fig:lard}
  352. \begin{subfigure}[t]{0.48\textwidth}
  353. \centering
  354. \begin{tikzpicture}[scale=0.8, baseline]
  355. \begin{axis}[
  356. axis x line=bottom,
  357. axis y line=left,
  358. axis y discontinuity=crunch,
  359. axis x discontinuity=crunch,
  360. grid=major,
  361. ymin=0.7e-2,
  362. %xmin=0.008,
  363. xlabel=Fragment radius (m),ylabel=Braking length (m)
  364. ]
  365. \addplot[blue,mark=none,
  366. domain=0.2e-9:0.8e-9,samples=501]
  367. {33037373*x};
  368. \end{axis}
  369. \end{tikzpicture}
  370. \end{subfigure}
  371. ~\qquad\qquad
  372. \begin{subfigure}[b]{0.44\textwidth}
  373. \centering
  374. \begin{tikzpicture}[scale=0.4]
  375. \node [draw, cylinder, shape aspect=4, rotate=90, minimum height=5cm,minimum width=3cm] (c) {};
  376. \node[anchor=west] at (5.1,5) {$n_g$};
  377. \node[anchor=west] at (5.1,0) {$m_g$};
  378. \coordinate(htop) at ($(c.before top)!-1*.1!(c.after top)$);
  379. \coordinate(hbot) at ($(c.after bottom)!-1*.1!(c.before bottom)$);
  380. \coordinate(hlab) at ($(htop)!.5!(hbot)+(c.north)!.9!(c.center)$);
  381. \draw[<->] (hbot)--(htop);
  382. \path (hlab) node {$L$}; %Modify height label here
  383. \coordinate (center) at ($(c.before top)!0.5!(c.after top)$);
  384. \coordinate (rlab) at ($(center) !0.5!(c.after top)$);
  385. \coordinate (rtop) at ($(center)!-1*.1!(c.after top)$);
  386. \draw[<->] (rtop) -- (c.after top);
  387. \path (rlab) node[above] {$r_d$}; %Modify radius label here
  388. \draw[fill] (0,0.5) circle [radius=0.20];
  389. \draw[->](0,0.5)--(0,-1.5);
  390. \draw[->,>=stealth](3,3) to [out=60,in=180] (5,5);
  391. \draw[->,>=stealth](3,-2) to [out=60,in=180] (5,0);
  392. \draw (-3.5,0.5) arc (180:360:3.5cm and 1cm);
  393. \draw[dashed] (3.5,0.5) arc (0:180:3.5cm and 1cm);
  394. \draw (0,0.5) circle (3.5cm);
  395. \shade[ball color=blue!10!white,opacity=0.20] (0,0.5) circle (3.5cm);
  396. \end{tikzpicture}
  397. \end{subfigure}
  398. \caption{Graph and schematic.}
  399. \label{fig:lard}
  400. \end{figure}
  401. \begin{figure}[h]
  402. \centering
  403. \begin{tikzpicture}
  404. \begin{axis}[
  405. scale only axis,
  406. grid=both,
  407. xmin=0.05,
  408. xmax = 2.15,
  409. ymin=-13,
  410. ymax=12,
  411. ylabel=$V_{BP}$ (V),xlabel=Radius (nm),
  412. axis y line=left,
  413. axis x line*=bottom,
  414. ]
  415. \addplot[black, mark=square,line width=1.5pt] coordinates {(0.9,9) (1.2,9)};
  416. \addplot[black, mark=square,line width=1.5pt] coordinates {(1.05,8) (1.4,8)};
  417. \addplot[black, mark=square,line width=1.5pt] coordinates {(1.3,5) (1.6,5)};
  418. \addplot[black,dashed,mark options=solid, mark=square,line width=1.5pt] coordinates {(1.5,0) (1.8,0)};
  419. \addplot[black, dashed, mark=square,mark options=solid,line width=1.5pt] coordinates {(1.8,-10) (2.1,-10)};
  420. \addplot[black, mark=square,mark options=solid,line width=1.5pt] coordinates {(0.4,11) (0.7,11)};
  421. \end{axis}
  422. \begin{semilogyaxis}[blue,
  423. scale only axis,
  424. ymin=5,ymax=145000,
  425. axis y line=right,
  426. axis x line=none,
  427. xmin=0.05,
  428. xmax = 2.15,
  429. enlargelimits=false,axis on top=true,
  430. ylabel=MSP concentration (cm$^{-3}$nm$^{-1}$),ylabel near ticks]
  431. \addplot[blue, mark=triangle*, mark size = 4pt,line width=1pt] coordinates {(0.15, 100000) (0.4,10000) (0.9,1000) (1.4,100) (2.1,10)};
  432. \end{semilogyaxis}
  433. \end{tikzpicture}
  434. \caption{Double y-axes tells the reader that he is probably looking at something important.}
  435. \label{ranges_concentration}
  436. \end{figure}
  437. \begin{figure}[h]
  438. \qquad \quad
  439. \begin{tikzpicture}
  440. \begin{axis}[cycle multi list={
  441. black\nextlist
  442. solid,{dashed,mark options={solid}}\nextlist
  443. mark=none,mark=*,mark=x,mark=o,mark=square,
  444. },
  445. legend entries={$V_{BP}=10$V,$V_{BP}=0$V,$V_{BP}=-10$V,$V_{BP}=5$V,$V_{BP}=8$V,$V_{BP}=9$V},
  446. legend pos=outer north east,
  447. grid=major,
  448. axis x line=bottom,
  449. axis y line=left,
  450. ymax =1.05,
  451. xlabel=initial fragment radius (m) ,ylabel= Relative current ($I_{xV}/I_{ref}$)]
  452. \addplot[dotted] coordinates {(1.0e-9,1) (1.1e-9,1) (1.2e-9,1) (1.3e-9,1) (1.4e-9,1) (1.5e-9,1) (1.6e-9,1) (1.7e-9,1) (1.8e-9,1) (1.9e-9,1) (2.0e-9,1) (2.1e-9,1)};
  453. \addplot coordinates {(1.3e-9,0) (1.4e-9,0.06) (1.5e-9,0.3) (1.6e-9,0.54) (1.7e-9,0.78) (1.8e-9,1)};
  454. \addplot coordinates {(1.6e-9,0) (1.7e-9,0.08) (1.8e-9,0.32) (1.9e-9,0.56) (2.0e-9,0.82) (2.1e-9,1)};
  455. \addplot coordinates {(1.1e-9,0) (1.2e-9,0.12) (1.3e-9,0.36) (1.4e-9,0.6) (1.5e-9,0.84) (1.6e-9,1)};
  456. \addplot coordinates {(1.0e-9,0.2) (1.1e-9,0.42) (1.2e-9,0.66) (1.3e-9,0.88) (1.4e-9,1)};
  457. \addplot[dashed] coordinates {(1.0e-9,0.48) (1.1e-9,0.70) (1.2e-9,1)};
  458. \end{axis}
  459. \end{tikzpicture}
  460. \caption{With legend. A tip: when publishing in scientific journals, figures with color can cost quite a lot to get printed. A workaround is then to make your figures with black lines and different line styles/markers only.}
  461. \label{fig:smallgaps}
  462. \end{figure}
  463. \clearpage
  464. \section{Tables}
  465. The normal tabular environment, which is the environment in which you actually make the table, have many limitations. The best tip I can give is that you should make a standard table which looks decent, and include the packages you need for making that table and subsequently add packages as you go along modifying your template. The following lines added to the preamble will add formatting options for tables sufficient for most applications.
  466. \begin{verbatim}
  467. \usepackage{tabularx}
  468. \makesavenoteenv{tabular}
  469. \makesavenoteenv{table}
  470. \usepackage{array}
  471. \usepackage{booktabs}
  472. \newcommand*\rot{\rotatebox{90}}
  473. \end{verbatim}
  474. \subsection*{A standard table}
  475. The following lines of code will produce the table shown in table~\ref{tab1}. Note that the placement specifier \verb|[ht]| is used here; a better choice for broad tables. In \verb|\begin{tabular}|, the limiter '$|$' denotes a column which is separated by a line; \textbf{c} denotes that each entry should be centered in its cell; the character \verb|&| separates between column, and \verb|\\| starts a new line (while \verb|\hline| typesets the line).\\
  476. {\small
  477. \noindent \begin{minipage}{\textwidth}
  478. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  479. \begin{table}[ht]
  480. \caption{Captions for tables should
  481. be placed above the table!}
  482. \begin{tabular}{c|cc|cc|cc}
  483. &\multicolumn{2}{c}{$v_0 = 350 m/s$}
  484. &\multicolumn{2}{|c}{$v_0 = 450 m/s$}
  485. & \multicolumn{2}{|c}{$v_0 = 550m/s$}\\
  486. \hline
  487. $r_0 [nm]$ & $E_f [eV]$& Hits [\%]&$E_f [eV]$ & Hits [\%]& $E_f [eV]$
  488. & Hits [\%]\\ \hline
  489. 1.5 & --- & 0.0 & 0.0 -- 4.3 & 30.0 & 0.0 -- 12.4 & 86.0 \\
  490. 1.6 & --- & 0.0 & 0.0 -- 7.6 & 54.0 & 2.6 -- 17.9 & 100.0 \\
  491. 1.7 & 0.0--2.1 &12.0 &0.0--11.6 & 78.0 & 6.2--24.3 &100.0\\
  492. 1.8 & 0.0--4.5 & 32.0&1.3--16.2 &100.0 & 10.5--31.8&100.0\\
  493. \end{tabular}
  494. \label{tab1}
  495. \end{table}
  496. \end{lstlisting}
  497. \end{minipage}
  498. }
  499. \begin{table}[ht]
  500. \caption{Captions for tables should be placed above the table!}
  501. \begin{tabular}{c|cc|cc|cc}
  502. &\multicolumn{2}{c}{$v_0 = 350 m/s$}&\multicolumn{2}{|c}{$v_0 = 450 m/s$} &\multicolumn{2}{|c}{$v_0 = 550m/s$}\\
  503. \hline
  504. $r_0 [nm]$ & $E_f [eV]$& Hits [\%] & $E_f [eV]$ & Hits [\%] & $E_f [eV]$ & Hits [\%] \\ \hline
  505. 1.5 & --- & 0.0 & 0.0 -- 4.3 & 30.0 & 0.0 -- 12.4 & 86.0 \\
  506. 1.6 & --- & 0.0 & 0.0 -- 7.6 & 54.0 & 2.6 -- 17.9 & 100.0 \\
  507. 1.7 & 0.0 -- 2.1 & 12.0 & 0.0 -- 11.6 & 78.0 & 6.2 -- 24.3 & 100.0 \\
  508. 1.8 & 0.0 -- 4.5 & 32.0 & 1.3 -- 16.2 & 100.0 & 10.5 -- 31.8 & 100.0 \\
  509. \end{tabular}
  510. \label{tab1}
  511. \end{table}
  512. \subsection*{Tables with figures}
  513. A table with embedded figures is often a nice way to represent concepts which are abstract. In the presented example in table~\ref{tab:chi}, the dynamic shape factors for different shapes are given. This is an abstract topic, and the confusion which may arise if just the name of the shape is presented is hopefully avoided. An important note: footnotes in tables are not straight forward. From my personal experiences, it is easier to simply hard code the footnotes in the table such as in the current example, but you can however still use the \textbf{cite}-commands. The following code produces the output.\\
  514. {\footnotesize
  515. \noindent \begin{minipage}{\textwidth}
  516. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  517. \begin{table}[t]
  518. \caption{Example of table with figures.}
  519. \begin{tabular}{lp{1.5cm}cc}
  520. \hline
  521. Particle type&&Diameter relations&Dynamic shape factor,$\chi$\\
  522. \hline
  523. \hline
  524. \rule{0pt}{8ex}
  525. \parbox[c]{1em}{\includegraphics[width=2cm]{Figures/chi1}}
  526. &Sphere& $d_m=d_{ve}$& $\chi =1$\\
  527. \hspace{1pt} \parbox[c]{1em}{\includegraphics[width=2cm]{Figures/chi2}}
  528. &Sphere w/voids& $d_m=d_{ve}$& $\chi =1$\\
  529. \hspace{1pt} \parbox[c]{1em}{\includegraphics[width=2cm]{Figures/chi3} }
  530. &Agglomerates & $d_m>d_{ve}$& $\chi =1.5-1.6^{~(1}$\\
  531. \hspace{1pt} \parbox[c]{1em}{\includegraphics[width=2cm]{Figures/chi4} }
  532. &Dublet& $d_m>d_{ve}$& $\chi =1.12^{~(2}$
  533. \end{tabular}
  534. \noindent\rule{5cm}{0.4pt}\\
  535. $^1$ \footnotesize Values from some guys et al. (2010) used for
  536. nano-scale chondritic products
  537. (Fe$_2$O$_3$, SiO$_2$ and MgO).\\
  538. $^2$ From That Guy (1997).
  539. \normalsize
  540. \label{tab:chi}
  541. \end{table}
  542. \end{lstlisting}
  543. \end{minipage}
  544. }
  545. \begin{table}[t]
  546. \caption{Example of table with figures.}
  547. \begin{tabular}{lp{1.5cm}cc}
  548. \hline
  549. Particle type & &Diameter relations & Dynamic shape factor, $\chi$ \\
  550. \hline
  551. \hline
  552. \rule{0pt}{8ex}
  553. \parbox[c]{1em}{\includegraphics[width=2cm]{Figures/chi1}} &Sphere & $d_m=d_{ve}$ & $\chi =1$\\
  554. \hspace{1pt} \parbox[c]{1em}{\includegraphics[width=2cm]{Figures/chi2}}&Sphere w/voids & $d_m=d_{ve}$ & $\chi =1$\\
  555. \hspace{1pt} \parbox[c]{1em}{\includegraphics[width=2cm]{Figures/chi3} }&Agglomerates & $d_m>d_{ve}$ & $\chi =1.5-1.6^{~(1}$\\
  556. \hspace{1pt} \parbox[c]{1em}{\includegraphics[width=2cm]{Figures/chi4} }&Dublet & $d_m>d_{ve}$ & $\chi =1.12^{~(2}$
  557. \end{tabular}
  558. \noindent\rule{5cm}{0.4pt}\\
  559. $^1$ \footnotesize Values from some guys et al. (2010) used for
  560. nano-scale chondritic products (Fe$_2$O$_3$, SiO$_2$ and MgO).\\
  561. $^2$ From That Guy (1997).
  562. \normalsize
  563. \label{tab:chi}
  564. \end{table}
  565. \subsection*{Tables with rotated text}
  566. Flipping text a certain angle is a feature which is often required. For this purpose we construct a very simple macro in the preamble, here named '\textbf{rot}', which simply rotates the entire object a specified angle (here $90\degree$):
  567. \begin{verbatim}
  568. \newcommand*\rot{\rotatebox{90}}
  569. \end{verbatim}
  570. \noindent To use this, as shown in table~\ref{tab:rot} below, we have used e.g. \verb|\rot{\rlap{MSP}}| to fix in-cell alignment issues.
  571. \begin{table}[h]
  572. \centering
  573. \caption{Rotating text in tables requires the use of exotic macros.}
  574. \begin{tabular}{ccccc}
  575. & $V_{BP}$ & Mean [nm] & $EB^-$ [L,U]& $EB^+$ [L,U] \\
  576. \cmidrule[1pt]{2-5}
  577. \rule{0pt}{4ex}
  578. &0 V & 1.5--1.8 & [1.4, 1.8] & [1.6, 2.2] \\
  579. \rot{\rlap{MSP}}
  580. &-10 V & 1.8--2.1 & [1.6, 2.2]& [1.8, 2.5] \\
  581. \cmidrule[1pt]{2-5}
  582. \rule{0pt}{4ex}
  583. &0 V& 2.9--N/A& [3, 2.5] & [3.4, N/A] \\
  584. \rot{\rlap{ICE}}
  585. &-10 V& 3.3--N/A& [3.0, $>3.5$] & N/A
  586. \end{tabular}
  587. \label{tab:rot}
  588. \end{table}
  589. \clearpage
  590. \section{Lists}
  591. There are a number of different ways to present lists of text or objects in \LaTeX. I simply mention the most common ones below. Note that lists can be nested in \LaTeX.
  592. \subsection*{Bulleted list}
  593. Use \textbf{itemize}.\\
  594. \begin{minipage}{\linewidth}
  595. \centering
  596. \begin{minipage}{0.45\linewidth}
  597. \begin{verbatim}
  598. \begin{itemize}
  599. \item Earth
  600. \item Wind
  601. \item Fire
  602. \end{itemize}
  603. \end{verbatim}
  604. \end{minipage}
  605. \hspace{0.05\linewidth}
  606. \begin{minipage}{0.45\linewidth}
  607. \begin{itemize}
  608. \item Earth
  609. \item Wind
  610. \item Fire
  611. \end{itemize}
  612. \end{minipage}
  613. \end{minipage}
  614. \\
  615. \subsection*{Numbered list}
  616. Use \textbf{enumerate}.\\
  617. \begin{minipage}{\linewidth}
  618. \centering
  619. \begin{minipage}{0.45\linewidth}
  620. \begin{verbatim}
  621. \begin{enumerate}
  622. \item Six
  623. \item Six
  624. \item Six, the
  625. number of the beast
  626. \end{enumerate}
  627. \end{verbatim}
  628. \end{minipage}
  629. \hspace{0.05\linewidth}
  630. \begin{minipage}{0.45\linewidth}
  631. \begin{enumerate}
  632. \item Six
  633. \item Six
  634. \item Six, the number of the beast
  635. \end{enumerate}
  636. \end{minipage}
  637. \end{minipage}\\
  638. \subsection*{Custom description}
  639. Use \textbf{description}. Note that \verb|\hfill| adds a horizontal gap.\\
  640. \begin{minipage}{\linewidth}
  641. \centering
  642. \begin{minipage}{0.45\linewidth}
  643. \begin{verbatim}
  644. \begin{description}
  645. \item[Un] \hfill \\
  646. Bon
  647. \item[Deaux] \hfill \\
  648. Hiver
  649. \item[Trois] \hfill \\
  650. F\'{e}vrier
  651. \end{description}
  652. \end{verbatim}
  653. \end{minipage}
  654. \hspace{0.05\linewidth}
  655. \begin{minipage}{0.45\linewidth}
  656. \begin{description}
  657. \item[Un] \hfill \\
  658. Bon
  659. \item[Deaux] \hfill \\
  660. Hiver
  661. \item[Trois] \hfill \\
  662. F\'{e}vrier
  663. \end{description}
  664. \end{minipage}
  665. \end{minipage}
  666. \chapter{Typesetting plain text and equations}
  667. Text is the most space consuming part of most theses. Accordingly, when writing such a work, much attention should be paid to how the text is typeset. This is indeed the main concern of \LaTeX; to make sure text is formatted correctly. This chapter will shortly discuss how to treat normal text and what one can do with it. We also treat the typesetting of equations, and the use of special characters.
  668. \section{Plain text}
  669. There is no mystery to the topic of text and paragraph formatting in \LaTeX. Again, there is really not any point in an introduction to name-drop all formatting commands out there. Text can be \textbf{bold}, \emph{emphasized}, \underline{underlined}, {\LARGE large} or {\tiny tiny} and in a number of other customized styles. The online documentation of these options is vast and can be easily accessed.
  670. When it comes to paragraphing, the typesetter will do this for you if you a line between paragraphs in your main document. The command '\verb|\\|' will force a line shift. If one wishes to omit the indent of a new paragraph, the command \verb|\noindent| before the first line will do the job.
  671. \section{Equations and special characters}
  672. In theoretical studies, the typesetting of equations and derivations can become a significant time sink. There exists a whole range of equation environments and packages which support special features which prevent need of custom macros (Protip: why implement something if it has already been done for you). I present here the most common environments and will also give an example of an extended derivation which incorporates many of the functions introduced.
  673. \url{http://en.wikibooks.org/wiki/LaTeX/Advanced_Mathematics}
  674. \subsection{Equations in general}
  675. The standard equation environment syntax is as follows:\\
  676. \noindent \begin{minipage}{\linewidth}
  677. \centering
  678. \begin{minipage}{0.45\linewidth}
  679. \begin{verbatim}
  680. \begin{equation}
  681. \lim_{x\rightarrow0} f(x)
  682. = \text{Dog}
  683. \end{equation}
  684. \end{verbatim}
  685. \end{minipage}
  686. \hspace{0.05\linewidth}
  687. \begin{minipage}{0.45\linewidth}
  688. \begin{equation}
  689. \lim_{x\rightarrow0} f(x) = \text{Dog}
  690. \end{equation}
  691. \end{minipage}
  692. \end{minipage}
  693. \\
  694. \\
  695. \noindent Note that the equation is automatically numbered. If you want to remove the equation number, add an asterisk (or add \verb|\nonumber| in the normal environment):\\
  696. \\
  697. \noindent \begin{minipage}{\linewidth}
  698. \centering
  699. \begin{minipage}{0.45\linewidth}
  700. \begin{verbatim}
  701. \begin{equation*}
  702. \lim_{x\rightarrow0} f(x)
  703. = \infty^{Moose}
  704. \end{equation*}
  705. \end{verbatim}
  706. \end{minipage}
  707. \hspace{0.05\linewidth}
  708. \begin{minipage}{0.45\linewidth}
  709. \begin{equation*}
  710. \lim_{x\rightarrow0} f(x) = \infty^{Moose}
  711. \end{equation*}
  712. \end{minipage}
  713. \end{minipage}
  714. \subsection{Math mode: in-line equations}
  715. For in-line equations or parameter specification it is not practical to use the unnumbered equation environment. The \emph{math mode} solves this issue. To use this mode, type your expression between dollar signs: \verb|$...$|. Protip: do not write multiple row expressions such as common fractions in-line. As an example, an in-line substitute for $\frac{\text{mbar}\times \ell}{s}$ can be $\text{mbar}\cdot \ell s^{-1}$. The math mode can also be used for longer expressions, which will be an equivalent for the unnumbered equation environment. To use this, use the square brackets, \verb|\[ ... \]|, and end up with something like:\\
  716. \\
  717. \begin{minipage}{\linewidth}
  718. \centering
  719. \begin{minipage}{0.45\linewidth}
  720. \begin{verbatim}
  721. \[
  722. \int_\mathbb{R} \mathrm{d}
  723. \xi e^{\xi^2} = 42
  724. \]
  725. \end{verbatim}
  726. \end{minipage}
  727. \hspace{0.05\linewidth}
  728. \begin{minipage}{0.45\linewidth}
  729. \[
  730. \int_\mathbb{R} \mathrm{d}
  731. \xi e^{\xi^2} = 42
  732. \]
  733. \end{minipage}
  734. \end{minipage}
  735. \subsection{Special equation environments}
  736. There are a couple of other alternatives which are worthwhile mentioning. In small derivations or sets of coupled equations we often want to typeset lines of equations directly underneath each other. For a good presentation of such systems, the subsequent lines of equations should have some common anchor from which they can be aligned. In the environment \verb|align|, simply use the \verb|&|-character to place the alignment anchor. In the example below, note that this is placed such that all equal signs are aligned. Also note that \verb|\\| specifies a new line, and that \verb|\nonumber| removes the equation number for respective lines.
  737. {\small
  738. \noindent \begin{minipage}{\textwidth}
  739. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  740. \begin{align}
  741. \frac{\mathrm{d}N}{\mathrm{d}t} &= n_0A_pv_{in} \nonumber \\
  742. \frac{\mathrm{d}P_k}{\mathrm{d}t} &= \frac{k_B T}{V_k}
  743. \frac{\mathrm{d}N(t)}{\mathrm{d}t} \nonumber \\
  744. \Rightarrow v_{in} &= \frac{V_k}{n_0A_pT}\cdot \left(
  745. \frac{\mathrm{d}P_k}{\mathrm{d}t}\right)
  746. \end{align}
  747. \end{lstlisting}
  748. \end{minipage}
  749. }
  750. \noindent will produce:
  751. \begin{align}
  752. \frac{\mathrm{d}N}{\mathrm{d}t} &= n_0A_pv_{in} \nonumber \\
  753. \frac{\mathrm{d}P_k}{\mathrm{d}t} &= \frac{k_B T}{V_k} \frac{\mathrm{d}N(t)}{\mathrm{d}t} \nonumber \\
  754. \Rightarrow v_{in} &= \frac{V_k}{n_0A_pT}\cdot \left(\frac{\mathrm{d}P_k}{\mathrm{d}t}\right)
  755. \end{align}
  756. \noindent For piecewise defined functions the \textbf{cases} environment will automatically bracket the definition correctly.\\
  757. {\small
  758. \noindent \begin{minipage}{\textwidth}
  759. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  760. \[
  761. f(n) =
  762. \begin{cases} n/2 &\mbox{if } n \equiv 0 \\
  763. (3n +1)/2 & \mbox{if } n \equiv 1.
  764. \end{cases} \pmod{2}
  765. \]
  766. \end{lstlisting}
  767. \end{minipage}
  768. }
  769. \noindent Produces (note the math mode):
  770. \[
  771. f(n) =
  772. \begin{cases} n/2 &\mbox{if } n \equiv 0 \\
  773. (3n +1)/2 & \mbox{if } n \equiv 1.
  774. \end{cases} \pmod{2}
  775. \]
  776. \section*{An extended example of a derivation}
  777. \ldots We make two assumptions: (I) The dust particle mass is much larger than that of a gas molecule, i.e. $m_D>>m_g$, where $m_D$ and $m_g$ are the masses of single dust and neutral molecules, respectively. (II) The neutral gas molecules have velocities distributed after the Maxwell-Boltzmann distribution, thus in one dimension we obtain:
  778. \begin{equation}\label{cucky}
  779. f(v_g) = \left(\frac{m_g}{2\pi k_BT_g}\right)^\frac{1}{2}\text{exp}\left(-\frac{m_g v_g^2}{2k_BT_g}\right)
  780. \end{equation}
  781. where $f$ is the probability density described in appendix $\infty$.
  782. We consider a small flat surface element of a dust particle which moves through a gas with velocity $\vec{v_d}$. Let the geometry be defined spherically, such that the polar axis is defined as the normal of the surface element. If the dust moves at an angle $\theta$ to this normal, as shown in figure~\ref{fig:collision}, the transfer of momentum to the dust grain in the polar direction becomes:
  783. \begin{equation}\label{mefisto}
  784. \Delta p = 2 m_g(v_g + v_d\cos \theta)
  785. \end{equation}
  786. where we have used the assumption that $m_D>>m_g$.
  787. \begin{figure}[t]
  788. \centering
  789. \begin{tikzpicture}[>=latex,scale=1.3]
  790. \shade[ball color=gray!20!] (0,0) coordinate(O) circle (1.5) ;
  791. \filldraw [draw=black,fill=blue,opacity=0.8]
  792. (0.95,-0.65)--(1.75,-0.35)--(1.65,-1.1)--(0.85,-1.4)--(0.95,-0.65)--cycle ;?\draw[->](1.35,-0.95)--(2,-1.4);
  793. \draw[dashed]
  794. (1.35,-0.95) -- (2.325,-1.3) ;
  795. \draw[dashed]
  796. (1.35,-0.95) -- (2.325,-1.6225) ;
  797. \shade[ball color=gray!40!,opacity=0.9] (1.5,-1) coordinate(Hm) circle (.4) ;
  798. % \draw (4,.2) node[right]{H$^-$} ;
  799. \draw (2.3,-1.3) arc (355:340:1) ;
  800. \node[] at (330:2.85) {$\theta$};
  801. \end{tikzpicture}
  802. \caption{Schematic of geometry in collision between large dust particle and gas molecule. The respective sizes are not in scale.}
  803. \label{fig:collision}
  804. \end{figure}
  805. We take into account the maxwellian nature of the neutral gas molecules, by using eg.~\eqref{cucky}. The probability of a gas molecule having a speed between $v_g$ and $v_g+\mathrm{d}v_g$ in one (the polar) direction is then:
  806. \begin{equation}
  807. f(v_g\rightarrow v_g+\mathrm{d}v_g)=\frac{1}{(\pi)^\frac{1}{2}v_{th,g}}\text{exp}\left(-\frac{1}{2}\frac{v_g^2}{v_{th,g}^2}\right)\mathrm{d}v_g
  808. \end{equation}
  809. where $v_{th,g}=(2k_BT_g/m_g)^\frac{1}{2}$ is the thermal velocity of the neutrals.
  810. A small surface area of the surface of the dust grain is in spherical coordinates given as $\mathrm{d}A= r_d^2\sin \theta \mathrm{d}\theta \mathrm{d}\phi$, where $r_d$ is the dust grain radius, and $\phi$ is the azimuthal coordinate. The collision frequency of neutral molecules on the surface element can be obtained as:
  811. \begin{equation}
  812. \nu_{g,d}=n_g(v_g+v_d\cos \theta)\frac{1}{(\pi)^\frac{1}{2}v_{th,g}}\text{exp}\left(-\frac{1}{2}\frac{v_g^2}{v_{th,g}^2}\right)\mathrm{d}v_g\mathrm{d}A
  813. \end{equation}
  814. where $n_g$ is the neutral gas density. The momentum transfer per unit time along the polar axis is subsequently yielded by multiplying with the term from eq.~\eqref{mefisto}:
  815. \begin{equation}
  816. \frac{\Delta p}{\Delta t} = 2m_gn_g(v_g+v_d\cos \theta)^2\frac{1}{(\pi)^\frac{1}{2}v_{th,g}}\text{exp}\left(-\frac{1}{2}\frac{v_g^2}{v_{th,g}^2}\right)\mathrm{d}v_g\mathrm{d}A
  817. \end{equation}
  818. The component of this force perpendicular to the grain velocity direction will be cancelled through integration over the entire grain surface, thus the drag can be stated as:
  819. \begin{equation}
  820. 2m_gn_gr_d^2(v_g+v_d\cos \theta)^2\frac{1}{(\pi)^\frac{1}{2}v_{th,g}}\text{exp}\left(-\frac{1}{2}\frac{v_g^2}{v_{th,g}^2}\right)\mathrm{d}v_g\sin \theta \cos \theta \mathrm{d}\theta \mathrm{d}\phi
  821. \end{equation}
  822. We obtain the total drag by integrating over all neutral velocities. If $v_g>v_d$, collisions will happen for all collision angles $\theta$, however if $v_g\leq v_d$, collisions will only happen if $\cos \theta > -v_g/v_d$. By using this, we may combine the supersonic and subsonic terms, and we state the total drag as:
  823. \begin{equation}
  824. 2m_gn_gr_d^2\frac{1}{(\pi)^\frac{1}{2}v_{th,g}}(I_1 + I_2)
  825. \end{equation}
  826. where the integrals $I_1$ and $I_2$ are valid for the different velocity regimes:
  827. \begin{align*}
  828. I_1 &= \int_0^{2\pi}\int_{v_d}^\infty\int_0^\pi\mathrm{d}\phi\mathrm{d}v_g\mathrm{d}\theta (v_g+v_d\cos \theta)^2\text{exp}\left(-\frac{1}{2}\frac{v_g^2}{v_{th,g}^2}\right)\sin \theta \cos \theta \\
  829. I_2 &= \int_0^{2\pi}\int_{-v_d}^{+v_d}\int_0^{cos^{-1}(-\frac{v_g}{v_d})}\mathrm{d}\phi\mathrm{d}v_g\mathrm{d}\theta (v_g+v_d\cos \theta)^2\text{exp}\left(-\frac{1}{2}\frac{v_g^2}{v_{th,g}^2}\right)\sin \theta \cos \theta
  830. \end{align*}
  831. These integrals can be calculated in terms of the relative flow of the background neutrals to the dust grain. The final result for the drag term, after inserting for the integrals, then becomes:
  832. \begin{align}
  833. \vec{F}_{drag} &= \pi r_d^2 m_g n_g v_{th,g}(\vec{v}_g-\vec{v}_d)\frac{1}{u}\Biggl\{\frac{1}{\sqrt{\pi}}\left(u + \frac{1}{2u}\right)\text{exp}(-u^2)\nonumber \\
  834. &+ \left(1+u^2-\frac{1}{4u^2}\right) \text{erf}(u)\Biggr\}
  835. \end{align}
  836. where $u=|\vec{v}_d-\vec{v}_g|/v_{th,g}$ is the normalized relative atom flow speed.
  837. \clearpage
  838. \begin{appendices}
  839. \noappendicestocpagenum
  840. \addappheadtotoc
  841. \chapter{How to pronounce \LaTeX}\label{pron}
  842. Who the balls cares?
  843. \end{appendices}
  844. \bibliographystyle{Bibliography/Template_LastNameFirst_Alphabetical}
  845. \bibliography{Bibliography/database_template}
  846. \end{document}