Remove highlighted words in lstlisting

2.6k Views Asked by At

As you can see in my algorithm, there are words that are highlighted in bold, but I don't want that the words in the variable section be in bold because they are just comments. But, I want that these words be bold if I am talking about the code, like the one defined in the upon tag. My algorithm is written with lstlisting.

I have the words in bold because I have defined here [2].

How I remove the words bold when I don't want bold?

Snippet of algorithm

[2] Words that should be in bold

\lstdefinelanguage{distributed}{
morekeywords={Implements,Uses,upon,event,procedure,returns,return,trigger,while,exists,such,that,do,for,forall,from,to,all,if,elif,then,else,end,endif,endwhile,and,or,break},
morekeywords={Require,Ensure,constants,variables,abort,note},
}
2

There are 2 best solutions below

0
On BEST ANSWER

This is the solution for me:

\lstdefinelanguage{distributed}{
     morekeywords={Implements,Uses,upon,event,procedure,returns,return,trigger,while,exists,such,that,do,for,forall,from,to,all,if,elif,then,else,end,endif,endwhile,and,or,break},
     morekeywords={Require,Ensure,constants,variables,abort,note},
     morecomment=[l]{--},
     morecomment=[l]{//},  % l is for line comment
     morecomment=[n]{(*}{*)},
     morecomment=[is]{/*}{*/},  % s is for start and end delimiter
     morestring=[b]",
     morestring=[d]'
 }
0
On

I think you should define the "morecomment" in your language definition to print comments in the right way. See also

http://texdoc.net/texmf-dist/doc/latex/listings/listings.pdf

on page 22.