TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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'm having the following problem: I'm using the listings package to render what is supposed to look like a teminal screenshot. But the background colour is striped. In my other code snippets the background colour is light gray so it is much less noticeable, but it's really ugly on the black background. I've looked at potential solutions online using \shaded or colorbox, but none have worked because of the shadowbox I'm using.

Any input would be much appreciated.

  language=C,                % choose the language of the code
  basicstyle=\ttfamily\footnotesize\color{white} ,       % the size of the fonts that    are used for the code
  tabsize=2,                      % sets default tabsize to 2 spaces
  captionpos=b,                   % sets the caption-position to bottom
  breaklines=true,                % sets automatic line breaking
  breakatwhitespace=true,         % sets if automatic breaks should only happen at    whitespace
  numberstyle=\tiny\color{midgray},  % the style that is used for the line-numbers
  stepnumber=2,                   % the step between two line-numbers. If it's 1, each line 
                              % will be numbered
  numbersep=5pt,                  % how far the line-numbers are from the code
  lineskip={-1.5pt}, % single line spacing
share|improve this question

migrated from stackoverflow.com Feb 18 '12 at 2:23

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question. – Werner Feb 18 '12 at 2:37
While code snippets are useful in explanations, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. – Peter Grill Feb 18 '12 at 3:16
Possible duplicate: Problems with the lstlisting environment (margin and white line) – Werner Jun 18 '13 at 23:29

Use the tcolorbox package, which uses the listings package, but has better support for effects.

enter image description here

This is what a MWE is:

This is a \LaTeX\ example which displays the text as source code
and in compiled form.

The package has recently been updated to include English documentation, so you might need to update your distribution. The dotted line in the middle can be removed if you don't use the output frame with the listing only option.

share|improve this answer
Very nice terminal! – Werner Feb 18 '12 at 4:30
@Werner Thanks! With a bit of patience and JavaScript you might get it to work as one in a pdf:) – Yiannis Lazarides Feb 18 '12 at 5:02

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.