%%
%% 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{376}
%% \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.01}
\NeedsTeXFormat{LaTeX2e}
\gdef\filename{egplot.sty}%
\gdef\filedate{1998/06/20}%
\gdef\filemaintainer{Axel Probst}%
\ProvidesPackage{egplot}[\filedate\space\fileversion\space
  Encapsulated gnuplot LaTeX Package (\filemaintainer)]
\RequirePackage{graphicx}[1994/12/15]
\RequirePackage{verbatim}
\RequirePackage{ifthen}
\newboolean{egp@german}
\setboolean{egp@german}{false}
\DeclareOption{german}{%
        \setboolean{egp@german}{true}}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphicx}}
\ProcessOptions
{\catcode`\#=11\gdef\egpcomment{#}}
\def\egpwrite#1{%
  \if@egpio
    \immediate\write\@outegp{#1}%
  \fi
  \ignorespaces}
\newif\if@egpio
\@egpiotrue
\newwrite\@outegp
\newcommand{\egpfile}[1][\jobname]{%
  \def\theegpfile{#1}%
  \if@egpio
    \immediate\openout\@outegp=\theegpfile.gp\relax
    \egpwrite{\egpcomment\space \theegpfile.gp -- %
              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%
  \egpwrite{print 'generating picture ---- \theegpfile\theegpfig.eps'^^J%
            set output '\theegpfile\theegpfig.eps'^^J}
  \egp@includegraphics{\theegpfile}{\theegpfig}%
  \egpcmds}
\def\egp@x#1{%
   \egp@start%
   \egpwrite{print 'generating picture ---- \theegpfile\theegpfig.eps'^^J%
             set output '\theegpfile\theegpfig.eps'^^J}
   \egp@includegraphicx[#1]{\theegpfile}{\theegpfig}%
   \egpcmds}
\def\egp@def{%
  \egp@start%
   \egpwrite{print 'generating picture ---- \theegpfile\theegpfig.eps'^^J%
             set output '\theegpfile\theegpfig.eps'^^J}
  \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 #1.gp 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 #2.gp 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^^J}
       \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}
\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}%
   \egpwrite{print 'calculating value ----- \theegpfile\theegpcalc.val'^^J%
             set term table; set output '\theegpfile\theegpcalc.tmp'^^J%
             set samples 2^^J%
             set zero 0^^J%
             plot [0:0] \egp@expression^^J}
   \ifthenelse{\boolean{egp@german}}{%
       \egpwrite{!tail -3 \theegpfile\theegpcalc.tmp | head -1 | cut -f 2 -d' ' | sed -e 's/[.]/{,}/' >\theegpfile\theegpcalc.val^^J}}
       {\egpwrite{!tail -3 \theegpfile\theegpcalc.tmp | head -1 | cut -f 2 -d' ' >\theegpfile\theegpcalc.val^^J}}
   \egpwrite{!rm -f \theegpfile\theegpcalc.tmp^^J%
             reset^^J}}
\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 #1#2.gp 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}}
\egpfigprelude{set terminal postscript eps monochrome dashed "Helvetica" 17}
\egpfigepilog{reset}
\InputIfFileExists{egplot.cfg}
                  {\typeout{egp: Using configuration file 'egplot.cfg'}}
                  {}
\endinput
%%
%% End of file `egplot.sty'.
