Skip to content

Commit

Permalink
Merge branch 'release/1.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
faltfe committed Jan 27, 2019
2 parents 0080586 + ef41ad8 commit 23e5774
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ script:
- cd ../listings
- travis_wait 3 pdflatex -interaction=nonstopmode -halt-on-error iodhbwm-listings
- travis_wait 3 pdflatex -interaction=nonstopmode -halt-on-error iodhbwm-listings
- travis_wait 3 pdflatex -interaction=nonstopmode -halt-on-error iodhbwm-listings-color
- travis_wait 3 pdflatex -interaction=nonstopmode -halt-on-error iodhbwm-listings-color
# Run acronym example
- cd ../acronyms
- travis_wait 3 pdflatex -interaction=nonstopmode -halt-on-error iodhbwm-acro
Expand Down
Binary file added doc/examples/listings/iodhbwm-listings-color.pdf
Binary file not shown.
89 changes: 89 additions & 0 deletions doc/examples/listings/iodhbwm-listings-color.tex
Original file line number Diff line number Diff line change
@@ -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}
15 changes: 9 additions & 6 deletions source/iodhbwm.cls
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
% Felix Faltin
% E-Mail: [email protected]
% ----------------------------------------------------------
% Copyright 2017-2018 Felix Faltin
% Copyright 2017-2019 Felix Faltin
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
Expand All @@ -23,8 +23,8 @@
%
% ----------------------------------------------------------

\newcommand*{\iodhbwm@cls@version}{v1.0}
\newcommand*{\iodhbwm@cls@date}{2018-12-20}
\newcommand*{\iodhbwm@cls@version}{v1.0.1}
\newcommand*{\iodhbwm@cls@date}{2019-01-27}
\newcommand*{\iodhbwm@cls@info}{Inoffical DHBW Mannheim thesis class}

\ProvidesClass{iodhbwm}[%
Expand Down Expand Up @@ -297,6 +297,9 @@
}%
}%
}
% hyperref loads auxhook, which does not work correctly if it is loaded
% via \AtEndPreamble. So we load it immediately to avoid problems:
\RequirePackage{auxhook}

% ----------------------------------------------------------
% Format captions and listings
Expand All @@ -323,7 +326,7 @@
framexleftmargin=17pt,
}

\DeclareCaptionFont{DHBWwhite}{\color{DHBW-light}}
\DeclareCaptionFont{DHBWlisting}{\color{DHBW-light}}
\DeclareCaptionFont{print}{\color{black}}
\DeclareCaptionFormat{listing}{%
\colorbox{DHBW-red}{%
Expand Down Expand Up @@ -368,7 +371,7 @@
format=listing,
singlelinecheck=false,
margin=0pt,
font={DHBWwhite,sf},
font={DHBWlisting,sf},
}%

\lstset{
Expand Down Expand Up @@ -474,4 +477,4 @@
}{}


\endinput
\endinput

0 comments on commit 23e5774

Please sign in to comment.