|
1 \usepackage{listings} |
|
2 \usepackage{xcolor} |
|
3 \usepackage{fontspec} |
|
4 \setmonofont[Scale=MatchLowercase]{Consolas} |
|
5 \newfontfamily{\consolas}{Consolas} |
|
6 |
|
7 \setmonofont{Consolas} |
|
8 \definecolor{javared}{rgb}{0.6,0,0} % for strings |
|
9 \definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments |
|
10 \definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords |
|
11 \definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc |
|
12 |
|
13 \lstset{language=Java, |
|
14 basicstyle=\ttfamily, |
|
15 keywordstyle=\color{javapurple}\bfseries, |
|
16 stringstyle=\color{javagreen}, |
|
17 commentstyle=\color{javagreen}, |
|
18 morecomment=[s][\color{javadocblue}]{/**}{*/}, |
|
19 numbers=left, |
|
20 numberstyle=\tiny\color{black}, |
|
21 stepnumber=1, |
|
22 numbersep=10pt, |
|
23 tabsize=2, |
|
24 showspaces=false, |
|
25 showstringspaces=false} |
|
26 |
|
27 \lstdefinelanguage{scala}{ |
|
28 morekeywords={abstract,case,catch,class,def,% |
|
29 do,else,extends,false,final,finally,% |
|
30 for,if,implicit,import,match,mixin,% |
|
31 new,null,object,override,package,% |
|
32 private,protected,requires,return,sealed,% |
|
33 super,this,throw,trait,true,try,% |
|
34 type,val,var,while,with,yield}, |
|
35 otherkeywords={=>,<-,<\%,<:,>:,\#,@}, |
|
36 sensitive=true, |
|
37 morecomment=[l]{//}, |
|
38 morecomment=[n]{/*}{*/}, |
|
39 morestring=[b]", |
|
40 morestring=[b]', |
|
41 morestring=[b]""" |
|
42 } |
|
43 |
|
44 |
|
45 \lstset{language=Scala, |
|
46 basicstyle=\ttfamily, |
|
47 keywordstyle=\color{javapurple}\bfseries, |
|
48 stringstyle=\color{javagreen}, |
|
49 commentstyle=\color{javagreen}, |
|
50 morecomment=[s][\color{javadocblue}]{/**}{*/}, |
|
51 numbers=left, |
|
52 numberstyle=\tiny\color{black}, |
|
53 stepnumber=1, |
|
54 numbersep=10pt, |
|
55 tabsize=2, |
|
56 showspaces=false, |
|
57 showstringspaces=false} |
|
58 |
|
59 \lstdefinelanguage{while}{ |
|
60 morekeywords={if,then,else,while,do,true,false,write,upto}, |
|
61 otherkeywords={=,!=,:=,<,>,;}, |
|
62 sensitive=true, |
|
63 morecomment=[n]{/*}{*/}, |
|
64 } |
|
65 |
|
66 |
|
67 \lstset{language=While, |
|
68 basicstyle=\ttfamily, |
|
69 keywordstyle=\color{javapurple}\bfseries, |
|
70 stringstyle=\color{javagreen}, |
|
71 commentstyle=\color{javagreen}, |
|
72 morecomment=[s][\color{javadocblue}]{/**}{*/}, |
|
73 numbers=left, |
|
74 numberstyle=\tiny\color{black}, |
|
75 stepnumber=1, |
|
76 numbersep=10pt, |
|
77 tabsize=2, |
|
78 showspaces=false, |
|
79 showstringspaces=false} |