|
|
Tgif FAQ - Problems Installing the LaTeX Equation Package
|
|
I would like to use Latex
equations in Tgif figures. Could you tell me the procedure to do
this (step by step if it is possible)?
|
-
Since tgif-4.1.16, the
standard distribution of tgif comes with 4 LaTeX equation symbol
files:
eq4.sym
eq4-2x.sym
eq4-ps2epsi.sym
eq4-epstool.sym
In order to use eq4.sym, in addtion to latex and
dvips, you need:
- pstoepsi - to convert a
PS (postscript) file generated by dvips to an
EPSI (encapsulated postscript file with a preview bitmap) file
- netpbm - used by
pstoepsi to convert a PBM file to a preview
bitmap for the final EPSI file
- ghostscript - used by
pstoepsi to render a PS file into a PBM file
Once you have these tools properly installed, you can simply instantiate
eq4.sym and change the value of the eq= attribute.
If you have a large equation, you can even right-click on the equation
object, select Edit Attribute in Editor, and select eq= and edit
the equation in an editor of your choice (you can use the
Tgif.Editor X default to select your editor).
Just double-click the equation object and tgif will run the following
commands:
latex <tmpfile>
dvips -N -n 1 -o <tmpfile>.ps <tmpfile>
pstoepsi <tmpfile>.ps <tmpfile>.eps
where <tmpfile> is a temporary file generated by tgif (usually in
/tmp and the file name starts with Tgif).
This should work if everything is installed properly. In case it does
not work, you will get an error messagebox. Do not close the box.
Change directory into /tmp and look for the latest files
that start with Tgif and end in .tex and copy it.
Then run the above commands manually to debug the problem.
For example, you can do:
cd /tmp
ls -lrt Tgif*
-rw-r--r-- 1 william 230 Mar 22 11:27 TgifmTaOdC.tex
-rw-r--r-- 1 william 4636 Mar 22 11:27 TgifmTaOdC.log
-rw-r--r-- 1 william 324 Mar 22 11:27 TgifmTaOdC.dvi
-rw-r--r-- 1 william 8 Mar 22 11:27 TgifmTaOdC.aux
-rw-r--r-- 1 william 18561 Mar 22 11:27 TgifmTaOdC.ps
-rw-r--r-- 1 william 18561 Mar 22 11:27 TgifmTaOdC.eps
(Please note that in the above listing, TgifmTaOdC.ps and TgifmTaOdC.eps
have the same file size, this means that pstoepsi did not
work.)
cp TgifmTaOdC.tex foo.tex
latex foo
dvips -N -n 1 -o foo.ps foo
pstoepsi foo.ps foo.eps
more foo.eps
At this point, you should see that the first few lines of
foo.eps look like:
%!PS-Adobe-2.0 EPSF-1.2
%%BoundingBox: 258 634 354 653
%%BeginPreview: 97 20 1 20
% 00000000000000000000000e00
% ...
% 00000000000000000003c00000
%%EndImage
%%EndPreview
...
These lines are added by pstoepsi.
The numbers in the %%BoundingBox: and %%BeginPreview:
depends on your equation and the PS-Adobe and EPSF
versions in the first line may vary depending on your setup.
If you get errors when you run latex, dvips, or
pstoepsi manually, these's someothing wrong with the
setup of these tools. If the all do the right thing but tgif still
show errors, please send e-mail to me!
eq4-2x.sym can produce a higher (2x) resolution preview
bitmap, but you will need the special netpbm-20may1999 version of
netpbm. It may not work with
a newer version of netpbm.
eq4-ps2epsi.sym is not recommanded if you are running
a version of tgif before 4.1.43.
If you are running version 4.1.43
or later, and your primary use is to generate PS/EPS/PDF file, then
eq4-ps2epsi.sym should be the preferred.
eq4-epstool.sym is like eq4.sym but uses
epstool instead.
|
The eq4-epstool.sym that came with the tgif distribution
doesn't seem to work on Mac OS X. Do you have an updated version of it?
|
-
Please download this eq4-epstool.sym
and see if it works better.
|
In the above answer, what
do you mean by instantiate eq4.sym and change the
value of the eq= attribute? How can I create
an equation object?
|
-
If you put eq4.sym in /home/yourself/lib/tgif/latex, you can add the
following lines to your ~/.Xdefaults file:
Tgif.MaxDomains: 1
Tgif.DomainPath0: LaTeX:.:/home/yourself/lib/tgif/latex
Tgif.DefaultDomain: 0
The above says that you have 1 domain. Domain number 0 is called
LaTeX, and tgif should look for *.sym files in the current directory
and then the /home/yourself/lib/tgif/latex directory. When tgif starts,
the default domain should be domain number 0.
When you run tgif, you can select Instantiate from the Special
Menu (or press <Cntrl>i), you should see eq4.sym.
Double-click it
and tgif will ask you to click on the drawing area to place it.
After you have placed it, you have instantiated an eq4 symbol and
the instantiation is called an eq4 object (or the LaTeX equation
object). Now you can go into edit text mode (or press <Cntrl>w)
and click anywhere inside the eq= attribute to edit the equation.
|
I followed the
instructions in the LaTeX Equation Package on the Tgif Goodies Page and got all kinds of
error. What's wrong?
|
-
If you are running gs5.10 and if you get pstoepsi.tar.Z from
ftp.cs.ucla.edu or export.lcs.mit.edu as indicated in README.latex
in the LaTeX Equation Package, you may have problems.
This is because pstoepsi.tar.Z is the ``orignal'' pstoepsi. I don't
even know who wrote it originally. It only works with old versions of
ghostscript.
Q: The Makefile for pbmtoepsi has the line:
PBM_ROOT=/where_the_root_of_pbmplus_is
but I've no idea what pbmplus is or where to find it.
Netpbm used to be known as pbmplus.
Pbmplus doesn't come with pbmtoepsi.
At the time the original pstoepsi was released, netpbm did not exist, so
I guess the author gave the instruction mainly for pbmplus.
Netpbm-1mar1994 comes with
pbmtoepsi. Therefore, if you have netpbm-1mar1994 and the shell script
in the pstoepsi package, you don't need the rest of the files in the
pstoepsi package. There are minor problems with netpbm-1mar1994 (such as
missing symbolic links). So I made some minor changes and call it
netpbm-15nov1997. On tgif's tools page,
I have links to all of this.
Basically, if you have gs5.10, you need to get netpbm-15nov1997, pstoepsi
shell script, and make modifications to the shell script according to
tgif's home page.
Q: The pstoepsi shell script itself seems to want a bunch of strange
stuff. It wants some file called pstoppm.ps which I don't seem to have
from my gs5.10 installation, but have from an old gs3.33 installation,
so I set it to use that.
Gs5.10 doesn't have pstoppm.ps because it can generate ppm files all by
itself! The old pstoepsi only knows about pstoppm.ps, so it can't work
with gs5.10. If you get the pstoepsi shell script from tgif's home page,
it will work with the new gs and without pstoppm.ps! In this case, it
doesn't matter what you set PSTOPPM to.
Q: It wants to know the location of something called rasttopnm, which
I've never heard of and don't seem to have. It doesn't seem to be trying
to use this though.
It's not used in pstoepsi. In the original pstoepsi package, there's a
program called pstorast which uses rasttopnm. Therefore, it doesn't
matter what you set RASTTOPNM to.
Q: This is what happens when I run pstoepsi:
-
- {bluemoon:william}[1] pstoepsi Tgifa00377.ps Tgifa00377.epsi
- Usage: (file) ppmNrun
- converts file.ps to file.ppm (single page),
- or file.1ppm, file.2ppm, ... (multi page).
- N is # of bits per pixel (1, 8, or 24).
- Examples: (golfer) ppm1run ..or.. (escher) ppm8run
- Optional commands you can give first:
- horiz_DPI vert_DPI ppmsetdensity
- horiz_inches vert_inches ppmsetpagesize
- (dirname/) ppmsetprefix
- page_num ppmsetfirstpagenumber
- GS>Writing Tgifa00377.ppm
- Error: /undefined in writeppmfile
- Operand stack:
- --nostringval-- --nostringval--
- Execution stack:
- ...
The problem here is with "Error: /undefined in writeppmfile". Gs5.10
does not support "writeppmfile" any more. Since you are running the
original pstoepsi which doesn't know about the new ghostscript, it
won't work! The pstoepsi shell script on tgif's home page should work.
|
I got everything working
now. How do I get rid of the actual LaTeX text?
|
-
There are a couple of ways. One way is to select
Move/Justify An Attribute from the Attribute submenu
of the Special Menu. When the cursor changes, drag the
left mouse button (Btn1) and select the eq= attribute. When
the cursor changes again, click the right mouse button (Btn3)
to hide the eq= attribute.
Alternatively, you can add the following X resource:
Tgif.ShortCuts: !<Key>T:ToggleNamedAttrShown(eq=)
This X resource bind the <SHIFT>t key in tgif to the action
of ToggleNamedAttrShown with an argument of eq=.
So, when you press <SHIFT>t in
tgif (when the tgif drawing mode is
not in the draw text mode), the visibility of the eq=
attribute of the selected will be toggled.
|
I am getting a black box when I double-click an equation object.
What should I do to fix this?
|
-
For the "eq4*.sym" symbols that used the "convert" command of ImageMagick,
at some point, these commands stopped working. Here are the replacements that would work
with the newer version of "convert":
eq4xpm-land.sym
eq4jpg.sym
eq4-2x-nowin-jpg.sym
eq4-2x-jpg.sym
eq4xpm.sym
eq4png.sym
On Ubuntu, if you are having trouble running "convert" due to permissions issue, a quick way to
get around the problem (which is probably not the proper way to do this, and if you worry about security, you
probably should consult a security expert before doing this) is to do the following:
pushd /etc/ImageMagick-6
sudo cp policy.xml policy.xml.orig
sudo sed -i '1,$s/"none"/"read | write"/' policy.xml
sudo cp policy.xml policy.xml.new
popd
|
|