[OS X TeX] Verbatim in displaymath environment

Luis Sequeira lfsequeira at gmail.com
Mon Dec 15 04:20:02 EST 2008


> Hello all,
>
>
>  I have  some computer science code in my text that I display with
> the verbatim environment, and I should like to precede it with
> two large vertical bars, usually obtained by \left|\left| in the
> displaymath environment. So I tried the following~:
>
> \begin{displaymath}
> \left|\left|
> \begin{verbatim}
> (...)
> \end{verbatim}
> \right.\right.
> \end{displaymath}
>
>   Not surprisingly, this does not work.
>   How would the correct version of this look like?
>
>                                       TIA,
>
>                                           Ewan

You could try the fancyvrb package. It greatly improves on all things  
verbatim. It defines the Verbatim environment (with capital V), which  
is much souped up version of the verbatim environment (it even allows  
for some formatting commands inside the verbatim text - say, for  
instance, if you want a reserved word in your code to appear in  
boldface, or in a different color, you can!).
Here is an example that does almost what you want (it just produces a  
single line instead of a double one, but I'm sure there is a nice way  
to achieve the double line if you look it up).


\documentclass{article}
\usepackage{fancyvrb}

\begin{document}

\begin{Verbatim}[frame=leftline]
AAA
BBB
CCC
\end{Verbatim}

\end{document}




Luis Sequeira




More information about the MacOSX-TeX mailing list