LATEX Cheat Sheet” LATEX4EI, 2013 (B) Tammo Schwindt, DHBW Mosbach, “Latex Sheet German”, Ed
Total Page:16
File Type:pdf, Size:1020Kb
Reference Sheet for a Thesis C. Layout D.6. Lists E.5. Colors with xcolor symbol with LAT X2e and KOMA-Script C.1. Changing Page Layout with geometry \begin{itemize} with bullets \item or \item[ ] E \usepackage{xcolor} ª Let KOMA-Script know of geometry by option usegeometry=true. \begin{enumerate} with numbers \item ª \definecolor{DarkBlue}{RGB}{0, 115, 207} All examples were tested with pdflatex. \begin{description} \item[word] § with bold words \colorlet{col_section}{DarkBlue} ª The package mentioned in the headings has to be included (see B.2). \usepackage[left=2cm, right=2, top=3cm, bottom=4cm, \begin{labeling}[separator ]{labelinglabel} \item[word] \textcolor{red}{text in red} or {\color{red}text} ª Compile three times after last change (esp. docs with references). bindingoffset=1cm, inlcudeheadfoot]{geometry} § \colorbox{gray!25}{color gray faded by 25\%} \begin{enumerate} ª Auto-completion determines unspecified dimensions (under or over A. LATEX Basics § \item First item Predefined colors: specified¦ as well), here width and height of text (see I.9). ¥ \item Second item\label{it:second}% see References ª ¦white gray black red green blue cyan magenta yellow ¥ A.1. Units Other options: paper=a4paper, landscape|portrait, includehead, \end{enumerate} Fade a color with color !value between 0 and 100 ª Available units for length and dimensions: includefoot, includeheadfoot, twocolumn ª \newgeometry{ opt, opt, ... } Headings in color: \setkomafont{disposition}{\color{color }} bp point (typographic) mm millimeter in inch em width of M Changing page layout mid document: px pixel (1=72in) cm centimeter pc pica ex height of x D.7.¦ Enhanced Lists with enumitem ¥ E.6. Footnotes ª Document dependent units z\textwidth, z\linewidth, C.2. Header and Footer of Page (aka running heading) Load: \usepackage{enumitem} z\columnwidth z\textheight z lehead cehead rehead lohead cohead rohead Example (for enumerate): \footnote{text} Print footnote marker in text and footnote at , with a percentage value, e.g. \ \ \ \ \ \ 0.55\textwidth \setlist[enumerate,1]{label=\Alph )} A) one means 55% of the actual width of the text. 6 6 6 6 6 6 * bottom of page ihead ª \baselineskip \ \setlist[enumerate,2]{label=\alph )} a) one minimum vertical space between the bottom of two chead * \footnotemark Print footnote marker in text (e.g. within tabu- \ ohead successive lines in a paragraph. \ \setlist[enumerate,3]{label=\roman*)} b) two lar or caption) ª Amounts like \smallskipamount, \medskipamount, \bigskipamount. \setlist[enumerate,4]{label=\arabic*)} B) two \footnotetext{text} Print footnote at bottom of page % delete default settings and define your own Example (for legal list): \usepackage[automark]{scrlayer-scrpage} 1. one A.2. Reserved Characters (see also E.2, cf.H) § \newlist{legal}{enumerate}{10} \clearpairofpagestyles 1.1. two E.7. References with hyperref (loads url implicitly) \ohead[]{\headmark} \ofoot[\pagemark]{\pagemark} \setlist[legal]{label*=\arabic*.,noitemsep} \ introduces a command \textbackslash 1.1.1. three Use: \begin{legal} \item ...\end{legal} \autocite{citekey } Cite a bibliographic reference (package biblatex) {} embraces arguments, creates logical parts \{ \} 1.1.2. strawberry \label{marker } Set a marker for cross reference, often if the form [] embraces optional arguments [] % Variant fora thesis with horizontal rules at head and foot \label{sec:item} or \label{fig:diag1} % comments: code after % will be ignored. \% ¦\usepackage[headsepline=0.005pt:,footsepline=0.005pt:, ¥ D.8. Separate Files § \autoref{marker } Give type name and number of marker & separates columns in tabular-like environments \& plainfootsepline,automark]{scrlayer-scrpage} ª After preamble within the text place:\include{file} Text starts and \autopageref{marker } Give abbreviation of “page” and page # parameter for own command declarations \# \clearpairofpagestyles ends on a new page. file has to be in the same directory as the \ohead[]{\headmark} \ofoot[\pagemark]{\pagemark} number of marker $ text style math mode (abbr. for \(... \)) \$ master file. Otherwise specify a path: \include{path/file} \ModifyLayer[addvoffset=-.6ex]{scrheadings.foot.above.line} \url{url} Print clickable web page _ 2 ª In preamble place: \includeonly{file1,file2 } to run only these files. ^ index/exponent only valid in math mode, e.g. a1 see E.2 \ModifyLayer[addvoffset=-.6ex]{plain.scrheadings.foot.above.line} ª Use \input{file} includes a file without starting/ending on a new \href[options]{url}{text} Print clickable link \setkomafont{pageheadfoot}{\small} page (\includeonly not valid). \hyperref[marker ]{text} Print clickable reference B. Preamble (before \begin{document}) Style: \urlstyle{xx} with xx a style like “tt”, “rm”, “sf” or “same”. Names for autoref (package babel): setspace E. Text B.1. Documentclass (necessary) C.3.¦ Linespread with ¥ \renewcaptionname{language}{\typenameautorefname}{text}, \usepackage[onehalfspacing]{setspace} Use: \documentclass[opt,opt,. ]{class} Load: for 1.5 line spacing. E.1. Paragraphs (≈ “new idea in content”) e.g. \renewcaptionname{english}{\subsectionautorefname}{section} Recommended classes: scrartcl, scrreprt, scrbook, scrlttr2 Paragraphs are separated by an empty line in the code or by \par. Non-KOMA-Script classes: beamer, koma-moderncvclassic D. Document Structure (see alsoL) A \\ produces a new line – use sparingly, seldom needed outside tabulars. E.8. Acronyms with acro Correct Overfull Box Warnings with more than 4pt (look into log file). Common options with default Values available (subtotal) D.1. Start Document \usepackage{acro,hyperref,longtable,tabu}%next5 to praeambel Complete document contents. \acsetup{list-style=longtabu,list-heading=addchap} fontsize=11pt 10pt | 12pt (e.g. 12.5pt also valid) \begin{document} \end{document} E.2. Text Symbols/Characters (see also A.2) § \DeclareAcroListStyle{longtabu}{table}{table=longtabu, paper=a4, paper=portrait a3 | a5 | b4 | letter, landscape A lot of diacritic symbols can be typed directly, e.g. è é ê ñ ç table-spec=@{}>{\bfseries}lX@{}} parskip=no half full D.2. Title | § \S _ \textunderscore{} ~ \textasciitilde{} \DeclareAcronym{ecm}{short=EM,long=Electro Machining} headings=big small | normal simple title: \author{text} \title{text} \date{\today} \maketitle ... text ^ \textasciicircum{} ... \ldots | \textbar chapterprefix=false true title page self designed: \begin{titlepage} \end{titlepage} \ac{EM} or \Ac{EM} for capitalized first letter Other symbols need packages, e.g. € \texteuro (textcomp) open=right (scrbook) any (scrartcl, scrreprt) | left \printacronyms captions=oneline nooneline D.3. Table of Contents, List of Figures (for other List of see E.8&G) E.3. Fonts captions=tablebelow,figurebelow tableabove, figureabove \tableofcontents \listoftables \listoffigures KOMAoption toc=listof (see B.1) generates entries for TOC. toc=nolistof listof | listofnumbered Command Declaration Effect ¦F. Figures & Tables (floating environments) ¥ bibliography=totoc | totocnumbered nottotoc \textrm{text} {\rmfamily text} Roman family F.1. Figures with graphicx twoside=true (scrbook) false (scrartcl, scrreprt) D.4. Headings \textsf{text} {\sffamily text} Sans serif family Load: \usepackage{graphicx} twocolumn=false true \part{title} \chapter{title} \texttt{text} {\ttfamily text} Typewriter family Use: \includegraphics[opt]{file} (png, jpg, pdf) draft=false true (show overfull boxes) \section{title} \subsection{title} \subsubsection{title} \textmd{text} {\mdseries text} Medium series With ‘figure’ the environment to place a graphic is meant. The figure ª \paragraph{title} \subparagraph{title} Options of document class are passed to every loaded package. \textbf{text} {\bfseries text} Bold series caption is printed where the caption command is placed in the input. ª Set or change options later in file, e.g. \KOMAoptions{twoside=true} ª \chapter only valid in documentclass scrbook and scrreprt \textup{text} {\upshape text} Upright shape Extra vertical space is controlled by the KOMAoption captions (see B.1). ª Use * variants for headings without numbering, no change in counter \textit{text} {\itshape text} Italic shape Use: \begin{figure}[pos] ..\caption{..}\label{fig:x} \end{figure} and no entry in table of contents. B.2. Loading Packages \textsl{text} {\slshape text} Slanted shape Parameter: pos is a suggestion for placing, it can be ignored by TEX. options package ª Use the optional parameter for short titles in headings and table of t h b ! \usepackage[ ]{ } \textsc{text} {\scshape text} Small Caps shape Possible values are combinations of (top), (here), (bottom), (try \PassOptionsToPackage[options]{package} contents, e.g. \section[short title]{title} harder), p (separate page). More general commands: ª Use \addpart, \addchap or \addsec for unnumbered headings, but Hint: Define a path to the graphic files (no blanks in folder names; no text text Emphasized with running heading and entry in table of contents. \emph{ } {\em } folder folder B.3. Encoding Settings special characters in file names) \graphicspath{ { /}{ /}... } The * variants delete the running heading. \textnormal{text} {\normalfont text} Document font ª \graphicspath{ {img/} }%subfolder for images; set in preambel \usepackage[utf8]{inputenc}% most IDEs use UTF8 Layout of paragraph and subpargraph similar to other headings: Example: \setkomafont{section}{\scshape} \begin{figure}\centering \usepackage[T1]{fontenc}% most fonts needsT1 \RedeclareSectionCommands[afterskip=1sp]{paragraph,subparagraph} § § \setcounter{secnumdepth}{\subparagraphnumdepth}