[Tex/LaTex] How to add indentation to all verbatim environment

indentationverbatim

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?

Best Answer

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}
Related Question