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? Commented Sep 9, 2010 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.
    Commented Sep 9, 2010 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? Commented Sep 10, 2010 at 8:17
  • I answered this several days ago. Use \renewenvironment to change the definition of the Hchunk environment.
    – TH.
    Commented Sep 11, 2010 at 22:29

1 Answer 1


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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .