Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!swrinde!elroy.jpl.nasa.gov!decwrl!deccrl!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!tcdcs!dce.ie!em From: em@dce.ie (Eamonn McManus) Newsgroups: comp.text.tex Subject: Re: Centering verbatim text -- how? Message-ID: Date: 2 Apr 91 17:20:11 GMT References: <110059@unix.cis.pitt.edu> Organization: Datacode Communications Ltd, Dublin, Ireland Lines: 16 jordan@unix.cis.pitt.edu (Kenneth D Jordan) writes: >How does one center a section of verbatim text in LaTeX? Specifically, I >would like to mix code fragments ... in with regular text... The problem is that verbatim mode sets every line as a paragraph, and paragraphs always have width \hsize. The way to centre would be to have each line set as a row in a \halign instead; this is the best way to have the width of the verbatim section be the width of the longest line. Hacking verbatim to do this is not impossible. To my mind, though, indenting the code fragments looks at least as good as centring and is easier to do. My cprog style (plug) has a parameter \cprogindent for this purpose. , Eamonn