I have some pseudo-code where I want to highlight some sections in a different color (this is why: in an assignment at university, I have some code given and have to adapt it. I want to highlight what I changed for enhanced readability).
\documentclass[english, a4paper, 11pt]{article}
\usepackage{xcolor}
\usepackage{listings}
lstset(language=C) //best for pseudo-code IMHO
\begin{document}
\begin{lstlisting}[frame=single]
public class A<T> extends B<T> {
\textcolor{red} {Stack stack}; //how can I achive this? Nothing should change, except for the textcolor. This code just prints the \textcolor command though.
//ctor
public A() {};
}
\end{lstlisting}
\end{document}
Best Answer
You should provide a MWE. However, I have the following answer: