I am writting a book and I use the listings package to type some matlab code. I would like to highlight every code block with an arrow or whatever hanging in the margin at the first line. Moreover The code should be indented.
More specifically, I would like to define a listings environment, say 'matlabcode', so that the latex code
\documentclass{article}
\usepackage{listings}
\usepackage{lipsum}
\lstnewenvironment{matlabcode}{}{}
\begin{document}
\lipsum[1]
\begin{matlabcode}
>> plot(sin(1:10))
more matlab code
more matlab code
\end{matlabcode}
\end{document}
gave something like

where the arrow might be a latex symbol, a pgf/tikZ picture, etc.

matlab-prettifierpackage; see this answer. – jub0bs Apr 28 '14 at 15:30