This file is README.latex in ~ftp/pub/samples_tgif/latex.tar.Z on
bourbon.cs.ucla.edu.  It describes a simple way of how to use LaTeX equations
in tgif.  Even though the procedure looks very long, steps 0 through 14 are
for setting the environment up and need to be done only once.  After the
setup is done, one can type in an equation as an attribute of an object.
Then with one mouse click, the equation object will run 'latex', 'dvips',
'pstoepsi', and import the EPS file into itself.

0)  First edit you resource file to add the following two lines:

Tgif*DefaultEPSScaling:		1.778
Tgif*ShortCuts:			!<Key>T:ToggleNamedAttrShown(eq=)

    If you are running, you'll need to run xrdb to update your resource cache.

1)  ``Instantiate'' "eq.sym" by typing <Cntrl>i and select "eq.sym".
2)  ``Push'' into "eq" object by selecting it and type <Cntrl>v.
3)  Select the SYMBOL object (the one with the dashed boundary).
4)  ``UnMakeSymbolic'' the selected object by typing <Cntrl><Meta>n.  The
    dashed boundary should go away.
5)  ``ShowAttr'' the selected object by typing <Meta>-.
6)  Go into text mode by typing <Cntrl>w.
7)  Replace the whole right hand side of "template_name=" to be the file
    "simple.tex" (specifying absolute path is preferred).
8)  Edit the right hand side of "cmd=" and replace the string
    "/u/tangram/bin/pstoepsi $(file_name).ps $(file_name).eps" with
    your program for generating the BoundingBox and PreviewBitmap.
    Pstoepsi can be obtained throught anonymous ftp from:

	export.lcs.mit.edu	/R5contrib/pstoepsi.tar.Z
	ftp.cs.ucla.edu		/pub/tgif/pstoepsi.tar.Z

    It requires that you have ghostscript.
9)  Select the object that correspond to the one with all the attributes.
10) ``HideAttr'' the selected obbject by typing <Cntrl><Meta>h.
11) Now you still need to see the equation attribute.  This is a little
    more involved.  ``Move/JustfyAttr'' the selected object by typing
    <Meta>m.  You should see a 'corner' cursor.  Now drag the left mouse
    button (don't let go of it yet, a menu will show up), drag the mouse
    on the "eq=" string and then let go the mouse button.  The mouse
    will be warped to the place where the "eq=" attribute was.  Click the
    left mouse button and the "eq=" attribute will show up.
12) ``MakeSymbolic"" the selected object by typing <Cntrl><Meta>m.  You
    should see the dashed boundary again.
13) ``Save'' the "eq.sym" file by typing <Cntrl>s.
14) ``Pop'' back to the parent by typing <Cntrl>k.

15) Get a clean file by typing <Cntrl>n (say "NO" to the "Save" question).
16) ``Instantiate'' "eq.sym" by typing <Cntrl>i and select "eq.sym".
17) Go into text mode (<Cntrl>w) and modify the right hand side of
    "eq=" to "\LARGE \[ E\,=\,M\,C^2 \].  Get out of text mode by typing
    <Cntrl>e.
18) <Shift>Btn2 click the "eq=" text (click the middle mouse button on
    top of "eq=" text with the <Shift> key held down).  It should run
    the scripts you've seen when you were inside "eq.sym":

    exec=
	mktemp(...);
	create_file_using_template(...);
	launch("cmd");
	update_eps_child(...);
	launch("cleanup");

    cmd=
	cd /tmp;
	xterm -geom 40x8+200+400 -e latex $(file_name);
	xterm -geom 40x8+200+400 -e dvips -N -n 1 -o $(file_name);
	xterm -geom 40x8+200+400 -e pstoepsi $(file_name).ps $(file_name).eps

    When it is finished, you should see a bitmap representation of the
    LaTeX equation.  What you have is a special ICON object in which one
    of the sub-object is an EPS object with a preview bitmap.
    Since you've done step 0 above, you should be able to type <Shift>t and
    the "eq=" should disappear.  Type <Shift>t again and it should reappear.

19) Repeat steps 16 through 18 to produce more LaTex strings.  What you see
    should be very close to what you'll get.  No more guessing.
