Search code examples
latexlstlisting

Remove highlighted words in lstlisting


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},
}

Solution

  • 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]'
     }