latex and listings : highlighting some parts of the code

Posted by Jérôme on Stack Overflow See other posts from Stack Overflow or by Jérôme
Published on 2010-05-05T09:07:40Z Indexed on 2010/05/05 9:18 UTC
Read the original article Hit count: 198

Filed under:

I'm using Latex and the listings package to display some C++ code (with syntax highlighting) inside a document.

I need to highlight some parts of the code. This specific highlight has nothing to do with syntax highlighting, it's just some parts of the code I'd like to highlight so that the reader can focus on it.

I wish I could make some variable name, for instance, displaying in bold, and on a yellow background. Here is something I did with MSWord I'd like to reproduce with Latex (of course, not the red and green underlining) :

.

I haven't found a way to do it with the listings package. Is it possible ?

© Stack Overflow or respective owner

Related posts about latex