# multicols, lstlisting and float

Using the following structure, how can I get the listing to stay on the same page, be it at the top or the bottom?

\documentclass{scrartcl}
\usepackage[ngerman]{babel}

\usepackage{multicol}
\usepackage{listings}

\usepackage{lipsum}

\begin{document}
\begin{multicols}{2}
\lipsum[1]

\begin{lstlisting}[float=*htp, frame=tb]
very
long
listing
spanning
several
lines
\end{lstlisting}
\lipsum[2-7]
\end{multicols}
\end{document}

-
Floats in multicols are only "full line" and always go on the following page. Put the lstlisting environment earlier in the input. –  egreg Jul 29 '11 at 14:29
Floats in multicols are only "full line" and always go on the following page.
Put the lstlisting environment earlier in the input, so that it can float to the desired page.