langs.sty
author Christian Urban <christian dot urban at kcl dot ac dot uk>
Wed, 03 Sep 2014 11:01:49 +0100
changeset 237 370c0647a9bf
parent 235 bc460179148c
child 238 527fdb90fffe
permissions -rw-r--r--
more material
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}{
237
370c0647a9bf more material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 235
diff changeset
    14
  morekeywords={abstract,case,catch,class,def,%
234
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,%
235
bc460179148c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 234
diff changeset
    23
  %directives={Int,Char,Rexp,String,Boolean,BigInt,Unit,List,Set},%
bc460179148c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 234
diff changeset
    24
  %moredelim=*[directive]:,%
234
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]"""
235
bc460179148c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 234
diff changeset
    30
}[keywords,comments,strings]
234
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,
235
bc460179148c updated
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 234
diff changeset
    42
        %directivestyle=\color{codeblue}\bfseries,
234
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,
237
370c0647a9bf more material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 235
diff changeset
    54
        emphstyle=\color{codeblue}\bfseries,
370c0647a9bf more material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 235
diff changeset
    55
        keepspaces}
218
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    56
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    57
\lstset{language=Scala,
234
bf7eecc9cefe updated scala ho
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 230
diff changeset
    58
        style=mystyle}
218
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    59
8f3f8d82da8b added two new packages
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
diff changeset
    60
237
370c0647a9bf more material
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents: 235
diff changeset
    61
\newcommand{\code}[1]{{\lstinline{#1}}}