Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

As far as I know, the Scala programming language is not supported by the listings package. Is an implementation under way? Will it be included in the standard listings distribution?

share|improve this question
1  
Once I had the same problem with another programming language. I defined it myself and send the result to the listings-maintainer. In the next release it was added. When you look to lstdrvrs.dtx you can find a lot of authors. –  knut Mar 7 '12 at 22:32
add comment

1 Answer

up vote 5 down vote accepted

Shamelessly pinched from this site, the following provides a Scala language definition for listings. Simply place it in your preamble, and use listings in the normal way.

% "define" Scala
\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]"""
}
share|improve this answer
    
Thanks, a lot of keywords are missing, though. Like Unit, Boolean, Int... Other than that, thanks for the TeX code. :) –  Filip B. Vondrášek May 14 at 16:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.