summaryrefslogtreecommitdiff
path: root/latexHeaders/listings.tex
blob: 135b2af81b02d0ffdfd5c0b63dc5336d48130fb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
% Colors, used for syntax highlighting.
% To print this document, set all colors to black!
\usepackage{xcolor}
\definecolor{keyword}{rgb}{0, 0, 1}
\definecolor{string}{rgb}{1, 0, 0}
\definecolor{comment}{rgb}{0.2, 0.6, 0.2}
\definecolor{identifier}{rgb}{0, 0, 0}

% Source code listings.
\usepackage{pxfonts}
\usepackage{listings}
\lstset{
	language={C++},
	numbers=left,
	stepnumber=1,
	numbersep=6pt,
	numberstyle=\footnotesize,
	breaklines=true,
	breakautoindent=true,
	breakatwhitespace=false,
	postbreak=\space,
	tabsize=2,
  basicstyle=\ttfamily\small,
	showspaces=false,
	showstringspaces=false,
	extendedchars=true,
	keywordstyle=\color{keyword}\bfseries,
	stringstyle=\color{string}\bfseries,
	commentstyle=\color{comment}\bfseries,
  identifierstyle=\color{identifier},
	frame=trbl
}

% Listings doesn't support UTF8. This is just enough for German umlauts.
\lstset{literate=%
  {Ö}{{\"O}}1
  {Ä}{{\"A}}1
  {Ü}{{\"U}}1
  {ß}{{\ss}}1
  {ü}{{\"u}}1
  {ä}{{\"a}}1
  {ö}{{\"o}}1
  {~}{{\textasciitilde}}1
}