How can I use \textit
in a listing?
\documentclass[a4paper]{article}
\begin{document}
\begin{lstlisting}[label=test]
Some code.
\textit{This should be italic.}
Some code.
\end{lstlisting}
\end{document}
italiclistings
How can I use \textit
in a listing?
\documentclass[a4paper]{article}
\begin{document}
\begin{lstlisting}[label=test]
Some code.
\textit{This should be italic.}
Some code.
\end{lstlisting}
\end{document}
Best Answer
You can emphasize words using the
emph
andemphstyle
keys. See page 19 in the listings manual.I agree, it is not a good solution for highlighting single lines of code. I think here is what you are looking for: