Latex Listings Syntax Highlighting for Groovy and AspectJ

2013-07-08 20:56 by Thorben Bürgel

For my thesis I needed to highlight the syntax of Groovy and AspectJ with the listings package. These languages aren't supported by default and I haven't found sufficient definitions on the internet, thus I defined them by myself.
I want to share my solutions, so that others can use and improve them.

This is the code for AspectJ:


	morekeywords={declare, pointcut, aspect, before, around, after, returning, throwing, call, execution, this, target, args, within, withincode, get, set, initialization, preinitialization, staticinitialization, handler, adviceexecution, cflow, cflowbelow, if, proceed},

This is the code for Groovy:


  keywords=[3]{each, findAll, groupBy, collect, inject, eachWithIndex},
  morekeywords={def, as, in, use},

As you can see I also defined the color scheme for Groovy. I tried to imitate the Groovy console. But I didn't find any good automatic possibility to highlight numbers in red. Does Anybody know to do it? Tell me and I will include it.

I also added an option to manually highlight annotations with %% or $$. I found this snippet in this thread on StackExchange.

By the way the code highlighting on my website doesn't support LaTex, sorry ;)

Go back