diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/iodhbwm/doc/examples/listings |
Initial commit
Diffstat (limited to 'macros/latex/contrib/iodhbwm/doc/examples/listings')
-rw-r--r-- | macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings-color.pdf | bin | 0 -> 173543 bytes | |||
-rw-r--r-- | macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings-color.tex | 89 | ||||
-rw-r--r-- | macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings.pdf | bin | 0 -> 174059 bytes | |||
-rw-r--r-- | macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings.tex | 68 |
4 files changed, 157 insertions, 0 deletions
diff --git a/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings-color.pdf b/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings-color.pdf Binary files differnew file mode 100644 index 0000000000..d72891bb3c --- /dev/null +++ b/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings-color.pdf diff --git a/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings-color.tex b/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings-color.tex new file mode 100644 index 0000000000..b057ef60bf --- /dev/null +++ b/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings-color.tex @@ -0,0 +1,89 @@ +% --------------------------------------------------- +% Date: 23.01.2019 +% Version: v0.1 +% Autor: Felix Faltin <ffaltin91[at]gmail.com> +% Repository: https://github.com/faltfe/iodhbwm +% Provided by: https://github.com/NelDav +% --------------------------------------------------- +% --- --- --- --- -- Class options -- --- --- --- --- +% --------------------------------------------------- +\documentclass[ + load-dhbw-templates, % Necessary for correct listing style + language = ngerman, + debug +]{iodhbwm} +\usepackage[T1]{fontenc} + +% Change the color of the caption box of the listing +\ifbool{iodhbwm@cls@if@templates}{% + % Change the color of the caption font + \DeclareCaptionFont{DHBWlisting}{\color{Blue}} + % + % Change the color of the caption box + \DeclareCaptionFormat{listing}{% + \colorbox{Orange}{% + \parbox{\dimexpr\textwidth-2\fboxsep\relax}{#1#2#3}% + }% + } +} + +% Do global changes to all used listings of your document +\lstset{ + %Change the color of the line on the other side of the listing + rulecolor=\color{Orange}, + % + %change the color of special words + commentstyle=\color{green}, + keywordstyle=\color{blue}, + numberstyle=\scriptsize\color{DHBW-font}, + stringstyle=\color{purple} +} + +% --------------------------------------------------- +% --- --- --- --- - 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} diff --git a/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings.pdf b/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings.pdf Binary files differnew file mode 100644 index 0000000000..d88cde7bf6 --- /dev/null +++ b/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings.pdf diff --git a/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings.tex b/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings.tex new file mode 100644 index 0000000000..9ec47e71f8 --- /dev/null +++ b/macros/latex/contrib/iodhbwm/doc/examples/listings/iodhbwm-listings.tex @@ -0,0 +1,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} |