Beruflich Dokumente
Kultur Dokumente
Introduction to LaTeX
3
Introduction
Essentially a Markup Language (like HTML, XML and
RTF)
An extension to TeX system
TeX written by Donald Knuth in 70´s
4
Installation on Different OS
5 Installing LaTeX
In Windows
MiKTeX
MiKTeX is a typesetting system for the Windows.
Download from www.miktex.org for free
It is generally recommended to install MiKTeX first,
then Tex.
Other text editors
There are other text editors.
TeXstudio http://www.texstudio.org/
6 Installing LaTeX
Packages used
Added Functionality (graphics, reference style,...).
Main Body
Text and Bibliography References.
11
The Basics
Document Class
\documentclass[options]{class}
options = a4paper, 11pt, 12pt, 10pt,
twocolumn, landscape,...
class = article, report, book,...
Packages
\usepackage{package name}
epsfig = insert PS pictures into the
document
fancyhdr = easy definition of footer
and header
12
Body of Text
Start with \begin{document}
End with \end{document}
Typesetting Text
\\ or \newline and \newpage
Quotations
Bold \textbf{……………} or \bf
Italics \emph{…………} or \textit{………} or
\it
Underline \underline{…………} or \ul
Including Multiple Files
\input{filename.tex}
13 Format
Sections
\section{…} = 1. Latex is Great
\subsection{…} = 1.1 Why Latex is Great
\subsubsection{…} = 1.1.1 Reason One
\appendix - changes numbering scheme
\chapter{…} - To be used with book and
report document classes
Titles, Authors and others
\title{…} \author{…}
\footnote{…}
14
Format Contd.
\maketitle - Display Title and Author
\tableofcontents - generates TOC
\listoftables - generates LOT
\listoffigures - generates LOF
Itemise
Use either enumerate, itemize or description.
see handout for example.
15
Format Contd.
\documentclass{article}
\begin{document}
\tableofcontents
\newpage
\section{Section}
Dummy text
\subsection{Subsection}
Dummy text
\end{document}
16
Format Contd.
\begin{document} ...
... \begin{appendix}
\begin{figure}
\listoffigures
\caption{Dummy figure}
\listoftables
\end{figure}
\end{appendix}
\end{document}
\begin{table}
\caption{Dummy table}
\end{table}
17 Lists
Source
\begin{itemize}
\item Apple
\item Orange
\end{itemize}
Result
Apple
Orange
18 Lists
Source
\begin{enumerate}
\item One
\item Two
\item Three
\end{enumerate}
Result
1. One
2. Two
3. Three
19 Lists
\documentclass{article}
% ...
\usepackage{enumitem}
\begin{document}
---------------
%Roman numbers
\begin{enumerate}[label=(\roman*)]
%...
% Arabic numbers
\begin{enumerate}[label=\arabic*)]
%...
% Alphabetical
\begin{enumerate}[label=\alph*)]
%...
20 Environment
Something between
\begin{name}
\end{name}
Can be recursive
Examples:
itemize, center, abstract
21 Group
Result
Right aligned
23 Font size
\small \normalsize
\large \Large
\LARGE \huge
\Huge
24 Footnote
I'm writing something here to test \footnote{footnotes working fine}
several features.
25
Images
\usepackage{graphicx} \begin{subfigure}[b]{0.4\linewidth}
\usepackage{subcaption}
\includegraphics[width=\linewidth]
\begin{document} {coffee.jpg}
\caption{More coffee.}
\begin{figure}[h!]
\end{subfigure}
\centering \caption{The same cup of coffee.
Two times.}
\begin{subfigure}[b]{0.4\linewidth} \label{fig:coffee}
\end{figure}
\includegraphics[width=\linewidth \end{document}
]{coffee.jpg}
\caption{Coffee.}
30 Images
31
Tabular
Mathematical Equations,
Algorithms
35 Mathematical expressions
$E=mc^2$
\begin{equation}
E=m
\end{equation}
37 Mathematical expressions
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{align*}
f(x) &= x^2\\
g(x) &= \frac{1}{x}\\
F(x) &= \int^a_b \frac{1}{3}x^3
\end{align*}
\end{document}
38 Alogrithms
\usepackage[options ]{algorithm2e}
Example
------------
\begin{algorithm}[H]
\SetAlgoLined
\KwResult{Write here the result }
initialization\;
\While{While condition}{
instructions\;
\eIf{condition}{
instructions1\;
instructions2\;
}{
instructions3\;
}
}
\caption{How to write algorithms}
\end{algorithm}
39
\section{Greetings}
\label{sec:greetings}
Hello!
\section{Referencing}
I greeted in
section~\ref{sec:greetings}.
41 Labels and Cross-references
\begin{figure}
\centering
\includegraphics[width=0.5\textwidth]
{gull}
\caption{Close-up of a gull}
\label{fig:gull}
\end{figure}
Figure \ref{fig:gull} shows a
photograph of a gull.
42 Labels and Cross-references
\begin{equation} \label{eq:solve}
x^2 - 5 x + 6 = 0
\end{equation}
\begin{equation}
x_1 = \frac{5 + \sqrt{25 - 4 \times 6}}{2} = 3
\end{equation}
\begin{equation}
x_2 = \frac{5 - \sqrt{25 - 4 \times 6}}{2} = 2
\end{equation}
and so we have solved equation~\ref{eq:solve}