I want to emphasize some lines in a listing environment by applying a special style on them (for example, a different background color).
All custom styling seem to be content-based. I would like to be able to do something like:
\lstinputlisting[emphlines={4},emphstyle=\color{red}]{sourcecode.f}
If it is not possible with the plain listings package, what do you suggest to get this effect?
My goal is to highlight different lines in different slides of a beamer presentation, so if there is a simple way to do this, I will be very thankful.
Edit: I came up with this solution after Ulrike's idea. I'm satisfied with the result, and the redundancy is bearable for my taste. It'd be very nice if someone more knowledgeable in TeX scripting suggests some improvements.
firstnumber=last
option, so that numbering sequentiality is preserved.