Tgif Home
----
About Tgif
Current Release & Download
FAQ
Copyright Info
A Screendump of Tgif
Release History
Tools That Tgif Uses
Tools That Work with Tgif
Author of Tgif
Miscellaneous Info
----
 
Return to Tgif's Home Page
William Chia-Wei Cheng
(bill.cheng@usc.edu)
 

Tgif FAQ - Customizing eq4.sym

 
I cannot get eq4.sym to work in my environment. Is there an easy way to customize it?
Let's give the following a try. First, copy eq4.sym into myeq4.sym. Open myeq4.sym with:
    tgif myeq4.sym
Here are the steps to customize it in tgif:

  1. Right-click on the equation object, click on Edit Attribute In Editor, and then click on "header=". What you see is what will go into a file before your equation. Change it to what you need. When you save the file and exit the editor, the header attribute will be updates.

  2. Right-click on the equation object, click on Edit Attribute In Editor, and then click on "footer=". What you see is what will go into a file after your equation. Change it to what you need. When you save the file and exit the editor, the footer attribute will be updates.

  3. Right-click on the equation object, click on Edit Attribute In Editor, and then click on "cmd=". What you see is the command that tgif will run to convert a generated LaTeX file to an EPS file with a preview bitmap. The string $(file_name) is the basename of a file that will be created in /tmp. The xterm is there so you can see the commands running. Change it to what you need. When you save the file and exit the editor, the footer attribute will be updates.

  4. Right-click on the equation object, click on Edit Attribute In Editor, and then click on "exec=". What you see are a set of tgif internal commands which tgif will execute when you double-click on the equation object. By default, the commands are:
        mktemp("/tmp/TgifXXXXXX","file_name");
        write_attr_into_file(header,"$(file_name).tex");
        append_attr_into_file(eq,"$(file_name).tex");
        append_attr_into_file(footer,"$(file_name).tex");
        launch("cmd");
        update_eps_child("$(file_name).eps");
        launch("cleanup")
    The first line creates the basename of a file in /tmp and put the actual file name in the "file_name" attribute of the equation object. To use the value of this attribute, the syntax of $(file_name) must be used.

    The next 3 lines writes the header, the equation, and the footer into a temporary file "$(file_name).tex".

    The next line run the commands that correspond to the "cmd=" attribute (see above).

    The next line imports the generate EPS file into tgif. If the commands you will run will produce a file other than "$(file_name).eps", you should change it here.

    Once the EPS file is imported, all the files that were used in /tmp can be deleted. This is done with the last line above.

    Change it to what you need. When you save the file and exit the editor, the footer attribute will be updates.

  5. Select Save from the File Menu. Launch another tgif in the same directory. Select Instantiate from the Special Menu and select myeq4.sym. Double-click on it to run the commands. If it doesn't work, you would get a messagebox that says something like:
        update_eps_child(): Fail to import '/tmp/Tgif...'
    Do not close this window. Go to /tmp and copy the Tgif*.tex file to, for example, /tmp/foo.tex. Run your commands manually in /tmp and see why they failed. Then repeat the above steps if necessary.
 
I don't want to use vi to edit equations. Can I use emacs?
By default, tgif uses vi to edit equations (or any other attribute when you click on and attribute in the Edit Attribute In Editor submenu of a context menu). If you want to use emacs instead, you can first get out of vi by typing ":q". Then add the following X default:
    Tgif.Editor: emacs -title '%s' '%s'
If you are using xrdb, make sure you refresh your X resource database by doing something like:
    xrdb ~/.Xdefaults
For the new values to take effect, you must restart tgif.