blob: 9ec47e71f8b9b9e792c274b5d1519b1de7261f6c (
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
% ---------------------------------------------------
% Date: 12.12.2018
% Version: v0.1
% Autor: Felix Faltin <ffaltin91[at]gmail.com>
% Repository: https://github.com/faltfe/iodhbwm
% ---------------------------------------------------
% --- --- --- --- -- Class options -- --- --- --- ---
% ---------------------------------------------------
\documentclass[
load-dhbw-templates, % Necessary for correct listing style
language = ngerman,
debug
]{iodhbwm}
\usepackage[T1]{fontenc}
% Rename listings
\renewcommand{\lstlistlistingname}{Quellcodeverzeichnis}
\renewcommand{\lstlistingname}{Quellcode}
% ---------------------------------------------------
% --- --- --- --- - Necessary setup - --- --- --- ---
% ---------------------------------------------------
\begin{document}
\lstlistoflistings
\chapter{Einfache Beispiele}
\section{Simple example}
\blindtext
\begin{lstlisting}[caption={Simple Java method},label=lst:whatever,language=Java]
/*
* This is a test class doing nothing
*/
public class TestClass() {
public static void main(String args[]) {
// A simple line comment
system.out.println("Hello world");
}
}
\end{lstlisting}
\section{Advanced floating}
\begin{lstlisting}[language={[Sharp]C},float,caption={Simple C\# method},label=lst:whatever-2]
// If have no idea what I'm doing here
public void Testfunc(string msg) {
for (var i = 0; i <= 10; i++) {
Console.WriteLine($"String: {msg}{i}");
}
}
\end{lstlisting}
\blindtext
\section{Advanced styling}
\lstset{
captionpos=b,
frame=t
}
\begin{lstlisting}[language={[Sharp]C},float=htb,caption={Caption below code},label=lst:whatever-3]
// If have no idea what I'm doing here
public void Testfunc(string msg) {
for (var i = 0; i <= 10; i++) {
Console.WriteLine($"String: {msg}{i}");
}
}
\end{lstlisting}
\blindtext
\end{document}
|