Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Reference Sheet for a Thesis with LATEX2e and KOMA Script, Cheat Sheet of Software Engineering

Useful reference cheat sheet for a thesis with LATEX2e and KOMA Script: examples included.

Typology: Cheat Sheet

2019/2020

Uploaded on 10/23/2020

ekambar
ekambar 🇺🇸

4.7

(22)

18 documents

Partial preview of the text

Download Reference Sheet for a Thesis with LATEX2e and KOMA Script and more Cheat Sheet Software Engineering in PDF only on Docsity! Reference Sheet for a Thesis with LATEX2e and KOMA-Script ß All examples were tested with pdflatex. ß The package mentioned in the headings has to be included (see B.2). ß Compile three times after last change (esp. docs with references). A. LATEX Basics A.1. Units ß Available units for length and dimensions: bp point (typographic) mm millimeter in inch em width of M px pixel (1/72in) cm centimeter pc pica ex height of x ß Document dependent units z\textwidth, z\linewidth, z\columnwidth, z\textheight with z a percentage value, e.g. 0.55\textwidth means 55% of the actual width of the text. ß \baselineskip minimum vertical space between the bottom of two successive lines in a paragraph. ß Amounts like \smallskipamount, \medskipamount, \bigskipamount. A.2. Reserved Characters (see also E.2, cf. H) \ introduces a command \textbackslash { } embraces arguments, creates logical parts \{ \} [ ] embraces optional arguments [ ] % comments: code after % will be ignored. \% & separates columns in tabular-like environments \& # parameter for own command declarations \# $ text style math mode (abbr. for \(. . .\)) \$ _^ index/exponent only valid in math mode, e.g. a21 see E.2 B. Preamble (before \begin{document}) B.1. Documentclass (necessary) Use: \documentclass[opt,opt,. . . ]{class} Recommended classes: scrartcl, scrreprt, scrbook, scrlttr2 Non-KOMA-Script classes: beamer, koma-moderncvclassic Common options with default Values available (subtotal) fontsize=11pt 10pt | 12pt (e.g. 12.5pt also valid) paper=a4, paper=portrait a3 | a5 | b4 | letter, landscape parskip=no half | full headings=big small | normal chapterprefix=false true open=right (scrbook) any (scrartcl, scrreprt) | left captions=oneline nooneline captions=tablebelow,figurebelow tableabove, figureabove toc=nolistof listof | listofnumbered bibliography=totoc | totocnumbered nottotoc twoside=true (scrbook) false (scrartcl, scrreprt) twocolumn=false true draft=false true (show overfull boxes) ß Options of document class are passed to every loaded package. ß Set or change options later in file, e.g. \KOMAoptions{twoside=true} B.2. Loading Packages \usepackage[options]{package} \PassOptionsToPackage[options]{package} B.3. Encoding Settings \usepackage[utf8]{inputenc} % most IDEs use UTF8 \usepackage[T1]{fontenc} % most fonts needs T1  B.4. Language Settings with babel Load: \usepackage[ngerman, main=english]{babel} Use: \selectlanguage{language} \foreignlanguage{language}{text} \documentclass[italian]{scrbook} % global option \usepackage[british,main=italian]{babel} % package option \usepackage{csquotes} % package csquotes knows italian  C. Layout C.1. Changing Page Layout with geometry ß Let KOMA-Script know of geometry by option usegeometry=true. \usepackage[left=2cm, right=2, top=3cm, bottom=4cm, bindingoffset=1cm, inlcudeheadfoot]{geometry}  ß Auto-completion determines unspecified dimensions (under or over specified as well), here width and height of text (see I.9). ß Other options: paper=a4paper, landscape|portrait, includehead, includefoot, includeheadfoot, twocolumn ß Changing page layout mid document: \newgeometry{ opt, opt, ... } C.2. Header and Footer of Page (aka running heading) \lehead \rehead\cehead \lohead \rohead\cohead \ihead \chead \ohead 666 6 6 6 % delete default settings and define your own \usepackage[automark]{scrlayer-scrpage} \clearpairofpagestyles \ohead[]{\headmark} \ofoot[\pagemark]{\pagemark}  % Variant for a thesis with horizontal rules at head and foot \usepackage[headsepline=0.005pt:,footsepline=0.005pt:, plainfootsepline,automark]{scrlayer-scrpage} \clearpairofpagestyles \ohead[]{\headmark} \ofoot[\pagemark]{\pagemark} \ModifyLayer[addvoffset=-.6ex]{scrheadings.foot.above.line} \ModifyLayer[addvoffset=-.6ex]{plain.scrheadings.foot.above.line} \setkomafont{pageheadfoot}{\small}  C.3. Linespread with setspace Load: \usepackage[onehalfspacing]{setspace} for 1.5 line spacing. D. Document Structure (see also L) D.1. Start Document \begin{document} Complete document contents. \end{document} D.2. Title simple title: \author{text} \title{text} \date{\today} \maketitle title page self designed: \begin{titlepage} text \end{titlepage} D.3. Table of Contents, List of Figures (for other List of see E.8 & G) \tableofcontents \listoftables \listoffigures KOMAoption toc=listof (see B.1) generates entries for TOC. D.4. Headings \part{title} \chapter{title} \section{title} \subsection{title} \subsubsection{title} \paragraph{title} \subparagraph{title} ß \chapter only valid in documentclass scrbook and scrreprt ß Use * variants for headings without numbering, no change in counter and no entry in table of contents. ß Use the optional parameter for short titles in headings and table of contents, e.g. \section[short title]{title} ß Use \addpart, \addchap or \addsec for unnumbered headings, but with running heading and entry in table of contents. The * variants delete the running heading. ß Layout of paragraph and subpargraph similar to other headings: \RedeclareSectionCommands[afterskip=1sp]{paragraph,subparagraph} \setcounter{secnumdepth}{\subparagraphnumdepth} \setcounter{tocdepth}{\subparagraphtocdepth} D.5. Justification Environment Declaration Other \begin{center} \centering text \par\vfill text \begin{flushleft} \raggedright text \hfill text \begin{flushright} \raggedleft \raggedbottom, \flushbottom D.6. Lists \begin{itemize} with bullets \item or \item[symbol] \begin{enumerate} with numbers \item \begin{description} with bold words \item[word] \begin{labeling}[separator]{labelinglabel} \item[word] \begin{enumerate} \item First item \item Second item\label{it:second} % see References \end{enumerate}  D.7. Enhanced Lists with enumitem Load: \usepackage{enumitem} Example (for enumerate): \setlist[enumerate,1]{label=\Alph*)} \setlist[enumerate,2]{label=\alph*)} \setlist[enumerate,3]{label=\roman*)} \setlist[enumerate,4]{label=\arabic*)} A) one a) one b) two B) two Example (for legal list): \newlist{legal}{enumerate}{10} \setlist[legal]{label*=\arabic*.,noitemsep} Use: \begin{legal} \item ...\end{legal} 1. one 1.1. two 1.1.1. three 1.1.2. strawberry D.8. Separate Files ß After preamble within the text place:\include{file} Text starts and ends on a new page. file has to be in the same directory as the master file. Otherwise specify a path: \include{path/file} ß In preamble place: \includeonly{file1,file2} to run only these files. ß Use \input{file} includes a file without starting/ending on a new page (\includeonly not valid). E. Text E.1. Paragraphs (≈ “new idea in content”) Paragraphs are separated by an empty line in the code or by \par. A \\ produces a new line – use sparingly, seldom needed outside tabulars. Correct Overfull Box Warnings with more than 4pt (look into log file). E.2. Text Symbols/Characters (see also A.2) A lot of diacritic symbols can be typed directly, e.g. è é ê ñ ç § \S _ \textunderscore{} ~ \textasciitilde{} ^ \textasciicircum{} . . . \ldots | \textbar Other symbols need packages, e.g. € \texteuro (textcomp) E.3. Fonts Command Declaration Effect \textrm{text} {\rmfamily text} Roman family \textsf{text} {\sffamily text} Sans serif family \texttt{text} {\ttfamily text} Typewriter family \textmd{text} {\mdseries text} Medium series \textbf{text} {\bfseries text} Bold series \textup{text} {\upshape text} Upright shape \textit{text} {\itshape text} Italic shape \textsl{text} {\slshape text} Slanted shape \textsc{text} {\scshape text} Small Caps shape More general commands: \emph{text} {\em text} Emphasized \textnormal{text} {\normalfont text} Document font Example: \setkomafont{section}{\scshape} E.4. Font Size Font size is relative to the base font size, specified in the document class. \tiny tiny \scriptsize scriptsize \footnotesize footnotesize \small small \normalsize normalsize \large large \Large Large \LARGE LARGE \huge huge \Huge Huge Use: {\small text} or {\huge text\par} to limit the size change. Example: \setkomafont{pageheadfoot}{\small} E.5. Colors with xcolor \usepackage{xcolor} \definecolor{DarkBlue}{RGB}{0, 115, 207} \colorlet{col_section}{DarkBlue} \textcolor{red}{text in red} or {\color{red}text} \colorbox{gray!25}{color gray faded by 25\%}  Predefined colors: white gray black red green blue cyan magenta yellow Fade a color with color!value between 0 and 100 Headings in color: \setkomafont{disposition}{\color{color}} E.6. Footnotes \footnote{text} Print footnote marker in text and footnote at bottom of page \footnotemark Print footnote marker in text (e.g. within tabu- lar or caption) \footnotetext{text} Print footnote at bottom of page E.7. References with hyperref (loads url implicitly) \autocite{citekey} Cite a bibliographic reference (package biblatex) \label{marker} Set a marker for cross reference, often if the form \label{sec:item} or \label{fig:diag1} \autoref{marker} Give type name and number of marker \autopageref{marker} Give abbreviation of “page” and page number of marker \url{url} Print clickable web page \href[options]{url}{text} Print clickable link \hyperref[marker]{text} Print clickable reference Style: \urlstyle{xx} with xx a style like “tt”, “rm”, “sf” or “same”. Names for autoref (package babel): \renewcaptionname{language}{\typenameautorefname}{text}, e.g. \renewcaptionname{english}{\subsectionautorefname}{section} E.8. Acronyms with acro \usepackage{acro,hyperref,longtable,tabu} %next 5 to praeambel \acsetup{list-style=longtabu,list-heading=addchap} \DeclareAcroListStyle{longtabu}{table}{table=longtabu, table-spec=@{}>{\bfseries}lX@{}} \DeclareAcronym{ecm}{short=EM,long=Electro Machining} ... \ac{EM} or \Ac{EM} for capitalized first letter \printacronyms  F. Figures & Tables (floating environments) F.1. Figures with graphicx Load: \usepackage{graphicx} Use: \includegraphics[opt]{file} (png, jpg, pdf) With ‘figure’ the environment to place a graphic is meant. The figure caption is printed where the caption command is placed in the input. Extra vertical space is controlled by the KOMAoption captions (see B.1). Use: \begin{figure}[pos] ..\caption{..}\label{fig:x} \end{figure} Parameter: pos is a suggestion for placing, it can be ignored by TEX. Possible values are combinations of t (top), h (here), b (bottom), ! (try harder), p (separate page). Hint: Define a path to the graphic files (no blanks in folder names; no special characters in file names) \graphicspath{ {folder/}{folder/}. . . } \graphicspath{ {img/} } %subfolder for images; set in preambel \begin{figure}\centering \includegraphics[width=.8\columnwidth]{pic.jpg} \caption[Short title]{Long title}\label{fig:ff} \end{figure}  ß Numbering throughout the whole document (scrbook) with package chngcntr: \counterwithout{figure}{chapter} (same for table) ß Figure name: \renewcaptionname{language}{\figurename}{text} \renewcaptionname{language}{\figureautorefname}{text} typesetted with cmbright, August 18, 2017 F.2. Subfigures with subcaption Load: \usepackage{subcaption} Use: \begin{subfigure}[pos]{width} . . . \end{subfigure} \begin{figure}[ht] \centering \begin{subfigure}[t]{0.5\textwidth} \centering \includegraphics[height=1.2in]{figure-a} \caption{Subcaption 1}\label{fig:SubFig1}\end{subfigure} \begin{subfigure}[t]{0.5\textwidth} \centering \includegraphics[height=1.2in]{figure-b} \caption{Subcaption 2}\label{fig:SubFig2}\end{subfigure} \caption{Caption of complete figure}\label{fig:Fig1} \end{figure}  F.3. Tables width aligned material With ‘table’ the environment to place aligned material is meant. The table caption is printed where the caption command is placed in the input. For positioning options see F.1. \KOMAoptions{captions=tableabove} % move to praeambel \begin{table}[htbp] \centering \caption{Table caption}\label{tab:exp} \begin{tabular}{@{}ll@{}} \emph{Name} & \emph{Desc.}\\ \hline tikz2pdf & Python script\\ LaTable & visual table editor \end{tabular} \end{table}  Use: \begin{tabular}[c b t]{@{} l r c | p{unit}} Column separation: @{\hspace{unit}} or \setlength{\tabcolsep}{unit} Row separation: \\[unit] or \renewcommand{\arraystretch}{unit} Partial lines: \cline{2-3} instead of \hline Additional packages: array, longtable, booktabs, tabu, xcolor with option table, tabularx, tabulary F.4. Colored Table \usepackage[table]{xcolor} % move to praeambel \rowcolors{1}{}{lightblue} % {start row}{odd-row}{even-row} \begin{tabular}{clr} ... \end{tabular}  F.5. Suppress Floating with float For a thesis most students want to control the placing of figures and tables themselves. One way is more control with placeins. Another way is to avoid the environments figure and table using \captionof. Quick and dirty is an additional positioning parameter using float: Load: \usepackage{float,scrhack} Use: \begin{figure}[H], \begin{table}[H] F.6. Source Code Listings with listings Load: \usepackage{listings} Options: \lstset{ basicstyle=\ttfamily\small, language=Python, numbers=left, keywordstyle=\color{blue}\bfseries } See option literate for Umlauts (literate={ä}{{\"a}}1) Languages: C, C++, Java, Matlab, Python, HTML, XML, . . . Use: Environment: \begin{lstlisting} code \end{lstlisting} In line: \lstinline+code+ (same start- and end char) File: \lstinputlisting{filename} 1 # Python selection 2 secret=42 3 guess=int(input("Enter number: ")) 4 if guess==secret: 5 print ("You won!") 6 elif guess<secret: 7 print ("No, secret number bigger.") 8 else: 9 print ("No, secret number is smaller.") F.7. Boxes and Rules Normal: \parbox[pos][height][contentpos]{width}{text} or \begin{minipage}[pos][height][contentpos]{width}text\end{minipage} Lift Text: \raisebox{lift}[height][depth]{text} Framed Box: \fbox{text} or \framebox[width][pos]{text} Colored Box (xcolor): \colorbox{backgroundcolor}{text} Framed colored Box: \fcolorbox{bordercolor}{backgroundcolor}{text} Resize (graphicx): \scalebox{10}{Giant} Lengths: \setlength{\fboxsep}{unit}, \setlength{\fboxrule}{unit} G. Bibliography with biblatex & External Processor biber G.1. Entry types @article @book @inbook @collection @incollection @manual @misc @online @patent @phdthesis @proceedings @periodical @report @techreport @thesis G.2. Entry Fields (example see L) author title journal year volume editor publisher institution school series pages organization number note key G.3. Styles alphabetic authoryear authortitle numeric mla verbose chem-acs phys nature science ieee apa See https://de.sharelatex.com/learn/Biblatex_bibliography_styles G.4. Example % in preambel \usepackage[autostyle=true]{csquotes} % Load \usepackage[backend=biber,style=nature,language=british] {biblatex} % Load \addbibresource{mybibliographyfile.bib} % Define % anywhere within the document \autocite{citekey} % Use \printbibliography % Print  KOMAoption bibliography (see B.1) generates entry for TOC. G.5. External Processor IDEs like TEXstudio include the external processor, select biber as bibliography tool for ‘build’ in preferences, otherwise run biber explicitly. H. Math H.1. Math mode (Standard LATEX) Textstyle: \(x^2 + 4\) x2 + 4 as part of the text. Displaystyle: \[ x^2 + 4 \] separat line, centered Equation: \begin{equation} . . . \end{equation}\label{name} λ := lim x1→∞ x1∫ x0 f ( t 2 ) n √ t2 + sin2(t) dt ! ≤ 1 (1) ß Use * variant for unnumbered equation (without label). ß Package option for equation position: fleqn fixed indent from the left margin instead of centered. ß Options for positions of equation number: leqno or reqno. H.2. Important Symbols in Math + + − - ± \pm ∓ \mp < < ≤ \le  \ll · \cdot > > ≥ \ge  \gg × \times = = 6= \ne ≡ \equiv ≈ \approx | | ⊥ \perp | \mid ‖ \parallel f ′ f’ ∇ \nabla ∆ \Delta ∂ \partial ∈ \in ∀ \forall ∃ \exists @ \nexists ∩ \cap ∪ \cup /∈ \notin \ \setminus ` \ell ∠ \angle ◦ \circ ∅ \emptyset ∨ \lor ∧ \land ¬ \lnot ∅ \varnothing > \top ⊥ \bot ∞ \infty ∝ \propto H.3. Math Functions (upright typeface) \arccos \arcsin \arctan \arg \cos \cosh \cot \coth \csc \deg \det \dim \exp \gcd \hom \inf \ker \lg \lim \liminf \limsup \ln \log \max \min \Pr \sec \sin \sinh \sup \tan \tanh For other functions use (package amsmath): \operatorname{name}, e.g. \operatorname{arcsinh} (see also J.2). H.4. More Math Functions∑ \sum ∏ \prod ∐ \coprod∫ \int ∫∫ \iint ∫∫∫ \iiint ∮ \oint ~a \vec{a} ȧ \dot{a} ä \ddot{a} â \hat{a} H.5. Fonts and Sizes in Math Mode (some from AMSMath) \mathrm{}, \mathit{}, \mathbf{}, \mathsf{}, \mathtt{}, \boldmath{} \mathbb{} e.g. AZ, \mathcal{} e.g. AZ, \mathfrak{} e.g. AZ \displaystyle, \scriptstyle, \scriptscriptstyle, \textstyle \boldsymbol{} H.6. Often used Math Expressions xn+1 x^{n+1} Ekin E_{\mathrm{kin}} a + b 2 \frac{a+b}{2} n √ a2 + b2 \sqrt[n]{a^2+b^2} x1, . . . , xn x_1, \ldots, x_n x1 + · · ·+ xn x_1 + \cdots + x_n( a + 1 2 )2 \left( a + \frac{1}{2} \right)^2 N∑ i=1 N∏ i=1 \sum_{i=1}^{N} \prod_{i=1}^{N} lim a→∞ \lim _{a \rightarrow \infty} b∫ a x2 dx \int_a^b x^2\; \mathrm{d}x df dx ∣∣∣∣ x0 \left. \frac{\mathrm{d}f}{\mathrm{d}x} \right|_{x_0} F⊥ F ‖ \myvec{F}_{\perp} 1 \myvec{F}_{\parallel}1 a> A† A∗ \myvec{a}^{\top}1 A^{\dagger} \boldmath{A}^{*} ! < def = \stackrel{!}{<} \stackrel{\mathrm{def}}{=} above mid mid below \overset{above}{mid} \underset{below}{mid} 1\newcommand{\myvec}[1]{\ensuremath{\underline{\boldsymbol{#1}}}} H.7. Math with amsmath (replacing standard Environments) equation equation* One line, one equation multline multline* One unaligned multiple-line equation, one number gather gather* Several equations without alignment align align* Several equations with multiple alignments alignat alignat* Multiple alignments, choose spacing between cols flalign flalign* Several equations: horizontally spread form of align cases Alignment for cases split A simple alignment within a multiple-line equation aligned A “mini-page” with multiple alignments gathered A “mini-page” with unaligned equations ß The content is automatically placed in math mode. ß Use \intertext{text} to set text within an amsmath environment ß Length parameter to influence vertical spacing within any amsmath environment: \jot (e.g. \addtolength{\jot}{1ex}) ß Add singular vertical space for a line via \\[<amount>] (see A.1) ß Use the spreadlines environment from the mathtools package ß Length parameters (with standard values) to influence vertical white space around displayed math formulas: \abovedisplayskip=12pt, \belowdisplayskip=12pt, \abovedisplayshortskip=0pt, \belowdisplayshortskip=7pt H.7.1. AMSMath align \begin{align} y &= d\\ y &= cx+d\nonumber\\ y &= bx^{2}+cx+d \label{eq:key} \end{align} y = d (1) y = cx + d y = bx2 + cx + d (2) \begin{align*} y &= d & z &= 1\\ y(x) &= cx+d & z &= x+1\\ y_{12} &= bx^2+cx & z &= x^2+x+1 \end{align*} y = d z = 1 y(x) = cx + d z = x + 1 y12 = bx 2 + cx z = x2 + x + 1 H.7.2. AMSMath alignat \begin{alignat}{3} % 2x3-1 ’&’ are neccessary i_{11} &=0.25 & i_{12} &=i_{21} & i_{13} &=i_{23}\\ i_{21} &=\frac{1}{3}i_{11} & i_{22} &=0.5i_{12} & i_{23} &=i_{31}\\ i_{31} &=0.33i_{22} \quad & i_{32} &=0.15i_{32} \quad & i_{33} &=i_{11} \end{alignat} i11 = 0.25 i12 = i21 i13 = i23 (1) i21 = 1 3 i11 i22 = 0.5i12 i23 = i31 (2) i31 = 0.33i22 i32 = 0.15i32 i33 = i11 (3) H.7.3. AMSMath flalign \begin{flalign*} i_{11} & =0.25 & i_{12} & =i_{21} & i_{13} & =i_{23}\\ i_{21} & =\frac{1}{3}i_{11} & i_{22} & =0.5i_{12} & i_{23} & =i_{31}\cdot\sqrt{5}\\ i_{31} & =0.33i_{22} & i_{32} & =0.15i_{32} & i_{33} & =i_{11} \end{flalign*} i11 = 0.25 i12 = i21 i13 = i23 (1) i21 = 1 3 i11 i22 = 0.5i12 i23 = i31 · √ 5 (2) i31 = 0.33i22 i32 = 0.15i32 i33 = i11 (3) H.7.4. AMSMath gather \begin{gather} D(a,r) \equiv \{z \in \mathbf{C} \colon |z-a| < r \} \notag\\ \operatorname{seg} (a,r) \equiv \{ z \in \mathbf{C} \colon \Im z < \Im a, \ |z-a| < r \}\\ C (E, \theta, r) \equiv \bigcup_{e\in E} c (e, \theta, r) \end{gather} D(a, r) ≡ {z ∈ C: |z − a| < r} seg(a, r) ≡ {z ∈ C: =z < =a, |z − a| < r} (1) C(E, θ, r) ≡ ⋃ e∈E c(e, θ, r) (2) H.7.5. AMSMath matrix \begin{matrix} a & b \\ c & d \end{matrix} \begin{pmatrix} a & b \\ c & d \end{pmatrix} \begin{bmatrix} a & b \\ c & d \end{bmatrix} \begin{Bmatrix} a & b \\ c & d \end{Bmatrix} \begin{vmatrix} a & b \\ c & d \end{vmatrix} \begin{Vmatrix} a & b \\ c & d \end{Vmatrix} a b c d ( a b c d ) [ a b c d ] { a b c d } ∣∣∣∣∣a bc d ∣∣∣∣∣ ∥∥∥∥∥a bc d ∥∥∥∥∥ Dots: \dots or \ldots lower dots, \cdots vertically centered dots, \vdots vertical dots, \ddots diagonal dots, \hdotsfor[cols]{dotspace} multicolumn dots. H.8. AMSMath cases \[ f(n) = \begin{cases} n/2 & \quad \text{if $n$ is even}\\ -(n+1)/2 & \quad \text{if $n$ is odd}\\ \end{cases} \] f (n) = { n/2 if n is even −(n + 1)/2 if n is odd H.9. Arrows 7→ \mapsto \leadsto → \rightarrow ⇒ \Rightarrow −→ \longrightarrow =⇒ \Longrightarrow ← \leftarrow ⇐ \Leftarrow ←− \longleftarrow ⇐= \Longleftarrow ↑ \uparrow ⇑ \Uparrow ↓ \downarrow ⇓ \Downarrow ↔ \leftrightarrow ⇔ \Leftrightarrow ⇔ \leftleftarrows ⇒ \rightrightarrows  \leftrightarrows  \rightleftarrows \leftrightharpoons \rightleftharpoons
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved