[pstricks] Re: Including verbatim stuff in a pspicture

Denis Girou Denis.Girou at idris.fr
Tue Nov 26 19:51:12 CET 2002


The following message is a courtesy copy of an article
that has been posted to comp.text.tex as well.

>>>>> "Alasdair.McAndrew" == Alasdair McAndrew <Alasdair.McAndrew at notvu.edu.au> writes:

    Alasdair.McAndrew> How do I include a verbatim environment inside a pspicture?  I've tried
    Alasdair.McAndrew> plain verbatim, fanvyvrb, etc, inside minipages, mboxes etc, but I can't
    Alasdair.McAndrew> quite get it to work.

  I must say that I do not truly see the real interest to do that..., but in
any case with the `fancyvrb' package it can be done using the "BVerbatim"
environment.

  More widely interesting is probably to put verbatim material inside
personnalized boxes, which is a close problem of the preceding one.
With `fancyvrb', you have to use the \BVerbatimInput macro if the content is
in an external file and the "SaveVerbatim" environment with the \BUseVerbatim
macro otherwise. See the documentation for details.

\documentclass[a4paper]{article}

\usepackage{fancyvrb}
\usepackage{pstcol}
\usepackage{pst-grad}

\definecolor{LemonChiffon}{rgb}{1.,0.98,0.8}
\definecolor{Orange}      {rgb}{1.,0.65,0.}
\definecolor{PaleGreen}   {rgb}{0.6,0.98,0.6}

\begin{document}

\begin{pspicture}(3,1)
\begin{BVerbatim}
First line.
Second line.
\end{BVerbatim}
\end{pspicture}

\vspace{5mm}
\begin{pspicture}(3,1)\psgrid[subgriddiv=0]
\begin{BVerbatim}
First line.
Second line.
\end{BVerbatim}
\end{pspicture}

\begin{SaveVerbatim}{VerbEnv}
First line.
Second line.
\end{SaveVerbatim}

\vspace{5mm}
\fbox{\BUseVerbatim{VerbEnv}}

\vspace{5mm}
\colorbox{Orange}{\BUseVerbatim{VerbEnv}}

\vspace{5mm}
\setlength{\fboxrule}{1mm}
\setlength{\fboxsep}{2mm}
\fcolorbox{red}{Orange}{\BUseVerbatim{VerbEnv}}

\vspace{5mm}
\psframebox{\BUseVerbatim{VerbEnv}}

\vspace{5mm}
\psframebox[framearc=0.5,framesep=1,linestyle=dashed]{%
  \BUseVerbatim{VerbEnv}}

\vspace{5mm}
\psframebox[linecolor=red,fillstyle=solid,fillcolor=LemonChiffon]{%
  \BUseVerbatim{VerbEnv}}

\vspace{5mm}
\psdblframebox[linewidth=0.07,fillstyle=solid,fillcolor=PaleGreen]{%
  \BUseVerbatim[boxwidth=0.9\textwidth]{VerbEnv}}

\vspace{5mm}
\psovalbox{\BUseVerbatim{VerbEnv}}

\vspace{5mm}
\psframebox[fillstyle=gradient,gradmidpoint=0,gradangle=90]{%
  \BUseVerbatim[fontfamily=helvetica,fontseries=b]{VerbEnv}}

\end{document}


Denis Girou
-- 
--------------------------------------------------------------------------
Institut du Développement et des Ressources en Informatique Scientifique |
Centre National de la Recherche Scientifique                             |
Bâtiment 506 - B.P. 167 - 91403 Orsay Cedex - France                     |
--------------------------------------------------------------------------



More information about the PSTricks mailing list