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 very new to LaTeX.

I am inserting a listing as follows:

                 caption=My Caption comes here, 

media is my project directory where all my files and images are stored. One of those files is MyFile.xml which is a code snippet.

The problem is the caption of this listing is very close to it. I would like to add some spacing between the two of them.

Any pointers?

share|improve this question
Try \lstinputlisting[belowskip=4ex, ...] – Daniel Jun 27 '12 at 13:43
Hi Daniel, Thank you for your reply. I tried your recomondation but noticed the spacing between the listing(plus its caption) and the paragraph following the listing is affected. Still couldn't move the caption away from the listing vertically. Thank you once again though. Any ideas? – Vishal Jun 28 '12 at 9:34
abovecaptionskip did it for me :D!! – Vishal Jun 28 '12 at 9:55
@Daniel could you perhaps write up your comment as an answer so that we can close this question? – Seamus Jun 28 '12 at 12:48
@Seamus: Sure, done. – Daniel Jul 1 '12 at 21:46

The documentation of the listing package lists a number of key-val options to affect the spacing between the listing, its caption, and the surrounding material:

  • aboveskip=<dim>, belowskip=<dim> (default: \medskipamount) specify the vertical space above (respectively, below) the listing including its caption.
  • abovecaptionskip=<dim>, belowcaptionskip=<dim> (default: \smallskipamount) specify the vertical space above (respectively, below) the listing's caption. Depending on \captionpos=<t|b> either one has to be used to increase the vertical space between the listing and its caption.
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.