Search code examples
latexlistings

No Line Spacing at Latex Code Listing


I use 'listings' and 'setspace' package for my latex document. And I have to use the \doublespacing for my document. The trouble is that the code listings seem to be affected by the \doublespacing command. I want all of my code listings have no line spacing while the rest have double line spacing.

How can I achieve that?

Thanks,


Solution

  • You can change the spacing inside the document on the fly. See http://notfaq.wordpress.com/2006/07/26/double-spacing-in-latex/

    If you want this to be automated, you can create your own macro/command/environment that does \singlespacing [... listing ...] \doublespacing.