[comp.text] Psfig -- figuring out the boundingbox of Mac postscript file

sun@venus.ycc.yale.edu (02/02/90)

Greetings,

	I just installed psfig, the utility that allows one to embed
postscript pictures into LaTeX. I am able to run through and print out
the user's guide file as a sample. However, it took me a while for me to
figure out how to print postscript files from Adobe Illustrator. I still
don't know what to do with the files from MacDrawII and MacDraft. The
problem is with the boundingbox being missing. Does anyone have any
idea?

	In case someone is interested, here is what I figured out with
Illustrator 88's postscript file captured by control-f on Mac. There are
two lines starting with %%BoundingBox:. The first one looks like
	%%BoundingBox: ? ? ? ?
	But if you go down further in the file, you see another line
that does contain the coordinates, for example:
	%%BoundingBox:213 345 305 408
	Since there is no space between ":" and the first number,
Psfig does not recognize this line. Thus if you run the file with
LaTeX/Psfig, you get error messages about missing numbers, etc.
	If you copy the coordinates in the second line into the first,
and add a space before the first number, then Psfig will work,
though, you will see overlapped picture and text.
	Then I noticed a line like this:
	%%PageBoundingBox: 30 31 582 761
	With a few tries, I found out you need to add the first two
numbers, 30, 31, respectively to the first and third, and second and
fourth number of the BoundingBox line. In this example, the result is
	%%BoundingBox: 243 376 335 439
	And it works.

	Also, I am using VMS system and there is a form called Apple
attachted to the printer queue. If I use print the final postscript file
with print/form=apple, then I don't need to include the Mac.Prolog file.

|| Kang Sun             			   [sun@yalevms.bitnet] ||
|| Yale University, Dept.of Electr.Engin, New Haven, CT 06511-2157, USA ||
zWR.B34sQ'5g9$O5# # Ko?5

ief@geocub.greco-prog.fr (Alain Merigot) (02/05/90)

Here is the hack I use to include macdraw figures with psfig.
I draw  ON THE FIGURE a bounding box. Then, I save the figure in postscript
(with clover-F). After, I use a (trivial) perl program that will
	1) search the largest rectangle in the ps file.
	2) write the coordinate of that rectangle as the figure bounding
	   box, and kill the corresponding line.
It *is* a hack, but it works perfectly well. Adding the bounding box when
drawing the figure is not a real pain. There is another manipulation
to do in the header. If you are interested, I can send you details (and the
code).

			A. Merigot
			Institut d'Electronique Fondamentale
			Universite Paris Sud
			91405 Orsay Cedex
			France

			...uunet!mcvax!inria!iefups!am
			am%iefups.uucp@lri.lri.fr