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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
%% This is file `bfh-layout-listings.cfg' version 2.1.0 (2022/01/24),
%% it is part of
%% BFH-CI -- Corporate Design for Bern University of Applied Sciences
%% ----------------------------------------------------------------------------
%%
%% Copyright (C) 2021–2022 by
%% Marei Peischl <marei@peitex.de>
%% Andreas Habegger <andreas.habegger@bfh.ch>
%%
%% ============================================================================
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3c
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%% http://www.latex-project.org/lppl.txt
%% and version 1.3c or later is part of all distributions of LaTeX
%% version 2008/05/04 or later.
%%
%% This work has the LPPL maintenance status `maintained'.
%%
%% The Current Maintainers of this work are
%% Marei Peischl <bfh-ci@peitex.de>
%% Andreas Habegger <andreas.habegger@bfh.ch>
%%
%% The development respository can be found at
%% https://gitlab.ti.bfh.ch/bfh-latex/bfh-ci/
%% Please use the issue tracker for feedback!
%%
%% ============================================================================
%%
\ProvidesFile{bfh-layout-listings.cfg}[2022/01/24 v2.1.0 listings configuration for bfhlayout]
\RequirePackage{bfhcolors}
%% Hack to fix issue with float env used in listings package
%% ref. : https://tex.stackexchange.com/questions/51867/koma-warning-about-toc
\RequirePackage{scrhack}
\RequirePackage{listings}
%%
\lstloadlanguages{[ANSI]C,C++,Matlab,[LaTeX]TeX,bash,python}
%%
%% ----- code highliting colors
\definecolor{codegreen}{rgb}{0,0.6,0}
\definecolor{codegray}{rgb}{0.5,0.5,0.5}
\definecolor{codepurple}{rgb}{0.58,0,0.82}
\definecolor{backcolor}{rgb}{0.95,0.95,0.92}
%%
\definecolor{datatype}{rgb}{0.58,0,0.82}
\definecolor{decision}{rgb}{0.5,0.5,0.5}
\definecolor{memory}{rgb}{0,0.6,0}
\definecolor{special}{rgb}{0,0.6,0.6}
%%
%% ----- extend listing directory
%%
\lstdefinelanguage{VHDL}{
morekeywords={
library,use,all,entity,is,port,in,out,end,architecture,of,
begin,and,type,when,else,select,with,others,else,if,elsif,
signal,variable,std_logic,std_logic_vector,after,
},
morecomment=[l]--
}
%% -- Fixed width typewriter font for code and sans-serif font for comments in listings
\lstset{%
basicstyle=\ttfamily\selectfont,
commentstyle=\sffamily\itshape\selectfont\color{codegreen},
keywordstyle=\bfseries\selectfont,
stringstyle=\color{codepurple},
directivestyle={\color{red}},
extendedchars=true,
showstringspaces=true,
columns=fixed, % columns in the source code are respected
aboveskip=\smallskipamount,
belowskip=\smallskipamount
}%
%%
%% ------ BFH listing style definitions
%%
\lstdefinestyle{linebreaks}{%
breaklines,
breakatwhitespace,
numbers=none
}%
%%
\lstdefinestyle{frame}{%
style=linebreaks,
basicstyle=\scriptsize\ttfamily\selectfont,
numbers=left,
numberstyle=\color{BFH-Gray!80},
xleftmargin={4pt},
captionpos=b,
frame=trbl,
frameround=tttt,
framesep=1mm,
basewidth=.5em,
framerule=0pt,
backgroundcolor=\color{BFH-Gray!10},
rulecolor=\color{BFH-Gray!80},
abovecaptionskip=\medskipamount,
belowcaptionskip=\medskipamount
}%
%%
\lstdefinestyle{float}{%
style=frame,
float=tp
}%
%%
%% ------ language specific pre-defines
%%
\lstdefinestyle{bfh-c}{%
language=C,
style=frame,
emph={printf,srand,scanf},
emphstyle=\bfseries\selectfont,
}%
%%
\lstdefinestyle{bfh-cpp}{%
language=C++,
style=frame,
emph={cout,std,::,endl,cin},
emphstyle=\bfseries\selectfont,
}%
%%
\lstdefinestyle{bfh-vhdl}{%
style=frame,
language=VHDL,
}%
%% default
\lstset{
style=float,
}%
\endinput
|