TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using listings package to show some algorithms in a LaTeX document.

One of the algorithms I want to include is longer than one page. So, my question is:

How can I create a lstlisting environment that spans more than one page??

share|improve this question
Could you add the start of the lstlisting environment that gives problems? – egreg Oct 15 '12 at 13:14
It can spans more than one pages. – kiss my armpit Oct 15 '12 at 13:16
do not use the float option of the environment lstlisting – Herbert Oct 15 '12 at 13:21
up vote 1 down vote accepted

can spans multiple pages:

enter image description here

Please delete this answer if I forget to do so.

share|improve this answer
Ok, Thank you. My problem was I was using float option. – Vicent Oct 15 '12 at 13:31
How did you do this .gif? – Sigur Oct 15 '12 at 13:34
@Sigur: Please visit my profile, and locate the most bottom link. It is explained there. – kiss my armpit Oct 15 '12 at 13:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.