# How to add indentation to all verbatim environment?

I have a style where all paragraphs have indentation of about 5cm. Verbatim environment does not have any indentation to the combination of paragraphs and verbatim environments does not look good. Something like this:

             This is paragraph ...
Next line of the same paragraph.


and this is verbatim

Is it possible to define an global indent for verbatim environment?

-
Why don't you use listings.sty? –  xport Jan 13 '11 at 17:46
Can you provide a minimal example? I don't think I understand what is going on exactly. Is the verbatim in the margin? –  TH. Jan 14 '11 at 8:32

Some extented packages provide this feature. For example, fancyvrb:

% in preamble \usepackage{fancyvrb}
\begin{Verbatim}[xleftmargin=2em]
hello
\end{Verbatim}


Global setting can be done by \fvset:

\fvset{xleftmargin=2em}

-

what about this idea: You can but all you verbatim environment inside quote environments. If that will fit your needs, you can of course define

\newenvironment{qverb}{\begin{quote}\begin{verbatim}}{\end{verbatim}\end{quote}}


your own "qverb" environment for that case.

Greets

-
It cannot (in fact, impossible) work. You can't use verbatim env in another environment's argument. –  Leo Liu Jan 28 '11 at 7:20
@Leo-Liu - I'm sorry to tell your comment is wrong. I just tried \documentclass[english]{report} \usepackage{babel} \usepackage{blindtext} \begin{document} \blindtext \begin{verbatim} Hallo \end{verbatim} \blindtext \begin{quote}\begin{verbatim} Hallo \end{verbatim}\end{quote} \blindtext \end{document} and it worked well. I think you ment one cannot use other environments INSIDE of verbatim, did you? –  Bastian Ebeling Jan 28 '11 at 7:39
I don't want to argue. You can use verbatim env in quote env, but you cannot use verbatim in arguments of \newenvironment and use it without errors. Just put your definition of qverb in your document and have a try. –  Leo Liu Jan 28 '11 at 7:54
And you can refer this FAQ: tex.ac.uk/cgi-bin/texfaq2html?label=verbwithin –  Leo Liu Jan 28 '11 at 7:55
@Leo-Liu: Okay, I got it - you are right. Thanks for teaching me! –  Bastian Ebeling Feb 24 '11 at 19:45