langs.sty
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Sat, 30 Aug 2014 00:41:52 +0100
changeset 234 bf7eecc9cefe
parent 230 0fd668d7b619
child 235 bc460179148c
permissions -rw-r--r--
updated scala ho
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
218
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     1
\usepackage{listings}
234
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
     2
\setmonofont[Scale=.95]{Consolas}
218
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     3
\newfontfamily{\consolas}{Consolas}
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
     4
234
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
     5
\definecolor{codered}{rgb}{0.6,0,0}            % for strings
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
     6
\definecolor{codegreen}{rgb}{0.25,0.5,0.35}    % comments
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
     7
\definecolor{codepurple}{rgb}{0.5,0,0.35}      % keywords
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
     8
\definecolor{codedocblue}{rgb}{0.25,0.35,0.75} % doc
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
     9
\definecolor{codeblue}{rgb}{0.25,0.35,0.75}    % types
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    10
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    11
218
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    12
234
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    13
\lstdefinelanguage{Scala}{
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    14
  keywords={abstract,case,catch,class,def,%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    15
    do,else,extends,false,final,finally,%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    16
    for,if,implicit,import,match,mixin,%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    17
    new,null,object,override,package,%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    18
    private,protected,requires,return,sealed,%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    19
    super,this,throw,trait,true,try,%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    20
    type,val,var,while,with,yield},%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    21
  otherkeywords={=>,<-,<\%,<:,>:,\#,@},%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    22
  sensitive=true,%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    23
  directives={Int,Char,Rexp,String,Boolean,BigInt,Unit,List,Set},%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    24
  moredelim=*[directive]:,%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    25
  morecomment=[l]{//},%
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    26
  morecomment=[n]{/*}{*/},
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    27
  morestring=[b]",
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    28
  morestring=[b]',
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    29
  morestring=[b]"""
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    30
}[keywords,directives,comments,strings]
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    31
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    32
\lstdefinelanguage{While}{
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    33
  morekeywords={if,then,else,while,do,true,false,write,upto,for,skip},
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    34
  otherkeywords={=,!=,:=,<,>,;},
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    35
  sensitive=true,
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    36
  morecomment=[n]{/*}{*/},
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    37
}
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    38
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    39
\lstdefinestyle{mystyle}
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    40
       {basicstyle=\ttfamily,
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    41
	keywordstyle=\color{codepurple}\bfseries,
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    42
        directivestyle=\color{codeblue}\bfseries,
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    43
	stringstyle=\color{codegreen},
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    44
	commentstyle=\color{codegreen},
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    45
	morecomment=[s][\color{codedocblue}]{/**}{*/},
218
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    46
	numbers=left,
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    47
	numberstyle=\tiny\color{black},
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    48
	stepnumber=1,
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    49
	numbersep=10pt,
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    50
	tabsize=2,
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    51
	showspaces=false,
234
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    52
	showstringspaces=false,
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    53
        xleftmargin=8mm,
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    54
        emphstyle=\color{codeblue}\bfseries}
218
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    55
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    56
\lstset{language=Scala,
234
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    57
        style=mystyle}
218
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    58
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
234
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    60
\newcommand{\code}[1]{{\lstinline!#1!}}