source: doc/theses/rob_schluntz_MMath/cfa-format.tex @ 2514d3d7

Last change on this file since 2514d3d7 was 67982887, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

specialize thesis directory-names

  • Property mode set to 100644
File size: 6.4 KB
Line 
1% \usepackage{xcolor}
2% \usepackage{listings}
3% \usepackage{booktabs}
4% \usepackage{array}
5% \newcolumntype{?}{!{\vrule width 1pt}} % thick vertical line
6
7
8% like Mac Classic or iPlastic
9% \definecolor{basicCol}{HTML}{000000}
10% \definecolor{commentCol}{HTML}{0066FF}
11% \definecolor{stringCol}{HTML}{036A07}
12% \definecolor{keywordCol}{HTML}{0000FF}
13% \definecolor{identifierCol}{HTML}{318495}
14
15% like Visual Studio 2010
16% \definecolor{basicCol}{HTML}{000000}
17% \definecolor{commentCol}{HTML}{006400}
18% \definecolor{stringCol}{HTML}{A31515}
19% \definecolor{keywordCol}{HTML}{0000FF}
20% \definecolor{identifierCol}{HTML}{000000}
21
22\definecolor{basicCol}{HTML}{000000}
23\definecolor{commentCol}{HTML}{000000}
24\definecolor{stringCol}{HTML}{000000}
25\definecolor{keywordCol}{HTML}{000000}
26\definecolor{identifierCol}{HTML}{000000}
27
28% from https://gist.github.com/nikolajquorning/92bbbeef32e1dd80105c9bf2daceb89a
29\lstdefinelanguage{sml} {
30  morekeywords= {
31    EQUAL, GREATER, LESS, NONE, SOME, abstraction, abstype, and, andalso, array, as, before, bool, case, char, datatype, do, else, end, eqtype, exception, exn, false, fn, fun, functor, handle, if, in, include, infix, infixr, int, let, list, local, nil, nonfix, not, o, of, op, open, option, orelse, overload, print, raise, real, rec, ref, sharing, sig, signature, string, struct, structure, substring, then, true, type, unit, val, vector, where, while, with, withtype, word
32  },
33  morestring=[b]",
34  morecomment=[s]{(*}{*)},
35}
36
37\lstdefinelanguage{D}{
38  % Keywords
39  morekeywords=[1]{
40    abstract, alias, align, auto, body, break, cast, catch, class, const,
41    continue, debug, delegate, delete, deprecated, do, else, enum, export,
42    false, final, finally, for, foreach, foreach_reverse, function, goto, if,
43    immutable, import, in, inout, interface, invariant, is, lazy, macro, mixin,
44    module, new, nothrow, null, out, override, package, pragma, private,
45    protected, public, pure, ref, return, shared, static, struct, super,
46    switch, synchronized, template, this, throw, true, try, typedef, typeid,
47    typeof, union, unittest, volatile, while, with
48  },
49  % Special identifiers, common functions
50  morekeywords=[2]{enforce},
51  % Ugly identifiers
52  morekeywords=[3]{
53    __DATE__, __EOF__, __FILE__, __LINE__, __TIMESTAMP__, __TIME__, __VENDOR__,
54    __VERSION__, __ctfe, __gshared, __monitor, __thread, __vptr, _argptr,
55    _arguments, _ctor, _dtor
56  },
57  % Basic types
58  morekeywords=[4]{
59     byte, ubyte, short, ushort, int, uint, long, ulong, cent, ucent, void,
60     bool, bit, float, double, real, ushort, int, uint, long, ulong, float,
61     char, wchar, dchar, string, wstring, dstring, ireal, ifloat, idouble,
62     creal, cfloat, cdouble, size_t, ptrdiff_t, sizediff_t, equals_t, hash_t
63  },
64  % Strings
65  morestring=[b]{"},
66  morestring=[b]{'},
67  morestring=[b]{`},
68  % Comments
69  comment=[l]{//},
70  morecomment=[s]{/*}{*/},
71  morecomment=[s][\color{blue}]{/**}{*/},
72  morecomment=[n]{/+}{+/},
73  morecomment=[n][\color{blue}]{/++}{+/},
74  % Options
75  sensitive=true
76}
77
78\lstdefinelanguage{rust}{
79  % Keywords
80  morekeywords=[1]{
81    abstract, alignof, as, become, box,
82    break, const, continue, crate, do,
83    else, enum, extern, false, final,
84    fn, for, if, impl, in,
85    let, loop, macro, match, mod,
86    move, mut, offsetof, override, priv,
87    proc, pub, pure, ref, return,
88    Self, self, sizeof, static, struct,
89    super, trait, true,  type, typeof,
90    unsafe, unsized, use, virtual, where,
91    while, yield
92  },
93  % Strings
94  morestring=[b]{"},
95  % Comments
96  comment=[l]{//},
97  morecomment=[s]{/*}{*/},
98  % Options
99  sensitive=true
100}
101
102\newcommand{\KWC}{K-W C\xspace}
103
104\renewcommand{\ttdefault}{pcr}
105
106\newcommand{\basicstylesmall}{\scriptsize\ttfamily\color{basicCol}}
107
108\lstdefinestyle{defaultStyle}{
109  escapeinside={@@},
110  basicstyle=\footnotesize\ttfamily\color{basicCol},
111  keywordstyle=\bfseries\color{keywordCol},
112  commentstyle=\itshape\color{commentCol},
113  identifierstyle=\color{identifierCol},
114  stringstyle=\color{stringCol},
115  mathescape=true,
116  columns=fixed,
117  aboveskip=4pt,                                  % spacing above/below code block
118  belowskip=3pt,
119  keepspaces=true,
120  frame=lines,
121  literate=,
122  showlines=true,                                 % show blank lines at end of code
123  showspaces=false,
124  showstringspaces=false,
125  escapechar=\$,
126  xleftmargin=\parindentlnth,                     % indent code to paragraph indentation
127  moredelim=[is][\color{red}\bfseries]{**R**}{**R**},    % red highlighting
128  % moredelim=* detects keywords, comments, strings, and other delimiters and applies their formatting
129  % moredelim=** allows cumulative application
130}
131\lstset{
132  language = CFA,
133  style=defaultStyle
134}
135\lstMakeShortInline[basewidth=0.5em,breaklines=true,breakatwhitespace,basicstyle=\normalsize\ttfamily\color{basicCol}]% single-character for \lstinline
136
137\lstnewenvironment{cfacode}[1][]{
138  \lstset{
139    language = CFA,
140    style=defaultStyle,
141    #1
142    % belowcaptionskip=1\baselineskip,
143    % breaklines=true,
144    % frame=L,
145  }
146}{}
147
148\lstnewenvironment{cppcode}[1][]{
149  \lstset{
150    language = c++,
151    style=defaultStyle,
152    #1
153  }
154}{}
155
156\lstnewenvironment{javacode}[1][]{
157  \lstset{
158    language = java,
159    style=defaultStyle,
160    #1
161  }
162}{}
163
164\lstnewenvironment{scalacode}[1][]{
165  \lstset{
166    language = scala,
167    style=defaultStyle,
168    #1
169  }
170}{}
171
172\lstnewenvironment{smlcode}[1][]{
173  \lstset{
174    language = sml,
175    style=defaultStyle,
176    #1
177  }
178}{}
179
180\lstnewenvironment{dcode}[1][]{
181  \lstset{
182    language = D,
183    style=defaultStyle,
184    #1
185  }
186}{}
187
188\lstnewenvironment{rustcode}[1][]{
189  \lstset{
190    language = rust,
191    style=defaultStyle,
192    #1
193  }
194}{}
195
196\newcommand{\zero}{\lstinline{zero_t}\xspace}
197\newcommand{\one}{\lstinline{one_t}\xspace}
198\newcommand{\ateq}{\lstinline{\@=}\xspace}
199
200\newenvironment{newtext}{\color{red}}{\ignorespacesafterend}
201
202% \lstset{ %
203%   backgroundcolor=\color{white},
204%   basicstyle=\footnotesize,
205%   breakatwhitespace=false,
206%   breaklines=true,
207%   captionpos=b,
208%   commentstyle=\color{mygreen},
209%   escapeinside={\%*}{*)},
210%   extendedchars=true,
211%   frame=single,
212%   keywordstyle=\color{blue},
213%   language=Prolog,
214%   numbers=left,
215%   numbersep=5pt,
216%   numberstyle=\tiny\color{mygray},
217%   rulecolor=\color{black},
218%   showspaces=false,
219%   showstringspaces=false,
220%   showtabs=false,
221%   stepnumber=2,
222%   stringstyle=\color{mymauve},
223%   tabsize=2,
224%   title=\lstname,
225%   morekeywords={not,\},\{,preconditions,effects },
226%   deletekeywords={time}
227% }
Note: See TracBrowser for help on using the repository browser.