# Lstlisting in twocolumn document

I have a problem when using lstlisting in twocolumn document. At my university I have to make reports in twocolumn documents. My teacher send me pre done .tex file with this code in it:

\documentclass[a4paper, 10pt, twocolumn]{article}
\setlength{\columnsep}{5mm}
\usepackage{anysize}
\marginsize{1cm}{1cm}{1cm}{1cm}
\usepackage{polski}
\usepackage[cp1250]{inputenc}
%\usepackage[framed, numbered]{mcode}
\usepackage{listings}
\usepackage{graphicx}
\usepackage[usenames,dvipsnames]{color}
\usepackage{marvosym} %dla symbolu euro
\usepackage{array}
\usepackage[section] {placeins}
\renewcommand{\baselinestretch}{1.15} %interlinia


But when I use lstlisting function, text from 1st column overlaps 2nd column, and I have to manually wrap too long lines to make it clear. Is it any better way of dealing with such a thing? I'm new to LaTeX, so please be as precise as possible. :) Sorry for my english, I'm not a native english speaker.

Use the breaklines=true option:

\documentclass[a4paper, 10pt, twocolumn]{article}
\usepackage{listings}
\usepackage{lipsum}

\lstset{breaklines=true}

\begin{document}

\lipsum[4]
\begin{lstlisting}
test listing test listing test listing test listing test listing test listing test listing test listing test listing test listing test listing
\end{lstlisting}
\lipsum[4]

\end{document}


• Thank you very much. :) Now It is pleasure to write reports. Jan 31, 2014 at 15:00