I am trying to make listing environment brake lines. Unfortunately breaklines=true does not work for me. Here is my code:
\usepackage{listings}
\begin{document}
\lstset{language=matlab,breaklines=true, extendedchars=true, numbers=left, numberstyle=\tiny, stepnumber=1, numbersep=5pt, basicstyle=\footnotesize, frame=lines, keywordstyle=\bfseries\color{blue}, commentstyle=\color{green!50!black}}
\lstset{emph={classdef, properties, methods},emphstyle={\color{blue}\bfseries}}
\renewcommand{\lstlistingname}{Algorytm}
\begin{lstlisting}[caption=Funkcja \emph{createFoR} klasy \emph{row}., label=func_createFoR, float=ht]
classdef row < handle
properties
rp %promien rownoleznika
end
methods
function [T1 T2] = createFoR(obj,hT,Alpha,Beta,DeltaAlpha,DeltaBeta)
P1(1,1) = obj.r * cosd(Beta);
P1(1,2) = obj.r * cosd(90 - Beta);
P1(1,3) = obj.r * tand(90 - (Alpha + DeltaAlpha));
P1(2,:) = hT.P(1,:);
%hT - trojkat z wyzszego wiersza
P1(3,1) = obj.r * cosd(Beta + DeltaBeta);
P1(3,2) = obj.r * cosd(90 - (Beta + DeltaBeta));
P1(3,3) = obj.r * tand(90 - (Alpha + DeltaAlpha));
T1 = triangle(P1);
P2(1,:) = hT.P(1,:);
P2(2,:) = hT.P(3,:);
P2(3,:) = P1(3,:);
T2 = triangle(P2);
end
end
\end{lstlisting}
This is how it looks: 
May I kindly ask you for help?


breaklinesdoes work for me in lines 8, 15, and 16, if the code starts with\documentclass[a5paper]{article}\usepackage{xcolor}. – Heiko Oberdiek Aug 24 '13 at 20:02\lstset{columns=flexible}makes the lines shorter and the spacing of the words more natural. – Heiko Oberdiek Aug 24 '13 at 20:03matlab-prettifierpackage; see this answer. – jub0bs Apr 28 '14 at 15:48