Hallo,
bin neu im Forum und auch noch in der Lernphase von LateX^^.
ich möchte gerne in meinen Listings zwei Farben verwenden. Meine Programmiersprache ist C#. Die "normalen" Schlüsselwörter (bool, int etc.) sollen blau und die Klassennamen türkis sein. Kann ich zwei Keyword-Listen anlegen die verschiedene Farben haben? Das ganze soll nachher so aussehen wie in Visual Studio.
Danke für die Hilfe!!!
\usepackage{listings}
\lstdefinelanguage{CSharp}
{
morecomment = [l]{//},
morecomment = [l]{///},
morecomment = [s]{/*}{*/},
morestring=",
sensitive = true,
morekeywords = {abstract, event, new, struct,
as, explicit, null, switch,
base, extern, object, this,
bool, false, operator, throw,
break, finally, out, true,
byte, fixed, override, try,
case, float, params, typeof,
catch, for, private, uint,
char, foreach, protected, ulong,
checked, goto, public, unchecked,
class, if, readonly, unsafe,
const, implicit, ref, ushort,
continue, in, return, using,
decimal, int, sbyte, virtual,
default, interface, sealed, volatile,
delegate, internal, short, void,
do, is, sizeof, while,
double, lock, stackalloc,
else, long, static,
enum, namespace, string,
region, endregion}
}
\colorlet{stringcolor}{green!40!black!100}
\colorlet{commencolor}{blue!0!black!100}
\lstset{
language=CSharp,
frame=tlrb,
captionpos=b,
basicstyle=\footnotesize,
keywordstyle=\color{blue}\textbf,
stringstyle=\color{red}\sffamily\scriptsize,
showstringspaces=false,
aboveskip=20pt,
belowskip=15pt
}