1. Brief intro to L
ATEX
Veronika Heimsbakk
Brief intro to L
ATEX
2. ∠ A document markup language.
∠ Released in 1984.
∠ L
ATEXan abbreviation for Lamport TEX.
‡ https://github.com/latex3/latex2e
Brief intro to L
ATEX
3. TEX
TEX (τχ) is an abbreviation τχνη—TEXNH—technē. Greek for art and craft, root
for technical.
∠ Released in 1978 by Donald Knuth.
∠ Typesetting system.
∠ Developed to let anyone on any machine could create books and documents of
high quality.
∠ https://www.tug.org/texlive/devsrc/Build/source/texk/web2c/tex.web
Brief intro to L
ATEX
4. Installation
∠ TeXworks, Kile, Vim, Emacs etc.
∠ Package handling: MikTeX, MacTeX
∠ apt-get install texlive
∠ Browser based Overleaf1
1 https://www.overleaf.com/
Brief intro to L
ATEX
5. Mitt første dokument
documentclass[a4paper, 10pt]{article}
begin{document}
My first document!
end{document}
A lot of options for documentclass.
documentclass[options]{class}
∠ Options: font size, paper size, twoside/oneside, landscape etc.
∠ Class: book, article, report, minimal, beamer etc.
Brief intro to L
ATEX
6. Packages
For language and type faces.
usepackage[norsk]{babel}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
A lot of packages for anything! More on this later...
usepackage{hyperref}
usepackage{mathtools}
usepackage{listings}
usepackage{graphicx}
Brief intro to L
ATEX
7. Author and title
title{Introduction to LaTeX{}}
author{Veronika Heimsbakkveronika.heimsbakk@capgemini.com}
begin{document}
maketitle
end{document}
Brief intro to L
ATEX
8. Sections
section{Section}
This is section 1!
subsection{Sub section}
This is section 1's first sub section.
subsubsection{Sub sub section}
This is section 1's first sub section's sub section!
Brief intro to L
ATEX
11. Fonts
textbf textit texttt underline
Bold Italic Typeface Underscore
textbf{Bold}
bfseries{Bold}
textit{Italic}
itshape{Italic}
Brief intro to L
ATEX
12. Fonts, packages
∠ Several packages for font styling.
∠ soul, color, . . .
st textcolor{red}{Rød tekst}
Strike through Red text
caps so
Small Capitals s p a c e y s t u f f
Brief intro to L
ATEX
13. Fonts, sizing
tiny Example text
scriptsize Example text
footnotesize Example text
small Example text
normalsize Example text
large Example text
Large Example text
LARGE Example text
huge Example text
Huge Example text
Brief intro to L
ATEX
14. Fonts, type faces
normalfont Example text
rmfamily Example text
sffamily Example text
ttfamily Example text
A lot of type faces to explore in L
ATEX. Check out http://www.tug.dk/FontCatalogue/
Brief intro to L
ATEX
17. table
Table Table Table
one two three
four five six
seven eight nine
Table: Example of a table.
begin{table}[h!]
centering
begin{tabular}[h!]{|l|r|c|}
textbf{Table} textbf{Table} textbf{Table}
hline
one two three
four five six
seven eight nine
end{tabular}
caption{Eksempel på en tabell.}
label{tab:example}
end{table}
Brief intro to L
ATEX
18. References
∠ May use label for references.
∠ Example på reference to tabel 1.
∠ pageref, ref, cite
Example på reference to tabel ref{tab:example}.
Brief intro to L
ATEX
19. References
Need tagging of reference.
sec: section
subsec: subsection
fig: figure
tab: table
eq: equation
itm: enumerated list item
Brief intro to L
ATEX
21. Figure placement
h here
t top of page
b bottom of page
! Override internal L
ATEXparameters that fixes good float for the position
H Equal to ht!
Brief intro to L
ATEX
22. Lists, itemize
∠ This is a list element.
∠ This is another list element.
begin{itemize}
item
This is a list element.
item
This is another list element.
end{itemize}
Brief intro to L
ATEX
23. Lists, enumeration
1. This is a list element.
1.1 This is another list element.
begin{enumerate}
item
This is a list element.
begin{enumerate}
item
This is another list element.
end{enumerate}
end{enumerate}
Brief intro to L
ATEX
24. Lists, description
* This is a list element.
Element This is another list element.
begin{description}
item[*] This is a list element.
item[Element] This is another list element.
end{description}
Brief intro to L
ATEX
25. Emph, footnotes and verbatim
Everything is allowed in verbatim (except from verbatim).
This is a verbatim.
This is a emph.
Example text with footnote.2
emph{ ... }
footnote{ ... }
2This is a footnote.
Brief intro to L
ATEX
26. Hyperlinks
Include the package hyperref.
http://tug.org/
TEX Users Group web site
veronahe@ifi.uio.no
url{http://tug.org/}
href{http://tug.org/}{TeX{} Users Group web site}
href{mailto:veronahe@ifi.uio.no}{veronahe@ifi.uio.no}
Brief intro to L
ATEX
27. Mathematics
Environment from TEX
$ ... $ % In-line equation
$$ ... $$ % Highlighted equation
In-line equation ∀x ∈ X, ∃y ≤
Highlighted equation
∀x ∈ X, ∃y ≤
forall x in X, quad exists y leq epsilon
Brief intro to L
ATEX
28. Mathematics
Environment, new in L
ATEX
( ... ) % In-line equation
[ ... ] % Highlighted equation
In-line equation ∀x ∈ X, ∃y ≤
Highlighted equation
∀x ∈ X, ∃y ≤
Alternative ways of writing equations
∠ begin{equation}
∠ begin{align}
∀x ∈ X, ∃y ≤ (1)
align will enumerate equations.
Brief intro to L
ATEX
29. Symbols
Symbol Command
∩ cap
∪ cup
⊆ subseteq
≡ equiv
∈ in
/
∈ notin
∧ land
∨ lor
|= models
∅ emptyset
Λ Lambda
λ lambda
∠ The Comprehensive L
ATEXSymbol List
∠ L
ATEXWiki Mathematics
Brief intro to L
ATEX
30. lstlistings
1 public class Code {
2 public static void main ( String [ ] args ) {
3 System . out . println ( Hello , world ! ) ;
4 }
5 }
Brief intro to L
ATEX
32. lstlistings
begin{lstlisting}
public class Code {
public static void main(String[] args) {
System.out.println(Hello, world!);
}
}
end{lstlisting}
Load code by using lstinputlisting{source_filename.py}
Brief intro to L
ATEX
34. Bibliography
A simple reference system included in L
ATEX.
begin{thebibliography}
bibitem{tolkien77}
J.R.R. Tolkien,
textit{The Silmarillion},
George Allen Unwin, United Kingdom,
1st edition,
1977.
end{thebibliography}
Use cite to reference to bibitem{tolkien77}
Brief intro to L
ATEX