LaTeX_Course_Slides.tex 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. \documentclass{beamer}
  2. %
  3. % Choose how your presentation looks.
  4. %
  5. % For more themes, color themes and font themes, see:
  6. % http://deic.uab.es/~iblanes/beamer_gallery/index_by_theme.html
  7. %
  8. \mode<presentation>
  9. {
  10. \usetheme{default} % or try Darmstadt, Madrid, Warsaw, ...
  11. \usecolortheme{rose} % or try albatross, beaver, crane, ...
  12. \usefonttheme{serif} % or try serif, structurebold, ...
  13. \setbeamertemplate{navigation symbols}{}
  14. \setbeamertemplate{caption}[numbered]
  15. }
  16. \usepackage[english]{babel}
  17. \usepackage[utf8x]{inputenc}
  18. \usepackage{etex}
  19. \usepackage{amsmath,amsfonts,amssymb,amsthm,mathtools} % Most people will need these for mathematics
  20. %Figures
  21. \usepackage{graphicx} %Graphics package
  22. \usepackage[center]{caption}
  23. \usepackage{subcaption}
  24. \usepackage{wrapfig} % Wrap text around figures
  25. \usepackage{float} % To place figures correctly
  26. \usepackage{makeidx} % Probably important.
  27. \usepackage{listings} % To include code-snippets
  28. \usepackage{color}
  29. \usepackage{hyperref} % Clickable links to urls, internal and external references etc.
  30. \lstset{
  31. basicstyle=\footnotesize\ttfamily,
  32. identifierstyle=\bfseries\color{green!40!black},
  33. commentstyle=\itshape\color{purple!40!black},
  34. keywordstyle=\color{blue},
  35. stringstyle=\color{orange},
  36. }
  37. \usepackage[authoryear,square]{natbib} % References/bibliography package
  38. \usepackage{lipsum} % Make dummy text
  39. % Table packages
  40. \usepackage{tabularx}
  41. \usepackage{array}
  42. \usepackage{booktabs}
  43. \newcommand*\rot{\rotatebox{90}}
  44. \usepackage{changepage}
  45. \usepackage{verbatim}
  46. \usepackage{cprotect}
  47. \usepackage{cancel}
  48. %Special in-document vector graphics:
  49. \usepackage{tikz}
  50. \usetikzlibrary{shapes.geometric,calc,positioning,3d,intersections,arrows}
  51. \usetikzlibrary{decorations.markings}
  52. \usepackage{pgfplots}
  53. % Custom characters
  54. \newcommand{\slfrac}[2]{\left.#1\middle/#2\right.} % Long on-line fraction-slash: \slfrac
  55. \newcommand{\degree}{\ensuremath{^\circ}} % The 'degree' character : \degree
  56. \DeclareRobustCommand{\orderof}{\ensuremath{\mathcal{O}}} % The 'Order of' character: \orderof
  57. \title[Pragmatic \LaTeX]{\LaTeX -- A pragmatic approach to typesetting your thesis}
  58. \author{Tarjei Antonsen}
  59. \institute{University of Troms\o}
  60. \date{\today}
  61. \begin{document}
  62. \begin{frame}
  63. \titlepage
  64. \end{frame}
  65. % Uncomment these lines for an automatically generated outline.
  66. %\begin{frame}{Outline}
  67. % \tableofcontents
  68. %\end{frame}
  69. \begin{frame}{Outline}
  70. \tableofcontents
  71. \end{frame}
  72. \section{Introduction}
  73. %Frame%
  74. \begin{frame}{Introduction -- Preliminaries}
  75. \begin{itemize}
  76. \item The preamble
  77. \item The \TeX-document
  78. \item Dispositions
  79. \end{itemize}
  80. \vskip 1cm
  81. \begin{block}{Protip}
  82. Be careful with poshing up your thesis too much. Try too keep the style clean, classic and tasteful!
  83. \end{block}
  84. \end{frame}
  85. %Frame%
  86. \subsection{The preamble}
  87. \begin{frame}[fragile]{The preamble}
  88. \begin{minipage}{0.42\textwidth}
  89. \begin{itemize}
  90. \item Where the document format and global packages and commands are imported and defined.
  91. \item Everything before '\verb|\begin{document}|'.
  92. \item Custom commands may be defined here.
  93. \end{itemize}
  94. \end{minipage}
  95. \begin{minipage}{0.55\textwidth}
  96. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  97. %Document format
  98. \documentclass[11pt, a4paper,
  99. twoside, titlepage]{book}
  100. \usepackage[latin1]{inputenc}
  101. %Maths
  102. \usepackage{amsmath,
  103. amsfonts,
  104. amssymb,
  105. amsthm,mathtools}
  106. %Figures
  107. \usepackage{graphicx}%Graphics
  108. \usepackage[center]{caption}
  109. \usepackage{subcaption}
  110. \usepackage{wrapfig}
  111. \usepackage{float}
  112. . . .
  113. \end{lstlisting}
  114. \end{minipage}
  115. \end{frame}
  116. \subsection{The main \TeX-document}
  117. \begin{frame}[fragile]{The main \TeX-document}
  118. \begin{minipage}{0.55\textwidth}
  119. \begin{itemize}
  120. \item The .tex-file which contains 'everything', and most importantly your thesis.
  121. \item Text can be written directly here or imported with the '\verb|\include{}|'-command.
  122. \item The hierarchy shown here should be employed:
  123. \end{itemize}
  124. \end{minipage}
  125. \begin{minipage}{0.43\textwidth}
  126. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  127. \chapter{...}
  128. \section{...}
  129. \subsection{...}
  130. \subsubsection{...}
  131. %Unnumbered:
  132. \subsection*{...}
  133. \end{lstlisting}
  134. \end{minipage}
  135. \end{frame}
  136. \subsection{Disposition}
  137. %Frame%
  138. \begin{frame}{Disposition of thesis I}
  139. \begin{description}
  140. \item[I] \hfill \\
  141. \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.
  142. \item[II] \hfill \\
  143. \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.
  144. \item[III] \hfill \\
  145. \textbf{Methods}. Your approach to the problem. You may describe how your methods differ from other approaches here.
  146. \end{description}
  147. \end{frame}
  148. \begin{frame}{Disposition of thesis II}
  149. \begin{description}
  150. \item[IV] \hfill \\
  151. \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.
  152. \item[V] \hfill \\
  153. \textbf{Results}. Present and thoroughly describe your findings.
  154. \item[VI] \hfill \\
  155. \textbf{Discussion}. Discuss your findings. Assess the successfulness of your approach. Discuss how your work contributes to the current literature.
  156. \item[VII] \hfill \\
  157. \textbf{Conclusions}
  158. \end{description}
  159. \end{frame}
  160. \begin{frame}
  161. \frametitle{ \\ \centerline{\textbf{\huge Problem}}}
  162. \begin{minipage}{0.52\textwidth}
  163. Import a package which produces dummy text, and use this to produce a few paragraphs. \\
  164. Vary the style and size of the text.
  165. \end{minipage}
  166. \begin{minipage}{0.45\textwidth}
  167. \emph{\tiny \lipsum[1]}
  168. \end{minipage}
  169. \end{frame}
  170. % New section
  171. \section{Referencing}
  172. \begin{frame}{Referencing}
  173. \begin{itemize}
  174. \item Backing up your work with references to other peer reviewed studies is the most important step in ensuring its credibility.
  175. \item Internal referencing and citing external works will be presented here.
  176. \end{itemize}
  177. \begin{figure}
  178. \includegraphics[width=0.7\textwidth]{Figures/bibentry_example}
  179. \caption{\label{fig:bibentry}Example of a properly formatted entry in the bibliography.}
  180. \end{figure}
  181. \end{frame}
  182. %New frame
  183. \subsection{Internal references}
  184. \begin{frame}[fragile]{Internal references}
  185. \begin{minipage}{0.48\textwidth}
  186. \begin{itemize}
  187. \item All internal references are named with the \textbf{label}-command.
  188. \item Practical when summarizing what e.g. a chapter discusses.
  189. \item Equations are cited differently than figures and sections etc.!
  190. \end{itemize}
  191. \end{minipage}
  192. \begin{minipage}{0.49\textwidth}
  193. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  194. %Label:
  195. \label{REF1}
  196. %Figures, Chpts, tabs etc.
  197. \ref{REF1}
  198. %Equations
  199. \eqref{REF1}
  200. \end{lstlisting}
  201. \end{minipage}
  202. \end{frame}
  203. %New frame
  204. \subsection{A proper bibliography}
  205. \begin{frame}[fragile]{A proper bibliography -- Getting started}
  206. \begin{minipage}{0.53\textwidth}
  207. \begin{itemize}
  208. \item We combine \textbf{natbib} with \textbf{BibTeX} to get the best result. A few prerequisites to handle this are merely a few lines of code.
  209. \item This combination is highly customizable, and a custom style for a typical thesis is made for this course.
  210. \item To compile: $\LaTeX \rightarrow BibTeX\rightarrow \LaTeX\ \rightarrow \LaTeX$
  211. \end{itemize}
  212. \end{minipage}
  213. \begin{minipage}{0.45\textwidth}
  214. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  215. %In the preamble:
  216. \usepackage[authoryear,
  217. square]{natbib}
  218. %Before \end{document}
  219. \bibliographystyle{
  220. Template_LastNameFirst...
  221. _Alphabetical}
  222. \bibliography
  223. {database_template}
  224. \end{lstlisting}
  225. \end{minipage}
  226. \end{frame}
  227. %New Frame
  228. \begin{frame}[fragile]{A proper bibliography -- Style and preferences}
  229. \begin{itemize}
  230. \item The style of citations is specified in the preamble, as shown previously. The style of the bibliography can be a bit trickier. To avoid using time on this issue, use the customized style made for this course named ''\verb|Template_LastNameFirst_Alphabetical.bst|''. This will sort the entries alphabetically after the last name of the first author.
  231. \end{itemize}
  232. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  233. %Add right before \end{document}:
  234. \bibliographystyle{.../Template_LastNameFirst_Alphabetical}
  235. \bibliography{.../database_template}
  236. \end{lstlisting}
  237. \end{frame}
  238. %New Frame
  239. \begin{frame}[containsverbatim]{A proper bibliography -- The database file}
  240. \begin{itemize}
  241. \item All references are stored in a .bib file (a text file). The simplest modification of this file is to paste new entries directly into it. Special software may also be used for this purpose.
  242. \item An example file named ''\verb|database_template.bib|'' is included here.
  243. \item Some common reference types are 'article', 'phdthesis', 'inproceedings' and 'book'.
  244. \end{itemize}
  245. \begin{block}{Protip}
  246. Where possible, always use the primary source in your references. Try to avoid using secondary and tertiary sources; webpages, 'references therein' etc.
  247. \end{block}
  248. \end{frame}
  249. %New Frame
  250. \begin{frame}[fragile]{A proper bibliography -- A database entry}
  251. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  252. @article {havnes96,
  253. author = {Havnes, O. and Tr{\o}im, J. and Blix,
  254. T. and Mortensen, W. and N{\ae}sheim,
  255. L. I. and Thrane, E. and T{\o}nnesen, T.},
  256. title = {First detection of charged dust
  257. particles in the {E}arth's mesosphere},
  258. journal = {Journal of Geophysical Research:
  259. Space Physics},
  260. volume = {101},
  261. number = {A5},
  262. issn = {2156-2202},
  263. doi = {10.1029/96JA00003},
  264. pages = {10839--10847},
  265. year = {1996},
  266. }
  267. \end{lstlisting}
  268. \end{frame}
  269. %New Frame
  270. \begin{frame}[containsverbatim]{A proper bibliography -- Using the database}
  271. \begin{itemize}
  272. \item There are two main ways to cite a work with \textbf{natbib}:
  273. \begin{itemize}
  274. \item \verb|\citet{...}| produces the normal format, i.e. Someone et al. (2008).
  275. \item \verb|\citep{...}| produces the citation in parenthesis, i.e. (Someone et al., 2008).
  276. \end{itemize}
  277. \item Other citation commands can be found in the online documentation.
  278. \end{itemize}
  279. \begin{block}{Protip}
  280. A typical bibliography entry is at least a couple of hundred characters long. In other words, you will save a lot of time importing the references from the publisher online as compared to manually punching them into you database.
  281. \end{block}
  282. \end{frame}
  283. % New frame
  284. \begin{frame}
  285. \frametitle{ \\ \centerline{\textbf{\huge Problem}}}
  286. \begin{columns}[c]
  287. \column{2.0in}
  288. Find the article '\emph{Broken Symmetries and the Masses of Gauge Bosons}' online, export the citation and use it with different styles!
  289. \column{2.3in}
  290. \framebox{\includegraphics[width=2.3in]{Figures/higgs}}
  291. \end{columns}
  292. \end{frame}
  293. %New section
  294. \section{Typesetting plain text and equations}
  295. \begin{frame}{Typesetting plain text and equations}
  296. The main treatment of these subjects is left to the compendium.
  297. \vspace{2cm}
  298. \begin{block}{Protip}
  299. Always look for macros or packages to simplify the typesetting of text or maths you use a lot. Packages made especially for typesetting e.g. quantum physics exist.
  300. \end{block}
  301. \end{frame}
  302. % New frame
  303. \subsection{Plain text}
  304. \begin{frame}[fragile]{Plain text}
  305. \begin{minipage}{0.50\textwidth}
  306. \begin{itemize}
  307. \item The main concern in text formatting with \LaTeX, is the style of the text it self (weight, font, size etc.). Some common commands are given in the box on the right.
  308. \item The layout takes care of itself (most often).
  309. \item WikiBook entry: \url{http://en.wikibooks.org/wiki/LaTeX/Text_Formatting}.
  310. \end{itemize}
  311. \end{minipage}
  312. \begin{minipage}{0.45\textwidth}
  313. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  314. %Bold (Text/Math-mode):
  315. \textbf{} / \mathbf{}
  316. %Emphasized
  317. \emph{}
  318. %Suppress indent
  319. \noindent
  320. %Local text size
  321. {\tiny ...} {\Huge} etc.
  322. %Underlined
  323. \underline{...}
  324. %Arrow vector (Math-m.)
  325. $\vec{...}$
  326. \end{lstlisting}
  327. \end{minipage}
  328. \end{frame}
  329. % New frame
  330. \subsection{Equations}
  331. \begin{frame}{Equations}
  332. \begin{itemize}
  333. \item General equation typesetting is handled in the compendium with an extended example; check it out.
  334. \item As one gains experience, the time spent on typesetting equations will decay exponentially.
  335. \item \emph{Mathematica} can save you a lot of time, because of its fast shortcuts.
  336. \item Useful WikiBook entry: \url{http://en.wikibooks.org/wiki/LaTeX/Mathematics}.
  337. \end{itemize}
  338. \begin{block}{Protip}
  339. Vectors are defined by default with arrows. If you want bold vectors, a custom macro or package must be used.
  340. \end{block}
  341. \end{frame}
  342. % New frame
  343. \begin{frame}
  344. \frametitle{ \\ \centerline{\textbf{\huge Problem}}}
  345. Typeset the following equations:
  346. \begin{equation}
  347. \underbrace{ \pi r_d^2n_gv_{th,g}\cdot k_B T_g}_{P_N} =\frac{4\pi}{3}\rho_d r_d^3c_p\frac{\mathrm{d}T_d}{\mathrm{d}t} + L_d \frac{\mathrm{d} m_d}{\mathrm{d}t}
  348. \end{equation}
  349. \begin{equation}
  350. \slfrac{\frac{\mathrm{d}T_d}{\mathrm{d}t} = \left(\hat{P}-L_d \frac{\mathrm{d}m_d}{\mathrm{d}t}\right)}{\frac{4\pi}{3}\rho_d r_d^3 c_p}
  351. \end{equation}
  352. \begin{align}
  353. \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 \\
  354. &+ \left(1+u^2-\frac{1}{4u^2}\right) \text{erf}(u)\Biggr\}
  355. \end{align}
  356. \end{frame}
  357. %New section
  358. \section{Figures and Tables}
  359. \begin{frame}{Figures and Tables}
  360. \begin{itemize}
  361. \item Like in equation typesetting, the environments for figures and tables are many.
  362. \item We treat the topic with help from the compendium.
  363. \item Floats and format are topics to note!
  364. \item Matlab can be used to export decent looking figures.
  365. \end{itemize}
  366. \end{frame}
  367. \subsection{Figures}
  368. %New frame
  369. \begin{frame}[fragile]{Figures -- A typical entry}
  370. The commands \verb|\usepackage{graphics}| and \verb|\usepackage{float}| should be specified in the preamble. The following command set typesets a figure:
  371. \vspace{1cm}
  372. \begin{lstlisting}[language={[LATEX]TeX},frame=single]
  373. \begin{figure}
  374. \includegraphics[width=\textwidth]{.../filename}
  375. \caption{\label{fig:your-figure}Caption goes here.}
  376. \end{figure}
  377. \end{lstlisting}
  378. \end{frame}
  379. %New frame
  380. \subsection{Tables}
  381. \begin{frame}[containsverbatim]{Tables}
  382. \begin{itemize}
  383. \item The placement of a table is identical to figure placement. Note that the caption should be above.
  384. \item Use the \verb|tabular|-environment.
  385. \item Matlab can be also be used to export tables.
  386. \item Tables can contain graphical objects.
  387. \end{itemize}
  388. \end{frame}
  389. \subsection{TikZ}
  390. \begin{frame}{TikZ}
  391. \begin{itemize}
  392. \item TikZ is an option to make in document vector graphics.
  393. \item Super nice and often super frustrating.
  394. \item Makes your figures fitting for even the most prestigious journals, if used correctly.
  395. \item See the compendium for a few examples.
  396. \end{itemize}
  397. \begin{block}{Protip}
  398. Using TikZ will most likely cause death.
  399. \end{block}
  400. \end{frame}
  401. \begin{frame}
  402. \frametitle{ \\ \centerline{\textbf{\huge Problem}}}
  403. \begin{columns}[c]
  404. \column{1.5in}
  405. Make a table, import an image and typeset them corresponding to proper formatting.
  406. \column{1.5in}
  407. \framebox{\includegraphics[width=1.5in]{Figures/figure_wrapped}}
  408. \end{columns}
  409. \end{frame}
  410. % Commands to include a figure:
  411. %\begin{figure}
  412. %\includegraphics[width=\textwidth]{your-figure's-file-name}
  413. %\caption{\label{fig:your-figure}Caption goes here.}
  414. %\end{figure}
  415. \end{document}
  416. \end{document}