|
Literate programming
If you want some words emphasized you can use the emph option. But this does not work
for single charcters like digits. In this case the literate option may help. In the following
example all digits in the listing should be colored red.

Special linebreak symbol
\usepackage{listings}
\newcommand{\MyHookSign}{\hbox{\ensuremath\hookleftarrow}}
%
\begin{document}
\lstset{% general command to set parameter(s)
language=Java,
basicstyle=\small,
tabsize=4,
tab=$\to$,
float=tbph,
extendedchars,
breaklines,
prebreak={\space\MyHookSign},
frame=single,
showtabs=false,
showspaces=false,
showstringspaces=false,
keywordstyle=\bfseries,
identifierstyle=\ttfamily,
stringstyle=,
captionpos=b,
aboveskip=\bigskipamount,
}
This gives a listing with a special symbol for breaking lines.
Colored listings


Special environment

Special highlight


Inline code

|