TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

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'm using a lot of \lstinputlisting in my document and the compilation of it is really slow. Why it takes so long? How could I make things better?

share|improve this question
up vote 2 down vote accepted

I guess, \lstinputlisting does a lot of parsing which takes time. The manual for the listings package mentions the option savemem which can reduce compile time if you use a lot of languages. Or use the draft option to print only captions and define labels, but omit the actual listing.

I have in my current document an appendix with a lot of listings. I omit the appendix with the versions package to save some time.

share|improve this answer
Thanks. The savemem didn't actually save me any noticable time. I even use \lstloadlanguages just like manual says, but that didn't do either. But the draft works just fine for me – Łukasz Klich Aug 28 '11 at 8:43

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.