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.

this is my style defined for C#:

\lstdefinestyle{CSharp}{
  language=[Sharp]C
  ,captionpos=b
  ,columns=fixed
  ,morekeywords={var,get,set}
  ,basicstyle=\footnotesize\ttfamily 
  ,keywordstyle=\color{blue}
  ,commentstyle=\color{ForestGreen}
  ,stringstyle=\color{BrickRed};
  ,breaklines=true
  ,tabsize=1
  ,showstringspaces=false
  ,showspaces=false
  ,showtabs=false
  ,breakatwhitespace=true
  ,escapeinside={(*@}{@*)}
  ,emph={double,bool,int,unsigned,char,true,false,void,get,set}
  ,emphstyle=\color{blue}
  ,lineskip={-1.5pt} % single line spacing
}

The problem is that for some reason, when the embedded strings are rendered, they look like this:

Console.WriteLine(;";S;:;String;");

but should:

Console.WriteLine("S:String");

I would appreciate any help.

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

The tell-tale hint is the presence of multiple semicolons just before each "token" (syntactic unit of characters) involved in the string.

If you inspect your source code, you'll find the line stringstyle=\color{BrickRed};, which is telling lstlisting to add a semicolon and switch the color to BrickRed each time a token inside a string is typeset. Get rid of the semi-colon and the problem should be fixed.

share|improve this answer
    
How could I miss that, thanks! –  JanuszL Oct 6 '11 at 16:05
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.