diff --git a/example.pdf b/example.pdf index 838579e58f78e221893dd5a2d294a28d27a82fbc..0961787f73067432a1646899aaa96ccbbe72fe5e 100644 Binary files a/example.pdf and b/example.pdf differ diff --git a/example.tex b/example.tex index 70f94c1b103791c16b15eb5188127fb630a80418..6d5c509cfdac86254727fe1fdac14a0d813793cd 100644 --- a/example.tex +++ b/example.tex @@ -119,6 +119,120 @@ % now we can begin with the actuall relevant content. So let'S beginn by creating the first chapter: +\chapter{Basic text formatting} \label{chap: formating} + + To begin I want to show you the basics of how to get text onto the page and structure it. You can also see how I created this exact text as an + example. + + \section{Headings} \label{sec: headings} + The exact commands available will vary depending on you your documentclass, but they will always be a single command that excepts any text + inside curly brackets, for example \lstinline|\section{text}|. The different commands form a hierarchy you can nest into each other, keeping + track of its parent element. That means you don't have to worry about any formatting or numbering, LaTeX will handle that for you. + + When using an \emph{article} documentclass, the commands available are \lstinline|\section{}|, \lstinline|\subsection{}| and + \lstinline|\subsubsection{}|. Should you need more nesting levels, you are usually overcomplicating things, but you could additionally use the + \lstinline|\paragraph{}| command, which gives you a slightly bigger, bold first word for your paragraph. + + The \emph{report} documentclass adds the additional command \lstinline|\chapter{}| as the highest heading level. You can still use the previous + three commands for the nested headings. A chapter automatically starts on a new page, so it should be at leas two pages long. You also get the + command \lstinline|\part{}|, which creates a separate page for the part's title. These should only be used in very long documents. + + \section{Text paragraphs} \label{sec: paragraphs} + Latex will format any text that is not part of a command (so not prefixes with a \lstinline|\| or inside \lstinline|{}|) as a plain-text + paragraph. So the layout in your source code does not influence the layout of the resulting PDF. If you wanted to you could put everything on + a single line, and it would work. This wouldn't be very readable however, so you should format your source code at leas a little. Putting + every sentences on a new line is very common, or you can configure your editor to automatically break when the line gets to long (this is + preconfigured if you open this project in VS Code). + + LaTeX will also automatically format your text to fill up all the available space and break long words for you. Sometimes, if you use special + words LaTeX doesn't know, you may need to tell it where to split those. For one off cases you can just put \lstinline|\-| where you want a + break and for words you use a lot you can declare the hyphenation in the preamble as a space separated list, for example like this: + \lstinline|\hyphenation{word list donau-dampf-schiff}| + + Lots of online sources will list the double-backslash (\lstinline|\\|) as the command for a line break. While this is not wrong, you should + not use it to break your text. Instead, you should use \lstinline|\par| to denote the end of a paragraph. As programmers are lazy, LaTeX will + actually insert this command for you, if you just leave an empty line between to blocks of text. Using the correct command allows LaTeX to + better find automatic breakpoints, allows you to define the spacing between paragraph and has some other benefits. + + \section{Text spacing} \label{sec: spacing} + By default, these classes add no spacing between paragraph, but sometimes you want to visually enforce a breakpoint in your argumentation. For + that you can add some space in between to paragraph by using one of the commands \lstinline|\bigskip|, \lstinline|\medskip| or + \lstinline|\smallskip|. How much space you want depends on your tase, but you should keep it consistent. Here is an example: + + \bigskip + This text has a big space before it, + + \medskip + Here I used just some medium spacing + + \smallskip + and this is a small space. + + \section{Breaking pages} \label{sec: pagebreak} + Sometimes you will find yourself in situations, where you don't like where LaTeX splits your text to the next page. So first, take some + advice: Don't worry about it for now. Your text will probably change a few times before its final. Just leave it. + + If you are at the final stage, you can do a beautifying pass. Now you can use \lstinline|\pagebreak| to tell LaTeX about better places to + break the text. + + Should you still not be happy (this happens especially with multiple images/tables in close proximity) you most likely have to little text and + should redesign your document. But if you absolutely want to print it that way, you can use \lstinline|\clearpage| to force all + figures/tables to be put onto the page and then start a new page. + + \section{Text styling} \label{sec: styling} + When writing text, you will need to \emph{emphasize} certain parts of the text. The easiest way is to use the \lstinline|\emph{}| command + around you text. You can also nest it \emph{to \emph{emphasize} even more}. + + If you want to change to a specific font-type, you can do that like this: + + \smallskip + \begin{tabular}{l l} + \lstinline|\underline{text}| & \underline{Underlined} \\ + \lstinline|\textbf{text}| & \textbf{Bold Font} \\ + \lstinline|\textii{text}| & \textit{Italic Font} \\ + \lstinline|\textrm{text}| & \textrm{Roman Font} \\ + \lstinline|\texttt{text}| & \texttt{Typewriter Font} \\ + \lstinline|\textsc{text}| & \texttt{Small Caps Font} \\ + \end{tabular} + + \medskip + You might also want to change your text colour, which is what the \lstinline{color} package is for. It provides the + \lstinline|textcolor{colour}{text}| command, \textcolor{red}{which allows you} \textcolor{blue}{to change your text colour}. + + \pagebreak + \section{Special characters} \label{sec: special-charaters} + + \subsection{LaTeX command characters} + As in most programming languages, some characters are used for LaTeXes commands and can't be used in text directly. Here is a table + explaining them all: + + \smallskip + \begin{tabular}{l l l} + \emph{character} & \emph{special meaning} & \emph{how to get character} \\ + \textbackslash & beginning of a command & \lstinline|\textbackslash| \\ + \{ and \} & denote a code block & \lstinline|\{| and \lstinline|\}|\\ + \% & beginning of a comment & \lstinline|\%| \\ + \# & macro parameter character & \lstinline|\#| \\ + \$ & beginning/end of math mode & \lstinline|\$| \\ + \textasciitilde & non-breaking space & \lstinline|\textasciitilde| \\ + \emph{only inside math mode:} \\ + $\_$ & subscript & \lstinline|\_| \\ + \textasciicircum & superscript & \lstinline|\textasciicircum| \\ + \end{tabular} + + \subsection{Invisible characters} + To properly typeset your text you may need a number of special characters under specific circumstances: + + \smallskip + \begin{tabular}{l l l} + \emph{explanation} & \emph{command} & \emph{example} \\ + non-breaking space & \lstinline|~| & Max~Mustermann (Names shouldn't be broken) \\ + 3/4 non-breaking space & \lstinline|\;| & 10\;000 (separate thousands)\\ + medium non-breaking space & \lstinline|\:| & z.\:B. (abbreviations) \\ + 1/2 non-breaking space & \lstinline|\,| & 1\,V (number + unit) \\ + \end{tabular} + + \chapter{Examples} \label{chap: one} {\color{red}red text} and {\color{blue}blue text} \\ different subscripts: \normalsubscripts$R_t$ \upsubscripts$R_t$ \\