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

For any unknown reason I have to use verbatim instead of listings.

Note: This issue also appear when using listings but Herbert's answer can fix it. Unfortunately, the trick Herbert used there cannot be applied here. I attempted to use the same trick but it failed as follows.



            class Foo
                    public static void Main()
                            Console.WriteLine("hello xport");

\begin{frame}{hello xport}


enter image description here

It was compiled by pdflatex and latex->dvips->ps2pdf provided by TeX Live 2010 on Windows 7. And my editor is TeXnicCenter.


If you want to try my code above, you must copy them in Edit mode. Copying the code directly from the rendered HTML will make my original tabs changed to spaces. :-)

share|improve this question
I assume that beamer ignores all spaces outside frames by default. Maybe place the code inside the frame and the fragile option. – Martin Scharrer Jul 16 '11 at 18:21
I tested it and I got indentation. – Stefan Kottwitz Jul 16 '11 at 18:21
up vote 5 down vote accepted

The \defverbatim ignores the tab character. Use instead spaces for the indentation or the package fancyvrb which can replace the tabs with a given number of spaces.

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.