--- a/langs.sty Thu Aug 28 01:06:09 2014 +0100
+++ b/langs.sty Sat Aug 30 00:41:52 2014 +0100
@@ -1,78 +1,60 @@
\usepackage{listings}
-\usepackage{xcolor}
-\usepackage{fontspec}
-\setmonofont[Scale=.88]{Consolas}
+\setmonofont[Scale=.95]{Consolas}
\newfontfamily{\consolas}{Consolas}
-\definecolor{javared}{rgb}{0.6,0,0} % for strings
-\definecolor{javagreen}{rgb}{0.25,0.5,0.35} % comments
-\definecolor{javapurple}{rgb}{0.5,0,0.35} % keywords
-\definecolor{javadocblue}{rgb}{0.25,0.35,0.75} % javadoc
+\definecolor{codered}{rgb}{0.6,0,0} % for strings
+\definecolor{codegreen}{rgb}{0.25,0.5,0.35} % comments
+\definecolor{codepurple}{rgb}{0.5,0,0.35} % keywords
+\definecolor{codedocblue}{rgb}{0.25,0.35,0.75} % doc
+\definecolor{codeblue}{rgb}{0.25,0.35,0.75} % types
+
+
-\lstset{language=Java,
- basicstyle=\ttfamily,
- keywordstyle=\color{javapurple}\bfseries,
- stringstyle=\color{javagreen},
- commentstyle=\color{javagreen},
- morecomment=[s][\color{javadocblue}]{/**}{*/},
+\lstdefinelanguage{Scala}{
+ keywords={abstract,case,catch,class,def,%
+ do,else,extends,false,final,finally,%
+ for,if,implicit,import,match,mixin,%
+ new,null,object,override,package,%
+ private,protected,requires,return,sealed,%
+ super,this,throw,trait,true,try,%
+ type,val,var,while,with,yield},%
+ otherkeywords={=>,<-,<\%,<:,>:,\#,@},%
+ sensitive=true,%
+ directives={Int,Char,Rexp,String,Boolean,BigInt,Unit,List,Set},%
+ moredelim=*[directive]:,%
+ morecomment=[l]{//},%
+ morecomment=[n]{/*}{*/},
+ morestring=[b]",
+ morestring=[b]',
+ morestring=[b]"""
+}[keywords,directives,comments,strings]
+
+\lstdefinelanguage{While}{
+ morekeywords={if,then,else,while,do,true,false,write,upto,for,skip},
+ otherkeywords={=,!=,:=,<,>,;},
+ sensitive=true,
+ morecomment=[n]{/*}{*/},
+}
+
+\lstdefinestyle{mystyle}
+ {basicstyle=\ttfamily,
+ keywordstyle=\color{codepurple}\bfseries,
+ directivestyle=\color{codeblue}\bfseries,
+ stringstyle=\color{codegreen},
+ commentstyle=\color{codegreen},
+ morecomment=[s][\color{codedocblue}]{/**}{*/},
numbers=left,
numberstyle=\tiny\color{black},
stepnumber=1,
numbersep=10pt,
tabsize=2,
showspaces=false,
- showstringspaces=false}
-
-\lstdefinelanguage{scala}{
- morekeywords={abstract,case,catch,class,def,%
- do,else,extends,false,final,finally,%
- for,if,implicit,import,match,mixin,%
- new,null,object,override,package,%
- private,protected,requires,return,sealed,%
- super,this,throw,trait,true,try,%
- type,val,var,while,with,yield},
- otherkeywords={=>,<-,<\%,<:,>:,\#,@},
- sensitive=true,
- morecomment=[l]{//},
- morecomment=[n]{/*}{*/},
- morestring=[b]",
- morestring=[b]',
- morestring=[b]"""
-}
-
+ showstringspaces=false,
+ xleftmargin=8mm,
+ emphstyle=\color{codeblue}\bfseries}
\lstset{language=Scala,
- basicstyle=\ttfamily,
- keywordstyle=\color{javapurple}\bfseries,
- stringstyle=\color{javagreen},
- commentstyle=\color{javagreen},
- morecomment=[s][\color{javadocblue}]{/**}{*/},
- numbers=left,
- numberstyle=\tiny\color{black},
- stepnumber=1,
- numbersep=10pt,
- tabsize=2,
- showspaces=false,
- showstringspaces=false}
-
-\lstdefinelanguage{while}{
- morekeywords={if,then,else,while,do,true,false,write,upto,for,skip},
- otherkeywords={=,!=,:=,<,>,;},
- sensitive=true,
- morecomment=[n]{/*}{*/},
-}
+ style=mystyle}
-\lstset{language=While,
- basicstyle=\ttfamily,
- keywordstyle=\color{javapurple}\bfseries,
- stringstyle=\color{javagreen},
- commentstyle=\color{javagreen},
- morecomment=[s][\color{javadocblue}]{/**}{*/},
- numbers=left,
- numberstyle=\tiny\color{black},
- stepnumber=1,
- numbersep=10pt,
- tabsize=2,
- showspaces=false,
- showstringspaces=false}
+\newcommand{\code}[1]{{\lstinline!#1!}}