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 am preparing a beamer presentation and using the lstlisting environment in order to put in code. However, I would like to use the \pause command within lstlisting. By definition that is not possible. I am numbering the lines so it is bad if I just end and begin the environment again in order to insert \pause. Any tips?

share|improve this question
up vote 11 down vote accepted

You can escape to LaTeX (Section 4.14 Escaping to LaTeX of the listings documentation) and use \pause:



line1 |\pause|
line2 |\pause|

share|improve this answer
Oh, I have to admit that I didn't look into the documentation. Mia culpa! Newbie mistake. Thank you any way, Gonzalo. You are bailing me out here (also on the other question, thanks!) – MCB Jun 7 '12 at 14:53
Can we use your answer for \uncover as what had been discussed in How to make overlay still work inside lstlisting environment?? – kiss my armpit Jun 7 '12 at 16:03
@Forgiver no; escaping to LaTeX doen't work as expected when \uncover or \onslide are involved. – Gonzalo Medina Jun 7 '12 at 16:49

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.