Created
February 2, 2012 11:13
-
-
Save Blaisorblade/1722948 to your computer and use it in GitHub Desktop.
LaTeX listings: add support for Scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Other listings-related settings from | |
% http://lampsvn.epfl.ch/trac/scala/export/26099/scala-tool-support/trunk/src/latex/scaladoc.sty | |
% activate the language and predefine settings | |
\lstset{ | |
language=Scala,% | |
xleftmargin=4mm,% | |
aboveskip=3mm,% | |
belowskip=3mm,% | |
fontadjust=true,% | |
columns=[c]fixed,% | |
keepspaces=true,% | |
basewidth={0.58em, 0.53em},% | |
tabsize=2,% | |
basicstyle=\renewcommand{\baselinestretch}{0.95}\ttfamily,% | |
commentstyle=\itshape,% | |
keywordstyle=\bfseries,% | |
mathescape=true,% | |
escapechar=¤,% | |
captionpos=b,% | |
framerule=0.3pt,% | |
firstnumber=0,% | |
numbersep=1.5mm,% | |
numberstyle=\tiny,% | |
} | |
\lstdefinestyle{floating}{% | |
xleftmargin=10pt,% | |
xrightmargin=5pt,% | |
aboveskip=4mm,% | |
belowskip=4mm,% | |
fontadjust=true,% | |
columns=[c]flexible,% | |
keepspaces=true,% | |
basewidth={0.5em, 0.425em},% | |
tabsize=2,% | |
basicstyle=\renewcommand{\baselinestretch}{0.95}\ttfamily,% | |
commentstyle=\rm,% | |
keywordstyle=\bfseries,% | |
mathescape=true,% | |
captionpos=b,% | |
framerule=0.3pt,% | |
firstnumber=0,% | |
numbersep=1.5mm,% | |
numberstyle=\tiny,% | |
float=tbp,% | |
frame=tblr,% | |
framesep=5pt,% | |
framexleftmargin=3pt,% | |
abovecaptionskip=\smallskipamount,% | |
belowcaptionskip=\smallskipamount,% | |
} % to define: caption, label | |
\newcommand{\code}[1]{% | |
\lstinline[%keywordstyle=,% | |
flexiblecolumns=true,% | |
basicstyle=\ttfamily]£#1£} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% To activate Scala support for the listings package, include this file with: | |
% \input{scalamacros.tex} | |
% This file includes code from the Scala distribution (package scala-tool-support), hence it is released | |
% under a BSD-like license - original download page: http://www.scala-lang.org/downloads | |
% The license itself: http://www.scala-lang.org/node/146 | |
\usepackage{listings} | |
% Merged from http://tihlde.org/~eivindw/latex-listings-for-scala/ and | |
% http://lampsvn.epfl.ch/trac/scala/export/26099/scala-tool-support/trunk/src/latex/scaladoc.sty | |
% "define" Scala | |
%Keyword list taken from the scaladoc definition. | |
\lstdefinelanguage{scala}{ | |
morekeywords={% | |
abstract,case,catch,class,def,do,else,extends,% | |
false,final,finally,for,forSome,if,implicit,import,lazy,% | |
match,new,null,object,override,package,private,protected,% | |
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]""" | |
}[keywords,comments,strings] | |
% activate the language and predefine settings | |
\lstset{language=Scala} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment