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.

Possible Duplicate:
highlight lines in listings

How can I include a source file with the listings package and highlight specific lines (coloured text or coloured background will do)?

share|improve this question
    
Have a look to this answer from highlight lines in listings. –  Claudio Fiandrino Sep 5 '12 at 8:52
    
Thanks, I missed it. I'm voting to close my question as an exact duplicate. –  Anthony Labarre Sep 5 '12 at 9:38
add comment

marked as duplicate by Anthony Labarre, Tom Bombadil, Harish Kumar, lockstep, percusse Sep 5 '12 at 20:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

If you know which words or sentences you want to highlight, you can use the emph and emphstyle of the command lstset. This is done by hand and not really a trick but it should work.

\usepackage{listings}
\lstset{
language=bash,% or another depending of your input
emph={[1] word with style 1},
emphstyle=[1]\color{teal},
emph={[2] word with style 2},
emphstyle=[2]\color{violet}\bfseries\slshape,
}
share|improve this answer
    
Thanks, but not good enough for me, the terms I would highlight also appear elsewhere in the source code and I really need a single line to be highlighted. –  Anthony Labarre Sep 5 '12 at 8:54
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.