[Tugindia] Drawings/Diagrams ??

M K Saravanan mksarav at comp.nus.edu.sg
Sat Feb 1 16:49:14 CET 2003


On Fri, 31 Jan 2003, Kevin wrote:

> Can someone explain the package that can be used to
> draw diagrams like the types used in books. I am

Forgot to mention one important tool:  "gpic"  which was used by Richard 
Stevens to draw diagrams in all his books.  gpic is more like a 
programming lang..  You can directly include gpic commands in LaTeX 
documents and run gpic preprocessor to convert the gpic commands into 
corresponding TeX equivalents and run the normal LaTeX commands. For e.g. 
I draw all the diagrams in my GNU/Linux networking tutorial 
(http://www.comp.nus.edu.sg/~mksarav/tutorial/gnu-linux-nw-tutorial-0.2.ps) 
using "gpic".

To include "gpic" commands in LaTeX document use .PS at the beginning of 
gpic commands in a separate line and end with .PE

Here is an e.g.:

.PS
A: circle invis "Chinese"; 
B: circle invis at A - (0,1) "Chinese$\to$English" "(Translator)";
D: circle invis at A + (2,0) "Russian";
C: circle invis at D - (0,1) "English$\to$Russian" "(Translator)";
arrow from A to B chop <-->;
arrow from B.e+(1,0) to C.w-(1,0) <-->;
arrow from C to D chop <-->;
.PE


Say if you are including in a doc called "test.tex" then you can run 
something like this:

gpic -t test.tex > temp.tex
pslatex temp.tex


you can find some good links about gpic at Richard Stevens homepage 
http://www.kohala.com/start/troff/troff.html  (under "pic" section).

"pic" was originally written by Brian W Kernighan.  The GNU version of 
pic -- "gpic" is written and maintained by James Clark.

If you are interested you can read the original technical report of the
pic written by Kernighan (http://cm.bell-labs.com/cm/cs/cstr/116.ps.gz)

-- mks --





More information about the Tugindia mailing list