Take the 2-minute tour ×
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.

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?

share|improve this question
3  
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
add comment

2 Answers

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}
share|improve this answer
add comment

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

share|improve this answer
    
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
2  
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
add comment

Your Answer

 
discard

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.