0

I am including my source code with the listings package and

\lstinputlisting[options]{path/to/code.c}

Now I want to mark some parts of the code with a different background, or a different text color.

An ideal solution would be to just give the line numbers and get the code in between with a diffirent background.

Is there an easy solution for it or maybe a feature in the lisings package?

Here a small example I have the following latex script:

\documentclass[12pt,a4paper]{article}
\usepackage{listings}
\begin{document}
   \lstinputlistings[language=tcl,tabsize=4]{example.tcl}
\end{document}

And the following tcl script (example.tcl)

set a 5
set b 5
set c [expr $a + $b]
puts "$c $b $a"

What I want to do now is to mark line 2-3 with a different background color or with another text color.

TM90
  • 95

0 Answers0