Debian Codegraph @

texmf-dist/doc/latex/iodhbwm/examples/listings/iodhbwm-listings.tex

raw
1 % ---------------------------------------------------
2 % Date: 08.09.2019
3 % Version: v1.1.1
4 % Autor: Felix Faltin <ffaltin91[at]gmail.com>
5 % Repository: https://github.com/faltfe/iodhbwm
6 % ---------------------------------------------------
7 % --- --- --- --- -- Class options -- --- --- --- ---
8 % ---------------------------------------------------
9 \documentclass[
10 load-dhbw-templates, % Necessary for correct listing style
11 language = ngerman,
12 debug
13 ]{iodhbwm}
14 \usepackage[T1]{fontenc}
15
16 % Rename listings
17 \renewcommand{\lstlistlistingname}{Quellcodeverzeichnis}
18 \renewcommand{\lstlistingname}{Quellcode}
19
20 % ---------------------------------------------------
21 % --- --- --- --- - Necessary setup - --- --- --- ---
22 % ---------------------------------------------------
23 \begin{document}
24
25 \lstlistoflistings
26
27 \chapter{Einfache Beispiele}
28 \section{Simple example}
29 \blindtext
30 \begin{lstlisting}[caption={Simple Java method},label=lst:whatever,language=Java]
31 /*
32 * This is a test class doing nothing
33 */
34 public class TestClass() {
35 public static void main(String args[]) {
36 // A simple line comment
37 system.out.println("Hello world");
38 }
39 }
40 \end{lstlisting}
41
42 \section{Advanced floating}
43 \begin{lstlisting}[language={[Sharp]C},float,caption={Simple C\# method},label=lst:whatever-2]
44 // If have no idea what I'm doing here
45 public void Testfunc(string msg) {
46 for (var i = 0; i <= 10; i++) {
47 Console.WriteLine($"String: {msg}{i}");
48 }
49 }
50 \end{lstlisting}
51 \blindtext
52
53 \section{Advanced styling}
54 \lstset{
55 captionpos=b,
56 frame=t
57 }
58 \begin{lstlisting}[language={[Sharp]C},float=htb,caption={Caption below code},label=lst:whatever-3]
59 // If have no idea what I'm doing here
60 public void Testfunc(string msg) {
61 for (var i = 0; i <= 10; i++) {
62 Console.WriteLine($"String: {msg}{i}");
63 }
64 }
65 \end{lstlisting}
66 \blindtext
67
68 \end{document}