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

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}

share|improve this question
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
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
up vote 3 down vote accepted

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.

share|improve this answer

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.