\documentstyle[epic,eepic]{article}
%\input verbatim
%\font\big=cmbx12
%\def\title#1{\bigskip\centerline{\big #1}\bigskip}
\begin{document}

\special{psfile=HU.ps}

\rule{0in}{2in}
   \begin{center}
{\Large Graphic Facilities Available in \TeX~ and in \LaTeX~\\
   \vspace{2ex}
   \large
   in shum and noga (unix machines)\\}
   \vspace{2ex}
   \today

   \vfill
   {More information at rama@shum}

   \end{center}
\newpage
\tableofcontents
\newpage
\section{What does plain \LaTeX~ provide graphic-wise?}

LaTeX has a picture environment. This environment can be
used to draw pictures composed of text,
straight lines, arrows, and circles.
It is described in the \LaTeX~ user's guide, section 5.5
and in Appendix C.13

Advantage: \LaTeX~ graphics are made rapidly and take up
a small space in memory.

Limitations: limited possibilities; only a limited
number of possible slopes for lines and vectors,
limited possibilities for drawing circles, only
two line thicknesses.

Here is an example of a plot done via \LaTeX~' picture
environment.
The input file is:

\begin{verbatim}
\documentstyle{article}
\begin{document}
\begin{figure}
%
\begin{picture}(500, 200)(-95,0)
%
\multiput(0, 0)(0, 20){11}{\line(20,0){200}}
\multiput(0, 0)(20, 0){11}{\line(0,20){200}}
\put(90,90){\circle*{15}}
\put(90,130){\circle{15}}
\put (87,126){1}
\put(70,110){\circle{15}}
\put (67,106){2}
\put(170,30){\circle{15}}
\put (167,26){3}
\put(30,50){\circle{15}}
\put (27,46){4}
\end{picture}
\caption{A LateX example - courtesy Ran Levy.}
%
\end{figure}
%
\end{document}
\end{verbatim}

\bigskip               
The output is in figure \ref{figure:ran} on next page.
\begin{figure}
%
\begin{picture}(500, 200)(-95,0)
%
\multiput(0, 0)(0, 20){11}{\line(20,0){200}}
\multiput(0, 0)(20, 0){11}{\line(0,20){200}}
\put(90,90){\circle*{15}}
\put(90,130){\circle{15}}
\put (87,126){1}
\put(70,110){\circle{15}}
\put (67,106){2}
\put(170,30){\circle{15}}
\put (167,26){3}
\put(30,50){\circle{15}}
\put (27,46){4}
\end{picture}

\caption{A LateX example - courtesy Ran Levy.}
%
\label{figure:ran}
\end{figure}


\section{What does plain \TeX~ provide graphic-wise?}

The macros available in \LaTeX~'s picture environment can
also be used in \TeX. 
To use them, you have to include in the \TeX~document 
the following two lines:

\begin{verbatim}
\input pictex
\input latexpicobjs
\end{verbatim}

The file pictex includes also all macros which pertain to PICTEX,
described below.
\bigskip
Here is an example of a tex file using this facility:

\begin{verbatim}
\input pictex
\input latexpicobjs 
This is just a line.
\setbox0=\hbox{ \raise 4pt \hbox{\circle{15} }} % This is the circle.
						% 15 is the diameter.
\copy0       % Writing the circle ...
\kern-21pt   % Moving backward ...
2            % Writing the number inside.
More text. 
\copy0       % Writing the circle ...
\kern-21pt   % Moving backward ...
2            % Writing the number inside.
\kern 4pt    % Moving forward a bit ....
And more text.
\end
\end{verbatim}
\newpage
Here is the output created:
\bigskip

This is just a line.
\setbox0=\hbox{ \raise 4pt \hbox{\circle{15} }} % This is the circle.
						% 15 is the diameter.
\copy0    % Writing the circle ...
\kern-6pt% Moving backward ...
2         % Writing the number inside.


More text. 
\copy0    % Writing the circle ...
\kern-6pt% Moving backward ...
2         % Writing the number inside.
\kern 4pt % Moving forward a bit ....
And more text.


\bigskip


\section{PICTEX}

PICTEX is a collection of \TeX~ macros which makes it possible for
the \TeX~ user to use \TeX~ commands in order to typeset pictures
within the \TeX~ or \LaTeX~ document.

It's advantages:
PiCTeX~ makes it possible for the user to draw
nice pictures, especially mathematical figures.
The pictures become an integral part of the document. All \TeX~
and \LaTeX~ capabilities are available for annotating the
figures,as well as the fonts used in the original document.
PICTEX' portability is achieved by using \TeX~ arithmetic
to do all plotting calculations, and by drawing the figure
using the period character as a 'brush'.
PiCTeX~ macros are, thus, machine independent.

The PiCTeX documentation is available from the TeX Users Group for \$30.
 
You can get it from:
 \begin{verbatim} 
  P.O. Box 9506
  Providence, RI 02940
  Phone: 401-751-7760
  E-mail: TUG@math.ams.com
\end{verbatim}

It's limitations:
PICTEX is slow and requires a large internal \TeX~ memory.
The scope of graphics is limited. No 'free' sketches are
possible. There are no 3D pictures. making curves takes 
some minutes and a lot of computer memory.

\subsection{How to use PiCTeX~ with \TeX~?}


Include in your input file to \TeX~ the line

\begin{verbatim}
\input pictex
\end{verbatim}

If you also want to use (in your \TeX~ file) the \LaTeX~ graphic
macros, include in your \TeX~ file the following line also:

\begin{verbatim}
\input latexpicobjs
\end{verbatim}

Then you can use all the commands described in the PiCTeX~ manual.

\subsection{How to use PiCTeX~ with \LaTeX~?}

Include in your \LaTeX~ document the lines

\begin{verbatim}
\input prepictex
\input pictex
\input postpictex
\end{verbatim}

The order of the lines is important.
Then you can use all the commands described in the PiCTeX~ manual.

More information about PiCTeX and its relation to \TeX{ }and
to \LaTeX~ is contained in the PiCTeX manual.

\section{GNUPLOT}

GNUPLOT is a graphic program. It has many keywords; its syntax is
described in the GNUPLOT manual, obtainable by typing

latex gnuplot\_manual

The program plots any number of functions, built up of C operators, 
C library
functions, and some things C doesn't have like **, sgn(), etc.  It also
supports  plotting data files, to compare actual
data to theoretical curves.

When used interactively, it has a good "help" facility.

\subsection{How to use GNUPLOT with \LaTeX~?}

\label{gnu}
GNUPLOT 2.0 includes a \LaTeX~ driver which outputs GNUPLOT commands
in a file having \LaTeX~ format. This file can later be included
in a \LaTeX~ document in a figure environment.

For example, you create a file called gnu.input, containing the lines

\begin{verbatim}
set terminal latex
set output 'example.tex`
set samples 50
set title "The Title"
plot [-10:10] sin(x),atan(x),cos(atan(x))
set xlabel "x label"
set ylabel "y label"
\end{verbatim}

You process this file by typing~~~  gnuplot gnu.input  
and get the output file example.tex  .

You use this file in the \LaTeX~ documnt by specifying

\begin{verbatim}
\begin{figure}
\begin{center}
\input example
\end{center}
\end{figure}
\end{verbatim}

\begin{figure}
\begin{center}
\input gnu_example
\end{center}
\caption{A GNUPLOT example.}
\end{figure}

The result in shown in figure 2.

As mentioned, there is a GNUPLOT manual. The manual
describes the package, and is obtainable by typing

latex gnuplot\_manual

Another guide is provided which explains usage of GNUPLOT
by \LaTeX~ users, and it can be obtained by running

latex gnuplot\_guide

GNUPLOT graphics within \LaTeX~ might need an enlarged version of \TeX~.
The ordinary version may suffice if the plots are not very
complicated.



\subsection{How to use GNUPLOT with \TeX~?}

\TeX~ can also utilize the GNUPLOT package
(using the files pictex and  latexpicobjs mentioned before).
In this case you can include the plot within the \TeX~
document via the keywords 

\begin{verbatim}
\topinsert .....\endinsert
\midinsert .....\endinsert
\pageinsert ....\endinsert
\end{verbatim}
			  
See page 116 in the TeX~book.

\section{PLOT10 {$\rightarrow$} GNUPLOT}


PLOT10 is a graphic package written in Fortran.
It contains nine subroutines which are quite easy to use
for Fortran programmers.

Those are:
\begin{verbatim}
                Axis     -  Plot axis
                Factor   -  Scale size
                Line     -  Draw a vector of points
                Logax    -  Plot log axis
                Namplt   -  Initiate plot
                Number   -  Draw numbers
                Plot     -  Move pen
                Scale    -  Scale a vector
                Symbol   -  Draw text and symbols
\end{verbatim}

A manual is available by typing

tex plot10\_manual

A new library, plot10\_s.a has been created which includes
the PLOT10 subroutines, changed so that instead of creating
a plot, it creates an input file for GNUPLOT; this file,
when processed by GNUPLOT creates a latex file which
can be included in a \LaTeX~ document, as described 
earlier. Good results are obtained by suppressing the
automatic scaling done by GNUPLOT; see example below. 

\subsection{How to use PLOT10 with \LaTeX~?}

Let's say you have the following Fortran program,
containing calls to Plot10 routines, In a file called twoplot.f

\begin{verbatim}
	program twoplot
	call namplt
	call plot(0.0,0.0,3)
	call plot(5.0,5.0,2)
	call plot(7.0,3.0,2)
	call axis(0.0,0.0,1hx,-1,8.0,0.0,0.0,1.0,0)
	call newpag
	call symbol(2.0,2.0,0.20,4hkuku,0.0,4)
	call plot(0.0,0.0,555)
	end
\end{verbatim}

You type

f77 twoplot.f plot10\_s.a

\noindent and then

a.out

As a result, the following files are created:
\begin{itemize}
\item
A file called gnu.input, containing instructions for GNUPLOT.
Here's the file's content:

\begin{verbatim}
set term latex
set nokey
set output "gnu.tex"
set samples 100000
plot "gnu.data.11" with lines
plot "gnu.data.12" with lines 
\end{verbatim}

The file name "gnu.input" is written within plot10 routines.

\item
Two data files will be created (because the program twoplot.f
creates two plots, one initiated by "call namplt" and the other
by "call newpag") called gnu.data.11 and gnu.data.12
\end{itemize}

You use GNUPLOT by typing

gnuplot gnu.input

and get the \LaTeX~ file gnu.tex, which is to be included in a
\LaTeX~ document, as described earlier in section \ref{gnu}.
            
\vskip .5cm             
Here's an example of a latex file which will plot twoplot.

\begin{verbatim}
\documentstyle{article}
\begin{document}
\begin{figure}
\begin{center}
\input gnu.tex
\end{center}
\end{figure}
\end{document}

\end{verbatim}

The output appears in figure \ref{figure:Uri Feldman}. 
\vfill\eject
{\Large Note!}

In order to get better results using PLOT10 + GNUPLOT,
it is advisable to scale the resulting GNUPLOT plots.

The current example has been scaled by using a pre-defined file
called .gnuplot, which resides in the user's home
directory, and which contains the following GNUPLOT commands:

\begin{verbatim}

set noautoscale
set size .968,.968
set xrange [-1:7]
set yrange [-1:5]
\end{verbatim}

\begin{figure}
\begin{center}
\input gnutex_example    
\end{center}
\caption{A PLOT10$\rightarrow$GNUPLOT$\rightarrow$\LaTeX~ example : Courtesy Uri Feldman}
\label{figure:Uri Feldman}
\end{figure}

\section{EPIC} 

EPIC is a \LaTeX~'s
document style option.
It improves the drawing capabilities of \LaTeX~, by
providing simpler and more powerful macros.
Those macros reduce the amount of manual calculation
required to specify the layout of objects.
It introduces new commands for drawing
more line types and  new environments suitable
for drawing graphs.

Usage:
\begin{verbatim}
\documentstyle[epic]{......}
\end{verbatim}

EPIC contains various macros, which are fully explained
in a guide available to \LaTeX~ users via the command

latex epic\_guide

The guide explains all the available  new commands and contains
elaborate examples. 

\section{EEPIC}

EEPIC is, like EPIC, a \LaTeX~
document style option.
It extends \LaTeX~ and EPIC capabilities. It
draws lines in any slope, draws circles and filled circles
in any radii, draws dotted and dash lines much faster
and with less memory, and more. It draws elipses,
arcs, splines and more.

Usage:
\begin{verbatim}
\documentstyle[epic,eepic]{......}
\end{verbatim}

A guide is available to \LaTeX~ users, via

latex eepic\_guide

The guide explains EEPIC's extensions to both \LaTeX~
and to EPIC.
It uses the same examples which appear in the epic\_guide
and tries to convince you that EEPIC gives better results.
You can see two examples copied from the eepic\_guide in
figure \ref{figure:eepic1} and in figure \ref{figure:eepic2}.

\begin{figure}[htbp]
\hrule
\begin{center}
\input{eepic-eg3}
\end{center}
\caption{Example 3 from EEPIC\_guide.}
\medskip
\hrule
\label{figure:eepic1}
\end{figure}
\begin{figure}[htbp]
\hrule
\begin{center}
\input{eepic-eg4}
\end{center}
\caption{Example 4 from EEPIC\_guide.}
\medskip
\hrule
\label{figure:eepic2}
\end{figure}

\section{POSTSCRIPT}

PostScript, sometimes referred to as PS, is a powerful
graphic language which is gaining acceptance as a standard.
In an environment where DVI files are transtaled into
PS before being printed, it is possible
to insert a seperately prepared PostScript
file into a \TeX~ or a \LaTeX~ document, using the \TeX~
$\backslash$special command. The resulting output can only be previewed
using a PS previewer, (like 'ghost` in UNIX)
and has to be printed on a PS printer, such as the Apple
LaserWriter.
In shum, as well as in DOS PC, users of dvips (a program
which translated a .DVI file into a .PS file)
can include a previously prepared PS file
in their \TeX~ or \LaTeX~ document by specifying
(within the document)

\begin{verbatim}
\special{psfile=filename.ps}
\end{verbatim}

This will download the file so that the current point
will be the origin of the Postcript coordinate system.
It is also possible to specify transformations on the
PostScript, using the syntax

\begin{verbatim}
\special{psfile=filename.ps [key=value ......]}
\end{verbatim}

Possible keys are hoffset, hsize, hscale, angle, voffset etc.
You can also use the $\backslash$special command 
like in

\begin{verbatim}
\special{ps:ps_command}
\end{verbatim}


in order to include
PostScript commands  in the document.

Possible uses of the $\backslash$special command with dvips is explained
in the dvips guide, obtainable by running in shum

tex dvips\_guide


\subsection{$\backslash$special}

$\backslash$special is a \TeX~ command which is not processed by \TeX~
but remains as it is in the .dvi file. The $\backslash$special command
is processed by dvips, and is meant to include
PostScript commands and/or a PostScript file in the output.
See the usage of $\backslash$special in the section about FIG.

The $\backslash$special command can be used for
plotting the Hebrew University header on documents.
You type
 
\begin{verbatim}
\special{psfile=HU.ps}
\end{verbatim}

See the header on top of the title page of this guide.

\section{FIG, XFIG}

Those are interactive graphic editors, in the style of
Macintosh' MacDraw. Fig runs under Suntools/SunView,
and Xfig can also work under X11 windowing systems.
Xfig is a version of Fig which goes with the X Windowing
System. These graphic editors produce files which can be
translated to a variety of graphic languages,
including PostScript and picTeX~, and then included in
a \TeX~ or \LaTeX~ document. 
shum has xfig for those users who can use the X windowing system.

xfig is a menu driven interactive utility. Using the 'mouse',
you choose some of many optional drawing types and styles,
including font selection. You can save the figure, and a file
having the extension .fig is created.

\subsection{f2ps}

f2ps is a utility which inputs a .fig file and creats a .ps
file, that is, a PostScript file which can be included in
a \TeX~ or \LaTeX~ document.

\subsection{Including an XFIG plot in \TeX~}

Here is an example of using xfig with f2ps.

Having an X terminal, you type

xfig

and you draw a picture, then you save it within xfig. Let's say 
called girl.fig
has been created.

Then the command f2ps is utilized, thus:

f2ps girl.fig $>$ girl.ps

The file girl.ps is to be included in a \TeX~ text.
Here is how it can be done:

\begin{verbatim}
%  We insert the figure after moving(=translating) scaling and rotating it.
%
\special{ps:gsave}                    % Saving the current environment.
\special{ps: 0 500  translate -90 rotate 2 -2 scale}
\special{ps: plotfile girl.ps}        % Here we call the figure file.
\special{ps:grestore }                % Restoring the previous environment.
\end
\end{verbatim}

Here's the girl:
\special{psfile=girl.ps}

 
\break
The PostScript commands translate, rotate and/or scale appear
in the .ps file to be included. They can be customized
in the .ps file (this might be easier - of course you have
to know SOME PostScript to do it right), and then you can include
the customized file in you text by

\begin{verbatim}
\special{psfile=girl.ps}
\end{verbatim}


\section{XDVI, GHOST}

Those are utilities which can be used by a user who has access
to the X windows system.
XDVI is a screen previewer for the X window system.
It takes a dvi file and displays its content on screen.

See ~~~~~~~
man xdvi

\noindent ghost is a utility which displays a PostScript on screen.
\vskip 1cm
Usage is \hskip 1cm  
xdvi filename~~~~~~~ where 'filename' has the .dvi extension.


~~~~~~~~~~~~~~~~~~~~ghost filename.ps
\end{document}
