% Fast and dirty solution
% to get LaTeX access to gnuplot point symbols.
% Caution: This is just a fast hack!
% License: GPL (see http://www.gnu.org/)
% Author: Tobias N"ahring (http://www.tn-home.de/)
% Date (YY-MM-DD: 04-07-10)
%
% BugFix (YY-MM-DD: 06-04-17) \scalebox of pstricks is incompatible to
% \scalebox of graphics.
% This causes problems with the TeX-Live distribution.
% Happily, when used with a common scaling factor in x- and
% y-direction both \scalebox commands are equal.
% gplPts.sty only uses this form now.
% We do not need the multido-package, so it is removed from the list
% of required packages.
%
\ProvidesPackage{gplPts}
\RequirePackage{pstricks}
\special{header=gnuplot.pro}

%
% Hack:
% In some distributions \scalebox is not defined in
% the pstricks package. Therefore, we have to use
% \scalebox from the graphics package.
%
% Changes:
%
% Bugfix (YY-MM-DD: 08-06-03) Question:
% Martin(?) complains on d.c.t.t that it is not possible to set the
% color of the gnuplot symbols and lines.
%
% Setting of symbol color already works fine with \psset{linecolor=red}.
% Changed \withGnudict such that it uses \stroke from pstricks rather
% than the raw postscript command stroke. With this changes setting of
% the colors of gnuplot lines works fine too.
%

\expandafter\ifx\csname scalebox\endcsname\relax
\message{Hack 06-04-17 in gplPts.sty: Stealing scalebox from graphics.}
\RequirePackage{graphics}
\fi

\def\gplScale{0.1}

\def\gplPt#1{\begin{pspicture}(-1ex,-1ex)(1ex,1ex)
    \scalebox{\gplScale}{
    \pscustom{
      \code{
        gnudict begin
        0 0 #1
        end
      }
    }}
  \end{pspicture}}

\def\gplUserDefinedLength{1}

\long\def\withGnudict#1#2{%
  \pscustom{
    \code{
      gnudict begin
      /udl {\gplUserDefinedLength} def
      #1
      end % 2008-06-03: end does not destroy the objects on the
          % graphics stack and is therefore okay at this point.
    }
    #2
    \stroke % 2008-06-03: using pstrics-primitive instead of raw
            % postscript to allow setting of colors on pstricks level.
    %\code{
    %stroke
    %end
    %}
  }%
}

% Defining Lines:
\newcommand\gplLine[1][10]{%
  \def\gplLineLength{#1}%
  \gplLineI}
\newcommand\gplLineI[2][10ex]{%
  {%
    \newdimen\gplHeight\gplHeight#1%
    \scalebox{\gplScale}{\begin{pspicture}(0,0)(\gplLineLength,\gplHeight)%
        \withGnudict{LT#2}{\moveto(0,0.5\gplHeight)\lineto(\gplLineLength,0.5\gplHeight)}%
      \end{pspicture}%
    }%
  }%
}

% Just for testing:

\long\def\foreachI#1#2,#3.#4{
  \def#1{#2}
  #4
  \def\mylist{#3}
  \show\mylist
  \ifx\mylist\empty\else
  \foreachI#1#3.{#4}
  \fi
}
\long\def\foreach#1#2.#3{{
    \def\mylist{#2}\def\empty{}
    \ifx\mylist\empty\else
    \foreachI#1#2,.{#3}
    \fi
  }}
