File: lstcustom.sty

package info (click to toggle)
bornagain 23.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 103,936 kB
  • sloc: cpp: 423,131; python: 40,997; javascript: 11,167; awk: 630; sh: 318; ruby: 173; xml: 130; makefile: 51; ansic: 24
file content (273 lines) | stat: -rw-r--r-- 7,933 bytes parent folder | download | duplicates (4)
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
% this is customisation of 'listings' packag
% TODO: cleanup

% xcolor must be included before (not done here, because different options may be desired).

\definecolor{darkviolet}{rgb}{0.5,0,0.4} %
\definecolor{darkgreen}{rgb}{0,0.4,0.2} %
\definecolor{darkblue}{rgb}{0.1,0.1,0.9}%
\definecolor{darkgrey}{rgb}{0.5,0.5,0.5} %
\definecolor{lightblue}{rgb}{0.4,0.4,1} %
\definecolor{lightblue1}{rgb}{0 0.25 1}
\definecolor{darkpink}{rgb}{1 0 0.75}
\definecolor{dred}{rgb}{0.8,0,0}
\definecolor{lightlightgrey}{rgb}{0.95 0.95 0.95} %


%\definecolor{oneblue}{rgb}{0,0,0.75}
\definecolor{dockerblue}{rgb}{0.11,0.56,0.98} %
%\definecolor{MyDarkBlue1}{rgb}{0.1,0,0.55}
%\definecolor{lightgrey}{rgb}{0.9,0.9,0.9}

\lstdefinelanguage{pseudo}{
  keywords={procedure,end,return,integer,real,foreach,for,each,
  do,if,then,else,while,until,true,false,algorithm},
  comment=[l]{//}
}

\lstdefinelanguage{oaw}{
  morekeywords={import, this, create, let, then, Void, extension, JAVA,
  IMPORT, DEFINE, ENDDEFINE, LET, ENDLET, FOR, FILE, ENDFILE, ITERATOR, FOREACH,
  AS, IF, ENDFOREACH, ENDIF, EXPAND, INSTANCEOF, USING, SEPARATOR, CSTART, CEND,
  PROTECT, ENDPROTECT, ID, EXTENSION,
  context, ERROR, WARNING, INFO, enum},
  morecomment=[l]{//},
  morecomment=[s]{/*}{*/},
  % FIXME: listings does not see guillemets, so any regions with them wont work
  morecomment=[s]{«REM»}{«ENDREM»},
  morecomment=[s]{«REM}{»},
  morestring=[s]{'}{'},
  morestring=[s]{"}{"},
  escapechar={@},
  % required for use with UTF-8
  literate={«}{\guillemotleft}{1}
           {»}{\guillemotright}{1}
}

% extension, if, then, else, switch, Void, Boolean, Integer, Real, String, let

\lstdefinelanguage{shell}
{alsodigit={>},
  morekeywords={linux>},
  backgroundcolor=\color{lstbackgroundshellcolor}
}

\lstdefinelanguage{csimul}
{alsodigit={>},
  alsodigit={\%},
  morekeywords={CONDITIONER>, COUNTER>, \%},
  backgroundcolor=\color{lstbackgroundshellcolor},
  morecomment=[l]{\#}
}

\newcommand{\lstfontfamily}{\ttfamily}
%\newcommand{\lstfontfamily}{\sffamily} % Adapt to schneider
\newcommand{\textlst}[1]{\texttt{#1}}
\newcommand{\mathlst}[1]{\mathtt{#1}}
\lstdefinestyle{tiny}{basicstyle=\tiny\lstfontfamily}
\lstdefinestyle{scriptsize}{basicstyle=\scriptsize\lstfontfamily}
\lstdefinestyle{footnotesize}{basicstyle=\footnotesize\lstfontfamily}
\lstdefinestyle{small}{basicstyle=\small\lstfontfamily}
\lstdefinestyle{normalsize}{basicstyle=\normalsize\lstfontfamily}
\lstdefinestyle{large}{basicstyle=\lstfontfamily}

\lstdefinestyle{monitor}{morekeywords={monitor, export}}
\lstdefinestyle{ConcPascal}{language=Pascal,style=monitor}

% To make this accessible to Emacs/AUCTeX (C-c C-f C-o),
% add something like this to TeX-mode-hook:
%  (setq LaTeX-font-list
%       (append '((?{\^O} "\\codefont{" "}"))
%               LaTeX-font-list))
%\newcommand{\codefont}[1]{{\renewcommand{\textnormal}[1]{\textlst{#1}}\lstfontfamily #1}}
\newcommand{\mathcodefont}[1]{\mathtt{#1}}
\newcommand{\codefont}[1]{{\lstfontfamily #1}}
\newlength{\lstframexleftmargin}
\setlength{\lstframexleftmargin}{1mm}

% rulesepcolor and backgroundcolor are set in beamercustom{presentation|handout}.sty
\lstdefinestyle{mydefault}{
  style=scriptsize,
  emphstyle=\color{red},
  framexleftmargin=\lstframexleftmargin,
  frame=shadowbox,
  keywordstyle=\structure,
  commentstyle=\itshape,
  columns=flexible,            % Columns not rigid - gives nicer spacing
  gobble=4,                    % Gobble first 4 characters of each line
  escapeinside=`',
  escapechar=@,
  lineskip=+0.2ex,
  rulesepcolor=\color{lstrulesepcolor},
  % WARNING: For some reason, the settin of backgroundcolor must take
  % place at the very end!!!
  backgroundcolor=\color{lstbackgroundprogcolor}
}

\lstdefinestyle{eclipse}{
    basicstyle=\small\lstfontfamily,
    emphstyle=\color{red}\bfseries,
    keywordstyle=\color{darkviolet}\bfseries,
    commentstyle=\color{darkgreen},
    stringstyle=\color{darkblue},
    numberstyle=\color{darkgrey}\lstfontfamily,
    emph={Simulation,MaterialManager,MultiLayer,Layer,Particle,ParticleDecoration},
    emphstyle=\color{dockerblue},
    % get also javadoc style comments
    morecomment=[s][\color{lightblue}]{/**}{*/},
   %columns=fullflexible, %spaceflexible, %flexible, fullflexible
%  escapeinside=`',
%  escapechar=@,
  showstringspaces=false,
  numbers=left,
escapeinside={@}{@}, %reference to line number in text
breaklines = true
}

\lstdefinestyle{black}{
  basicstyle=\small\lstfontfamily,
  numbers=left,
  columns=fullflexible,
  breaklines=true,
  mathescape=true,
  escapechar=\#,
  tabsize=4,
  frame=lines,
  showstringspaces=false
}




\lstdefinestyle{eclipseboxed}{
moredelim=[is][\color{red}\itshape]{|}{|},
   escapeinside={@}{@},
    basicstyle=\small\lstfontfamily,
    emphstyle=\color{red}\bfseries,
    keywordstyle=\color{darkviolet}\bfseries,
    commentstyle=\color{darkgreen},
    stringstyle=\color{darkblue},
    numberstyle=\color{darkgrey}\lstfontfamily,
    emph={Simulation,MaterialManager,MultiLayer,Layer,Particle,ParticleDecoration},
    emphstyle=\color{dockerblue},
    backgroundcolor=\color{lightlightgrey},
    morecomment=[s][\color{lightblue}]{/**}{*/},
  showstringspaces=false,
  numbers=left,
 emphstyle={[2]\color{blue}},
 frame=single,
firstnumber=auto,
 rulesepcolor=\color{darkgrey},
rulecolor=\color{darkgrey},
breaklines = true
%showspaces=true,
%showtabs=true,
%tabsize=1
}

% use proper tt font that supports bold printing, e.g. by
% \usepackage{courier}
\lstdefinestyle{seminar}{
  basicstyle=\small\ttfamily,
  numbers=left,
  breaklines=true,
  mathescape=true,
  escapechar=\#,
  tabsize=4,
  showstringspaces=false
}


\lstdefinestyle{commandline}{
   escapeinside={@}{@},
    basicstyle=\small\lstfontfamily,
    emphstyle=\color{red}\bfseries,
    keywordstyle=\color{darkviolet}\bfseries,
    commentstyle=\color{darkgreen},
    stringstyle=\color{darkblue},
    numberstyle=\color{darkgrey}\lstfontfamily,
    emphstyle=\color{red},
    backgroundcolor=\color{lightlightgrey},
    morecomment=[s][\color{lightblue}]{/**}{*/},
  showstringspaces=false,
 emphstyle={[2]\color{blue}},
 frame=single,
firstnumber=auto,
 rulesepcolor=\color{darkgrey},
rulecolor=\color{darkgrey},
breaklines = true,
numbers=none,
%showspaces=true,
%showtabs=true,
%tabsize=1
}


% Another example of customisation (to Study)

% \documentclass[a4paper,12pt]{article}
% \usepackage[utf8]{inputenc}
%
% % Default fixed font does not support bold face
% \DeclareFixedFont{\ttb}{T1}{txtt}{bx}{n}{12} % for bold
% \DeclareFixedFont{\ttm}{T1}{txtt}{m}{n}{12}  % for normal
%
% % Custom colors
% \usepackage{color}
% \definecolor{deepblue}{rgb}{0,0,0.5}
% \definecolor{deepred}{rgb}{0.6,0,0}
% \definecolor{deepgreen}{rgb}{0,0.5,0}
%
% \usepackage{listings}
%
% % Python style for highlighting
% \newcommand\pythonstyle{\lstset{
% language=Python,
% basicstyle=\ttm,
% otherkeywords={self},             % Add keywords here
% keywordstyle=\ttb\color{deepblue},
% emph={MyClass,__init__},          % Custom highlighting
% emphstyle=\ttb\color{deepred},    % Custom highlighting style
% stringstyle=\color{deepgreen},
% frame=tb,                         % Any extra options here
% showstringspaces=false            %
% }}
%
%
% % Python environment
% \lstnewenvironment{python}[1][]
% {
% \pythonstyle
% \lstset{#1}
% }
% {}
%
% % Python for external files
% \newcommand\pythonexternal[1]{{
% \pythonstyle
% \lstinputlisting{#1}}}
%
% % Python for inline
% \newcommand\pythoninline[1]{{\pythonstyle\lstinline!#1!}}
%
% \begin{document}
%
% \section{``In-text'' listing highlighting}
%
% \begin{python}
% class MyClass(Yourclass):
%     def __init__(self, my, yours):
%         bla = '5 1 2 3 4'
%         print bla
% \end{python}
%
% \section{External listing highlighting}
%
% \pythonexternal{demo.py}
%
% \section{Inline highlighting}
%
% Definition \pythoninline{class MyClass} means \dots
%
% \end{document}
%