%%
%% This is file `fvrb-ex.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fvrb-ex.dtx  (with options: `fvrb-ex')
%% 
%% IMPORTANT NOTICE:
%% 
%% For the copyright see the source file.
%% 
%% Any modified versions of this file must be renamed
%% with new filenames distinct from fvrb-ex.sty.
%% 
%% For distribution of the original source see the terms
%% for copying and modification in the file fvrb-ex.dtx.
%% 
%% This generated file may be distributed as long as the
%% original source files, as listed above, are part of the
%% same distribution. (The sources need not necessarily be
%% in the same archive or directory.)
%%
%% Package `fvrb-ex' (`fvrb-ex', `hbaw' and `hcolor')
%%
%% COPYING:
%% This package may be distributed under the terms of the LaTeX Project Public
%% License, as described in lppl.txt in the base LaTeX distribution.
%% Either version 1.0 or, at your option, any later version.
%%
%% Denis Girou (CNRS/IDRIS - France) <Denis.Girou@idris.fr> March 27, 1998
%%
%% Package `fvrb-ex'
%%
\NeedsTeXFormat{LaTeX2e}
\def\fileversion{1.9}
\def\filedate{2010/05/16}
\ProvidesPackage{fvrb-ex}[\filedate]
\message{`fvrb-ex' v\fileversion, \filedate\space (Denis Girou)}
\newif\ifpstricks\pstricksfalse
\let\LoadPStricks=\relax
\DeclareOption{pstricks}{\def\LoadPStricks{\RequirePackage{pstricks}}\pstrickstrue}
\DeclareOption{baw}{\def\ColorVersion{n}}
\DeclareOption{color}{\def\ColorVersion{y}}
\DeclareOption{bawcolor}{\def\ColorVersion{?}}
\ProcessOptions\relax
\LoadPStricks
\ifpstricks\RequirePackage{pstricks}\fi
\RequirePackage{fancyvrb}
\newread\ttyin
\def\iden#1{#1}
\def\strip#1#2 \@gobble{\def #1{#2}}
\def\@defpar{\par}
\def\@gobble#1{}
\def\Ask#1#2{%
\message{#2}\read\ttyin to #1\ifx#1\@defpar\def#1{}\else
\iden{\expandafter\strip\expandafter#1#1\@gobble\@gobble} \@gobble\fi}
\def\Answer@Yes{y}
\def\Answer@No{n}
\def\Question@Mark{?}
\def\Question@Color{Color version? (y=yes)}
\def\Highlight@Attributes{}   % Default=nothing
\def\NoHighlight@Attributes{} % Default=nothing
\ifx\ColorVersion\Answer@Yes
  \RequirePackage{color}       % Standard LaTeX `color' package
  \RequirePackage{hcolor}      % Color version
\fi
\ifx\ColorVersion\Answer@No
  \RequirePackage{color}       % Standard LaTeX `color' package
  \RequirePackage{hbaw}        % Black and white version
\fi
\ifx\ColorVersion\Question@Mark
  \Ask\ColorVersion{^^J\Question@Color}
  \ifx\ColorVersion\Answer@Yes
    \RequirePackage{color}      % Standard LaTeX `color' package
    \RequirePackage{hcolor}     % Color version
  \else
    \RequirePackage{color}      % Standard LaTeX `color' package
    \RequirePackage{hbaw}       % Black and white version
  \fi
\fi
\fvset{gobble=2}
\newif\ifFvrbEx@Grid
\def\Example{%
\catcode`\^^M=\active
\@ifnextchar[{\catcode`\^^M=5\Example@}{\catcode`\^^M=5\Begin@Example}}
\def\endExample{%
\end{VerbatimOut}%
\Below@Example{\input{\jobname.tmp}}}
\def\Example@[#1]{\fvset{#1}\Begin@Example}
\def\CenterExample{%
\catcode`\^^M=\active
\@ifnextchar[{\catcode`\^^M=5\Example@}{\catcode`\^^M=5\Begin@Example}}
\def\endCenterExample{%
\end{VerbatimOut}%
\center
\Below@Example{\input{\jobname.tmp}}
\endcenter}
\def\SideBySideExample{%
\catcode`\^^M=\active
\@ifnextchar[{\catcode`\^^M=5\Example@}%
             {\catcode`\^^M=5\Begin@Example}}
\def\endSideBySideExample{%
\end{VerbatimOut}%
\SideBySide@Example{\input{\jobname.tmp}}}
\newcommand{\Begin@Example}{%
\parindent=0pt
\multiply\topsep by 2
\VerbatimEnvironment
\begin{VerbatimOut}[codes={\catcode`\^^a3=12\catcode`\^^a7=12\catcode`\^^b5=12%
                           \catcode`\^^b6=12}]{\jobname.tmp}}
\newcommand{\Below@Example}[1]{%
\VerbatimInput[gobble=0,commentchar=^^a3,commandchars=^^a7^^b5^^b6,numbersep=3pt]%
              {\jobname.tmp}
\catcode`\^^a3=9\relax%
\NoHighlight@Attributes % To suppress possible highlighting
\ifFvrbEx@Grid\vspace{5pt}\fi
#1%
\ifFvrbEx@Grid\vspace{5pt}\fi
\par}
\newcommand{\SideBySide@Example}[1]{%
\@tempdimb=\FV@XRightMargin
\advance\@tempdimb -5mm
\begin{minipage}[c]{\@tempdimb}
  \fvset{xrightmargin=0pt}
  \catcode`\^^a3=9\relax%
  \NoHighlight@Attributes % To suppress possible highlighting
  #1
\end{minipage}%
\@tempdimb=\textwidth
\advance\@tempdimb -\FV@XRightMargin
\advance\@tempdimb 5mm
\begin{minipage}[c]{\@tempdimb}
  \VerbatimInput[gobble=0,commentchar=^^a3,commandchars=^^a7^^b5^^b6,numbersep=3pt,
                 xleftmargin=5mm,xrightmargin=0pt]{\jobname.tmp}
\end{minipage}}
\ifx\PSTricksLoaded\endinput
  \newcommand{\showgrid}{\FvrbEx@Gridtrue}
  \newpsobject{FvrbExGrid}{psgrid}{subgriddiv=0,griddots=10,gridlabels=7pt}
  \def\PCenterExample{\@ifnextchar[{\Pst@Example}{\Pst@@Example}}
  \def\endPCenterExample{%
    \end{VerbatimOut}%
    \Below@Example{%
      \center
      \expandafter\pspicture\Picture@Size
      \ifFvrbEx@Grid\FvrbExGrid\fi\relax
      \input{\jobname.tmp}%
      \endpspicture
      \endcenter
      \smallskip}}
  \def\PSideBySideExample{\@ifnextchar[{\Pst@Example}{\Pst@@Example}}
  \def\endPSideBySideExample{%
    \end{VerbatimOut}%
    \SideBySide@Example{%
      \ifFvrbEx@Grid\vspace{5pt}\fi
      \expandafter\pspicture\Picture@Size
      \ifFvrbEx@Grid\FvrbExGrid\fi\relax
      \input{\jobname.tmp}%
      \endpspicture
      \ifFvrbEx@Grid\vspace{5pt}\fi
      \smallskip}}
  \def\Pst@Example[#1]{\fvset{#1}\Pst@@Example}
  \def\Pst@@Example#1(#2,#3){%
    \catcode`\^^M=\active
    \@ifnextchar({\catcode`\^^M=5\Pst@@@Example(#2,#3)}
                 {\catcode`\^^M=5\Pst@@@Example(0,0)(#2,#3)}}
  \def\Pst@@@Example(#1,#2)(#3,#4){%
    \def\Picture@Size{(#1,#2)(#3,#4)}%
    \Begin@Example}
\fi                             % End \ifx\PSTricksLoaded
\endinput
%%
%% End of file `fvrb-ex.sty'.
