Document Classesno way to emphasize ")" in listings package?

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
mr.VVoo
Posts: 1
Joined: Fri Feb 15, 2008 3:49 pm

no way to emphasize ")" in listings package?

Post by mr.VVoo »

Hi,

In my LaTeX document I have some source code. I want to color it to make it easy for understanding. Now there is a problem. I'm using the listings package from CTAN. The language is PHP.
Codes:

Code: Select all

\lstdefinestyle{PHP}{otherkeywords={+,-,>,[,],\{,\},!,=,(,;,)},keywordstyle=\color{cgruen},stringstyle=\color{crot},commentstyle=\color{corange},identifierstyle=\color{cblau},moreemph={[3])},emphstyle={[3]\color{cgruen}}}

\lstset{numbers=left,numberstyle=\tiny\sffamily\color{black},numbersep=2mm,backgroundcolor=\color{qcgrau},basicstyle=\scriptsize\ttfamily, linewidth=\textwidth, breaklines=true,xleftmargin=5mm, columns=fixed}

\begin{lstlisting}[language=PHP,name=phppdf,caption={Ausgabe der Notenübersicht (gekürzt)},label=lst:phppdf,style=PHP]
while($r = mysql_fetch_array($q)){
  $pdf->SetXY(30,$_y);
  $pdf->SetFont('Helvetica','B',10);
  $pdf->Cell($pdf->GetStringWidth($r['f_name']),5,$r['f_name']);
  $pdf->SetX(100);
  $pdf->SetFont('Helvetica','',10);
  $pdf->SetFillColor(190);
  $pdf->Cell(50,5,note($r['schnitt'],$r['klausur']),0,0,'C',1);
  $_y = $_y+10;
}\end{lstlisting}
The problem: I want to color ")" --> 'cgruen' but it is the only letter which is not colored. All Other letters {+,-,>,[,],\{,\},!,=,(,;,)} are in color 'cgruen'. Where is the problem?

I hope you understand what i mean because my english isn't very well.

Anyone an idea?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX Beginner's Guide LaTeX Cookbook LaTeX TikZ graphics TikZによるLaTeXグラフィックス
User avatar
Stefan Kottwitz
Site Admin
Posts: 10290
Joined: Mon Mar 10, 2008 9:44 pm

no way to emphasize ")" in listings package?

Post by Stefan Kottwitz »

Hi mr.VVoo,

is your question still unsolved? If that's the case, remove the option breaklines=true if you don't need it, then ) should be emphasized.

Stefan
Post Reply