A simple(?) question, how do I reduce the space before and after a environment?

I suppose I'm after a redefine environment command that I can put at the top of my document.


I'm using Sweave and the R highlight environment. Basically, R code gets transformed into latex code. The end latex result looks like this:

     \hlprompt{\usebox{\hlnormalsizeboxgreaterthan}{\ }}<snip>

      NC-17{\ }{\ }{\ }{\ }PG{\ }PG-13{\ }{\ }{\ }{\ }{\ }<snip>

 %A few more Hinput and Houtput environments.

I would like to reduce the space after \end{Houtput} For example \end{Houtput}\vspace{-0.2em}

  • 1
    Could you post a small example code showing exactly which space do you want to reduce? Also which environment are you trying to redefine? – Juan A. Navarro Sep 9 '10 at 15:01
  • 1
    The highlight package documentation says that you should just redefine Hinput and Houtput as you desire. Note that using a negative \vspace is almost always the wrong thing to do. – TH. Sep 9 '10 at 18:36
  • @TH: If vspace is the wrong thing to do, what's the correct thing to do, i.e. how do you redefine Hinput? Or is this another question? – csgillespie Sep 10 '10 at 8:17
  • I answered this several days ago. Use \renewenvironment to change the definition of the Hchunk environment. – TH. Sep 11 '10 at 22:29

The highlight package seems to define


You can change those to be more suitable to what you want. In particular, you can remove the \vspace. Just use \renewenvironment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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