% 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
\documentclass{article}
\usepackage{hyperref}
\usepackage{ngerman}
\usepackage{multido}
\usepackage{gplPts}
\textwidth\paperwidth
\oddsidemargin2cm
\hoffset-1in
\advance\textwidth-2\oddsidemargin
\voffset-1in
\textheight\paperheight
\headheight0pt\headsep0pt\topmargin2.5cm
\advance\textheight-2\topmargin
\begin{document}
\title{Fast and dirty solution \texttt{gplPts.sty} usage instructions}
\author{Tobias N"ahring} \maketitle

\section{Rough description}
Some of \texttt{gnuplot}'s line styles and symbols for representing
points are defined as small postscript procedures in the eps output
file. The files around \texttt{gplPts.sty} demonstrate one fast and
dirty way to make those line styles and symbols available under \LaTeX.

\emergencystretch1cm
The postscript procedures are stored in the postscript header file
\texttt{gnuplot.pro} (You can produce this header file with the help
of \texttt{gpl-header.gp} and \texttt{eps2pro.tex}). The dvips-driver
will copy the contents of \texttt{gnuplot.pro} into the final postscript
output of your \LaTeX{} document.

The style file \texttt{gplPts.sty} provides the macros \verb=\gplPt=
and \verb=\gplLine=.  This is a latex interface to the postscript
procedures in \texttt{gnuplot.pro}. With the help of \verb=\gplPt= and
\verb=\gplLine= you can set gnuplot-point symbols and lines, resp.,
anywhere in your \LaTeX{} document.

Note, that the files belonging to \texttt{gplPts.sty} are just a fast
hack (e.\,g. no font size adaptions are done).  Because of
luck of time I cannot promise that I will do any improvement or any
bug fixing for these files in future. But maybe, you are lucky if you
ask myself.

\section{Installation}
Get the files \texttt{gnuplot.pro} and \texttt{gplPts.sty} from\\
\href{http://www.tn-home.de/Tobias/Soft/TeX/}{http://www.tn-home.de/Tobias/Soft/TeX/}.\\
Put these files at some apropriate place, e.\,g. into the directory
where you will use them or into some subdirectory of your local
\texttt{texmf}-path where \texttt{dvips} and \texttt{latex} can find
them (don't forget to run \texttt{mktexlsr} if necessary).

Then, for a test, get \texttt{gplPts-doc.tex} and run \LaTeX{} and
\texttt{dvips} on it. If you get the desired symbols in the resulting
postscript file, you are happy.

May be, you have another version of \texttt{gnuplot} and you have to
create your own postscript header file \texttt{gnuplot.pro}.

For that purpose, produce any eps-plot via \texttt{gnuplot} (for that
job you can use the gnuplot input file \texttt{gpl-header.gp})
cut out the first part of that eps file up to the string
\verb=%%EndProlog= and put this stuff into \texttt{gnuplot.pro} (to do
that job you can use the \TeX-file \texttt{eps2pro.tex}).

\section{Usage}
To use \texttt{gplPts.sty} just load the package via
\begin{verbatim}
\usepackage{gplPts}
\end{verbatim}
and set the gnuplot symbols you want by the macro
\catcode`\°\active
\def°#1°{\textsl{#1}}
\begin{verbatim}
\gplPt{°SymbolName°}
\end{verbatim}
where \texttt{\textsl{SymbolName}} is one of the gnuplot point symbol names
listed in the next section.

For gnuplot lines use the command
\begin{verbatim}
\gplLine[°LineLength°][°BoxHeight°]{°LineType°}
\end{verbatim}
where the optional \texttt{°LineLength°} is the length of the line
(what else?), the optional \texttt{°BoxHeight°} is the height of the
bounding box with the line in the middle of it and the obligatory
\texttt{°LineType°} is one of the line types defined in the next
section.

Note, that the symbols and lines from the postscript header are rather
big. So scaling by a factor \verb=\gplScale= is required. This factor
is set to~0{.}1 by default but may be redefined.  The
parameters~\texttt{°LineLength°} and~\texttt{°BoxHeight°} are scaled
down by~\verb=\gplScale=. In the print-out you get the
\verb=\gplScale=-th of what you input as those parameters.

Also note, that the line types are taken from the postscript header.
Surprisingly, the line types 0,\ldots,8 correspond to the line styles
1,\ldots,9 in gnuplot.

\section{Names of the point symbols and line types}
The numberated \texttt{gnuplot} points:

\makeatletter
\@for\ptType:={D,S,C}\do{
  \multido{\i=0+1}{16}{
    \ptType\,\i:~\gplPt{\ptType\i}
  }\\
}
\makeatother

The named \texttt{gnuplot} points and lines are given in
tables~\ref{tab:points} and~\ref{tab:lines}, respectively.
\begin{table}[hbt]
\centering
\def\TE#1{\gplPt{#1}& #1}
%\begin{minipage}{0.45\linewidth}
\begin{tabular}{c|l|l}
Symbol& Name & Meaning\\\hline
\TE{Pnt} & Point (almost invisible)\\
\TE{Dia} & Diamant\\
\TE{Pls} & Plus\\
\TE{Box} & Box\\
\TE{Crs} & Cross\\
\TE{Star} & Star\\
\TE{BoxF} & Box filled\\
\TE{TriUF} & Triangle up filled\\
\TE{TriD} & Triangle down\\
\TE{TriDF} & Trianle down filled\\
\TE{DiaF} & Diamond filled\\
\TE{Pent} & Pentagon\\
\TE{PentF} & Pentagon filled\\
\TE{Circle} & Circle\\
\TE{CircleF} & Circle filled\\
\TE{DiaE} & Diamant empty\\
\TE{BoxE} & Box empty\\
\TE{TriUE} & Triangle up empty\\
\TE{TriDE} & Triangle down empty\\
\TE{DiaW} & Opaque version of Dia\\
\TE{BoxW} & Opaque version of Box\\
\end{tabular}
\caption{Names of \texttt{gnuplot}-points}
\label{tab:points}
\end{table}
%\end{minipage}
%\begin{minipage}{0.45\linewidth}
\def\do#1{#1&\gplLine{#1}\\}
\begin{table}[hbt]
  \centering
  \begin{tabular}{c|c}
    Line Type& Meaning\\\hline
    \do w\do b\do a\do 0\do 1\do 2\do 3\do 4\do 5\do 6\do 7\do 8
  \end{tabular}  
  \caption{Names of \texttt{gnuplot} line types}
  \label{tab:lines}
\end{table}
%\end{minipage}
\paragraph{Usage examples:}
\begin{minipage}[t]{0.49\linewidth}
\underline{\LaTeX-code:}
\begin{verbatim}
That's symbol D1: \gplPt{D1}\\
That's symbol S2: \gplPt{S2}\\
That's symbol TriDF: \gplPt{TriDF}\\
That's line type a: \gplLine{a}\\
{\def\gplScale{0.5}\gplLine[10][0.5ex]{a}}\\
That's line type a: \gplLine[20]{a}\\
That's line type a: \gplLine[20][20ex]{a}\\
That's line type 3: \gplLine{3}
\end{verbatim}
\end{minipage}
\begin{minipage}[t]{0.49\linewidth}
\underline{Result:}\\[2ex]
That's symbol D1: \gplPt{D1}\\
That's symbol S2: \gplPt{S2}\\
That's symbol TriDF: \gplPt{TriDF}\\
That's line type a: \gplLine{a}\\
{\def\gplScale{0.5}\gplLine[10][0.5ex]{a}}\\
That's line type a: \gplLine[20]{a}\\
That's line type a: \gplLine[20][20ex]{a}\\
That's line type 3: \gplLine{3}
\end{minipage}
\end{document}

