%%
%% This is file `egplot.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% egplot.dtx  (with options: `style')
%% 
%% Copyright (C) 1998 by Axel.Probst@bam.de
%% 
%% This file is NOT the source for emp, because almost all comments
%% have been stripped from it.  It is NOT the preferred form of emp
%% for making modifications to it.
%% 
%% Therefore you can NOT redistribute and/or modify THIS file.  You can
%% however redistribute the complete source (emp.dtx and emp.ins)
%% and/or modify it under the terms of the GNU General Public License as
%% published by  the Free Software Foundation; either version 2, or (at
%% your option) any later version.
%% 
%% As a special exception, you can redistribute parts of this file for
%% the electronic distribution of scientific papers, provided that you
%% include a short note pointing to the complete source.
%% 
%% Emp is distributed in the hope that it will be useful, but
%% WITHOUT ANY WARRANTY; without even the implied warranty of
%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
%% GNU General Public License for more details.
%% 
%% You should have received a copy of the GNU General Public License
%% along with this program; if not, write to the Free Software
%% Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
%% 
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% \CheckSum{449}
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\fileversion{v1.02a}
\NeedsTeXFormat{LaTeX2e}
\gdef\filename{egplot.sty}%
\gdef\filedate{1998/07/08}%
\gdef\filemaintainer{Axel Probst}%
\ProvidesPackage{egplot}[\filedate\space\fileversion\space
  Encapsulated gnuplot LaTeX Package (\filemaintainer)]
\RequirePackage{verbatim}
\RequirePackage{ifthen}
\newboolean{egp@german}
\setboolean{egp@german}{false}
\DeclareOption{german}{%
        \setboolean{egp@german}{true}}
\newboolean{egp@oldgp}
\setboolean{egp@oldgp}{true}
\DeclareOption{gnuplot35}{%
        \setboolean{egp@oldgp}{true}}
\DeclareOption{gnuplot36beta}{%
        \setboolean{egp@oldgp}{false}}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphicx}}
\ProcessOptions
\RequirePackage{graphicx}[1994/12/15]
{\catcode`\#=11\gdef\egpcomment{#}}
\def\egpwrite#1{%
  \if@egpio
    \immediate\write\@outegp{#1}%
  \fi
  \ignorespaces}
\newif\if@egpio
\@egpiotrue
\newwrite\@outegp
\newcounter{egpfilenum}            % 1998-03-07
\setcounter{egpfilenum}{0}         % 1998-03-07
\newcommand{\egpfile}[1][\jobname\theegpfilenum_]{%
  \def\theegpfile{#1}%
  \ifthenelse{\equal{\theegpfile}{\jobname\theegpfilenum_}}{%
     \stepcounter{egpfilenum}%
     \def\theegpfilename{\jobname\theegpfilenum.gp}}{%
     \def\theegpfilename{\theegpfile.gp}}
  \if@egpio
    \immediate\openout\@outegp=\theegpfilename\relax
    \egpwrite{\egpcomment\space \theegpfilename -- %
              do not edit, generated automatically by \jobname.tex^^J}
    \expandafter\ifx\expandafter*\the\egp@prelude*\else
      \egpwrite{\the\egp@prelude;}%
    \fi
  \fi
  \setcounter{egpfig}{0}
  \setcounter{egpcalc}{0}}
\let\theegpfile\relax
\newcounter{egpfig}
\newcounter{egpcalc}
\newtoks\egp@prelude
\newtoks\egp@figprelude
\newtoks\egp@figepilog
\def\egpprelude#1{\egp@prelude={#1}}
\def\egpfigprelude#1{\egp@figprelude={#1}}
\def\egpfigepilog#1{\egp@figepilog={#1}}
\def\egpaddtoprelude#1{\egp@prelude=\expandafter{\the\egp@prelude^^J#1}}
\def\egpaddtofigprelude#1{\egp@figprelude=\expandafter{\the\egp@figprelude^^J#1}}
\def\egpaddtofigepilog#1{\egp@figepilog=\expandafter{\the\egp@figepilog^^J#1}}
\def\endegpfile{%
  \egpwrite{\egpcomment\space the end.}%
  \let\theegpfile\relax
  \if@egpio
    \immediate\closeout\@outegp
  \fi}
\newcommand{\egp}[1][*]{%
  \def\egp@@name{#1}%
  \egp@}
\newcommand{\egpx}[2][*]{%
   \def\egp@@name{#1}%
   \egp@x{#2}}
\newcommand{\egpdef}[1]{%
  \def\egp@@name{#1}%
  \egp@def}
\def\egp@{%
  \egp@start%
  \ifthenelse{\boolean{egp@oldgp}}
     {\egpwrite{\egpcomment\space --- \theegpfile\theegpfig.eps ---}}
     {\egpwrite{print 'generating picture ---- \theegpfile\theegpfig.eps'}}
  \egpwrite{set output '\theegpfile\theegpfig.eps'}
  \egp@includegraphics{\theegpfile}{\theegpfig}%
  \egpcmds}
\def\egp@x#1{%
  \egp@start%
  \ifthenelse{\boolean{egp@oldgp}}
     {\egpwrite{\egpcomment\space --- \theegpfile\theegpfig.eps ---}}
     {\egpwrite{print 'generating picture ---- \theegpfile\theegpfig.eps'}}
  \egpwrite{set output '\theegpfile\theegpfig.eps'}
  \egp@includegraphicx[#1]{\theegpfile}{\theegpfig}%
  \egpcmds}
\def\egp@def{%
  \egp@start%
  \ifthenelse{\boolean{egp@oldgp}}
     {\egpwrite{\egpcomment\space --- \theegpfile\theegpfig.eps ---}}
     {\egpwrite{print 'generating picture ---- \theegpfile\theegpfig.eps'}}
  \egpwrite{set output '\theegpfile\theegpfig.eps'}
  \egpcmds}
\def\egp@start{%
  \egp@checkfile
  \global\expandafter\advance\csname c@egpfig\endcsname \@ne
  \egp@@def{\egp@@name}%
   \expandafter\ifx\expandafter*\the\egp@figprelude*\else
    \egpwrite{\the\egp@figprelude}%
  \fi}
\def\egp@checkfile{%
  \ifx\theegpfile\relax
    \errhelp={Outside an egpfile environment, I have no clue as to where^^J%
              the gnuplot commands should go.   I will use egpdefault.gp^^J%
              for this graph, but you'd better fix your code!}%
    \errmessage{I detected a egp environment outside of egpfile}%
    \egpfile[egpdefault]
  \fi}
\def\egp@includegraphics#1#2{%
  \leavevmode
  \IfFileExists{#1#2.eps}%
    {\includegraphics{#1#2.eps}}%
    {\typeout{%
      egp: File #1#2.eps\space not found:^^J%
      egp: Process \theegpfilename\space with gnuplot and then %
           reprocess this file.}}}
\newcommand{\egp@includegraphicx}[3][scale=1]{%
  \leavevmode
  \IfFileExists{#2#3.eps}%
    {\includegraphics[#1]{#2#3.eps}}%
    {\typeout{%
      egp: File #2#3.eps\space not found:^^J%
      egp: Process \theegpfilename\space with gnuplot and then %
           reprocess this file.}}}
\def\egpcmds{%
  \begingroup
    \@bsphack
    \let\do\@makeother\dospecials
    \catcode`\^^M\active
    \def\verbatim@processline{\egpwrite{\the\verbatim@line}}%
    \verbatim@start}%
\def\endegpcmds{%
    \@esphack
  \endgroup}
\def\endegp{%
  \endegpcmds
  \ifthenelse{\boolean{egp@german}}{%
       \egpwrite{!sed -e '/[0-9]*[.][0-9]*)\ .show/s/[.]/,/' %
                 \theegpfile\theegpfig.eps >\theegpfile\theegpfig.tmp}
       \egpwrite{!cp \theegpfile\theegpfig.tmp \theegpfile\theegpfig.eps}
       \egpwrite{!rm -f \theegpfile\theegpfig.tmp}}
       {}
   \expandafter\ifx\expandafter*\the\egp@figepilog*\else
    \egpwrite{\the\egp@figepilog}%
  \fi
  \egpwrite{}}
\def\endegpx{\endegp}
\def\endegpdef{\endegp}
\def\egp@@def#1{%
  \global\e@namedef{egp@k:f:#1}{\theegpfile}%
  \global\e@namedef{egp@k:c:#1}{\theegpfig}}
\def\e@namedef#1{\expandafter\edef\csname #1\endcsname}
\newcommand{\egpuse}[2][scale=1]{%
  \@ifundefined{egp@k:f:#2}%
   {\typeout{egp: \string\egpuse: `#2' undefined!}}%
   {\egp@includegraphicx[#1]{\@nameuse{egp@k:f:#2}}{\@nameuse{egp@k:c:#2}}}}
\newcommand{\egpcalc}[2][*]{%
   \def\egp@@name{#1}%
   \def\egp@expression{#2}
   \egp@calc}
\def\egp@calc{%
   \egp@checkfile
   \global\expandafter\advance\csname c@egpcalc\endcsname \@ne
   \egpc@@def{\egp@@name}%
   \ifthenelse{\boolean{egp@oldgp}}
      {\egpwrite{\egpcomment\space --- \theegpfile\theegpcalc.val ---}}
      {\egpwrite{print 'calculating value ----- \theegpfile\theegpcalc.val'}}
   \egpwrite{set term table; set output '\theegpfile\theegpcalc.tmp'^^J%
             set samples 2^^J%
             set zero 0^^J%
             plot [0:0] \egp@expression}
   \ifthenelse{\boolean{egp@german}}{%
       \egpwrite{!tail -3 \theegpfile\theegpcalc.tmp | head -1 |%
                 cut -f 2 -d' ' | sed -e 's/[.]/{,}/' %
                 >\theegpfile\theegpcalc.val}}
       {\egpwrite{!tail -3 \theegpfile\theegpcalc.tmp | head -1 |%
                  cut -f 2 -d' ' >\theegpfile\theegpcalc.val}}
   \egpwrite{!rm -f \theegpfile\theegpcalc.tmp}
   \egpwrite{}}
\def\egpc@@def#1{%
  \global\e@namedef{egp@k:f:#1}{\theegpfile}%
  \global\e@namedef{egp@k:v:#1}{\theegpcalc}}
\newcommand{\egp@includevalue}[2]{%
  \IfFileExists{#1#2.val}%
               {\input{#1#2.val}}%
               {\typeout{%
                  egp: File #1#2.val\space not found:^^J%
                  egp: Process \theegpfilename\space with gnuplot and then %
                       reprocess this file.}}}
\newcommand{\egpshowval}[2][*]{%
   \def\egp@@name{#1}%
   \def\egp@expression{#2}%
   \egp@calc%
   \egp@includevalue{\theegpfile}{\theegpcalc}}
\newcommand{\egpuseval}[1]{%
  \@ifundefined{egp@k:f:#1}%
   {\typeout{egp: \string\egpuseval: `#1' undefined!}}%
   {\egp@includevalue{\@nameuse{egp@k:f:#1}}{\@nameuse{egp@k:v:#1}}}}
\newcommand{\egpassign}[2]{%
   \egpwrite{#1=#2}\egpshowval{#1}}
\ifthenelse{\boolean{egp@oldgp}}
   {\egpprelude{save "reset.gp"}}
   {\relax}
\egpfigprelude{set terminal postscript eps monochrome dashed "Helvetica" 17}
\ifthenelse{\boolean{egp@oldgp}}{%
   \egpfigepilog{load "reset.gp"}}{%
   \egpfigepilog{reset}}
\InputIfFileExists{egplot.cfg}
                  {\typeout{egp: Using configuration file 'egplot.cfg'}}
                  {}
\endinput
%%
%% End of file `egplot.sty'.