[comp.sys.mac] MAC-PostScript & TeX

najm@uicsl.csl.uiuc.edu (04/28/89)

I am trying to insert a MAC-generated figure into a TeX document.

I have successfully generated the MAC postscript file, transferred it to the
VAX, included the required MAC header file, and successfully printed it on our
postscript laser printer(s). All this works fine.

Okay, now to put it into my TeX file, I have used the TeX "\special" command
and followed the directions of the "dvi2ps" manual as follows :

\special{psfile=fig.ps}
\vskip4in

and then used dvi2ps with the "-i mac.pro" option to load in the required
MAC header file. Well, it didn't work, I got the following error message :

%%[ Error: rangecheck; OffendingCommand: put ]%%

Am I doing something wrong, or else neglecting something? Please help by
responding directly to najm@uicsl.csl.uiuc.edu   ......... Thanks.

Farid.

munson@renoir.Berkeley.EDU (Ethan V. Munson) (05/01/89)

About two months ago I posted a message to the TEXHAX mailing list for
help on how to include Macintosh generated illustrations in TeX documents
which use the psfig macro package.  Many events have intervened, but I
think that I finally have an answer that is sufficiently correct to
post publicly.  I know of four basic approaches of which I consider
only three effective.  They are:

1) MODIFY THE LASERPREP FILE (Ineffective): Several people reported
success with this method, but I couldn't duplicate their results.  You
can save the PostScript which normally goes to the LaserWriter by
holding down Command-K while requesting printing.  The resulting file
contains a long prologue stored in the LaserPrep file in the system
folder and printing commands generated by the application program.
The basic approach here is to save the prologue separately and edit it
so that it will work correctly with programs like dvi2ps.  
	As I said above, several people told me they had done this
successfully, but I was never able to.  There appears to be a conflict
between what dvi2ps does and what the LaserPrep file does.  Also, we
have a DEC PostScript printer here which cannot accept some of the
LaserWriter/68000-specific commands which appear in the LaserPrep file.

2) USE PS-FROM-MAC (Close but no cigar): PS-from-Mac is a Mac
application which converts MacPaint and MacDraw files into plain
printer-independent PostScript.  It was written by Alec Dunn of the
University of Sydney.  He sells it for a reasonable price.  In
general, it works like a charm.  You run PS-from-Mac on your file and
get a PostScript file which can be included "as is" in a TeX document.
I don't know if it can read MacDraw II files, but I think MacDraw II
can output the old file format, so it shouldn't be much of an issue.
The problem is that MacDraw documents do not come out precisely as you would
expect.  Some of the differences are not important.  For example, the Mac
prints arrowheads with rounded backs.  PS-from-Mac arrowheads are
triangles.  A more important problem is that some objects get
positioned differently than they appear on the screen.  I tried to put
rectangles around individual 10 pt words.  When the screen said the
word looked centered in the box, the printed result had the box
shifted downward.  If you are including a Mac figure in a TeX
document, you are likely to be picky about positioning, so I think
this is a serious problem.

3) CRICKET DRAW PLUS SOME GYRATIONS (Effective but many steps):
Cricket Draw allows you to save a drawing as a PostScript file using
its own printer-independent prologue.  Unfortunately, there is still a
fair amount of massaging required.  The steps are:

1) Create your figure.
2) Turn the entire figure into one group by using the Select All and
	Group menu options.
3) Flip the figure vertically using the Reflect on X menu option.
	This is necessary  because Cricket Draw, like most Mac applications,
	put its image in the fourth quadrant of the Cartesian plane.  If you
	don't flip the figure it comes out upside down.
4) Open a new PostScript window, and use the Generate PostScript menu
	option to create a PS version of your figure.  Save this PS file using
	the "Complete" option, which appends the Cricket Draw prologue.
5) Transfer the file to the UNIX box (use a file transfer program
	in text mode)
6) Determine the bounding box of the figure by using the program bbfig
	which is part of the dvi2ps distribution.
7) Edit the PS file to make the Bounding Box comment correct. If you
	figure include text, you must also change some font names.  
	For some reason, Cricket Draw uses  names like \_______Symbol 
	for the fonts.  If you strip off the non-printing part of the 
	font names, things will work.  Obviously, this could be done by 
	a simple sed script.
8) You are now ready to go.  Just include the file in your TeX document  
	using psfig.

Well, this series of steps is a pain, but frankly, most of it doesn't
take that long.  Also, Cricket Draw is not very expensive and is
designed for precisely the kind of drawing you are likely to want in a
figure in a paper.

4) USE ADOBE ILLUSTRATOR (Effective and easy):  Adobe Illustrator
files are PostScript files.  You construct your figure and save it.
There is already a Bounding Box comment, so you just transfer the file
to the UNIX box and include it in the TeX file.  Wait a minute.  One
trivial problem.  I don't have a copy of Illustrator '88 available,
but our plain Illustrator files have a Bounding Box comment that looks like
	%%BoundingBox:91 -394 272 -235
when psfig expects a space after the colon, as in
	%%BoundingBox: 91 -394 272 -235
Otherwise, it works like a charm.  My complaint with Illustrator is
that it is primarily intended for graphic artists, which I am not.  As
a result, there is no round-corner rectangle (of which I am quite
fond) and line-drawing and spline-drawing use the same tool, which I
find confusing.  Finally, Illustrator costs about twice as much as
Cricket Draw.


CONCLUSION:  For me, only Cricket Draw and Illustrator are acceptable
solutions.  I haven't been able to get the LaserPrep solution to work
at all.  PS-from-Mac is a good idea but is just inaccurate enough to
require multiple passes to get a figure right.

Cricket Draw presents a cheap solution that requires some elbow-grease.
I think that most of the file editing on the UNIX box can be automated, but
a run of bbfig will always be required.

Illustrator files require almost no postprocessing but it is an
expensive program and may not be as easy for you to use as Cricket Draw.

Ethan Munson
munson@renoir.berkeley.edu
...ucbvax!renoir!munson

My thanks to Steve Strickland for coming up with the Cricket Draw
method and to Glenn Reid of Adobe for getting it through my thick head
that Illustrator would work just fine.

hodges@maui.cs.ucla.edu (Jack Hodges) (05/03/89)

In article <28996@ucbvax.BERKELEY.EDU> munson@renoir.Berkeley.EDU.UUCP (Ethan V. Munson) writes:
>About two months ago I posted a message to the TEXHAX mailing list for
>help on how to include Macintosh generated illustrations in TeX documents
>which use the psfig macro package.  Many events have intervened, but I
>think that I finally have an answer that is sufficiently correct to
>post publicly.  I know of four basic approaches of which I consider
>only three effective.  They are:
 
>1) MODIFY THE LASERPREP FILE (Ineffective): Several people reported
>success with this method, but I couldn't duplicate their results.

>3) CRICKET DRAW PLUS SOME GYRATIONS (Effective but many steps):
 
>Cricket Draw presents a cheap solution that requires some elbow-grease.
>I think that most of the file editing on the UNIX box can be automated, but
>a run of bbfig will always be required.

I really don't understand the problem here.  Whether you use macpaint,
macdraw, superpaint, cricket draw or whatever all that you need do is
use command-f very shortly after telling the system that it is OK to print
the document.  The system than creates a postscript rather than appending
the laserprep file and sending to the printer.  After that you need a
proper laserprep file to add into your latex document, and a macro for inserting
the postscript into your document.  I have included my versions below in case
you are wondering.  One of the issues is what version of laserprep you are
using with your machine to prepare the figure (generate the postscript) since
it must match at the other end.  And of course the form of the figure macro
depends on what version of dvi2ps (or dvips) that you are running.  My current
macro is based on dvips but I have others using the older format.

A sample section for a LaTeX document...

\documentstyle{article}

...

\newcommand{\figcap}[2]{
  \small
  \rm
  {\caption{#2\label{#1}}}
  }

\newcommand{\macputhv}[5]{
  \special{psfile="#1",
           hscale=#2,
           vscale=#2,
           hoffset=#4,
           voffset=#5}
  \vspace{#3in}
  }

...

\begin{document}
\special{header /usr/local/lib/tex/laserprep.5.0.pro}

...

\end{document}

I have also included a figure captioning macro which I use with macputhv
in obvious ways.  The macputhv macro uses dvips format, and you can modify
scales and offsets at will.  In dvi2ps the syntax is slightly different.
The header that I have in this sample is laserprep.5.0.  In systems where
your Mac has 5.2 (or other) installed there is no need for this statement.
I have it because I am still trying to maintain consistency with a myriad
of figures produced under the 5.0 laserprep version.  An example of the
use of macput is shown below:

\begin{figure}
\macputhv{foo.ps}{1.0}{4.5}{144}{0}
\vskip 0.05in
\figcap{foo}{Foos live in large jungles without trees}
\end{figure}

I have used various versions of these macros on papers, books, dissertation
and so forth for various versions of LaTeX on various Unix boxes and Mac
laserprep files.  Sometimes the propblems have been incompatible laserprep
files, or changing syntax for the dvi2ps -> dvips conversion, or whatever but
the figures always eventually came out.  My current preference is Cricket Draw
but only because of the quality of figure and not because it takes more or
less effort to produce the postscript file...that is invariant.

Of course, if I have answered the wrong question then I apologize.

Jack Hodges, UCLA 

ralph@lzfme.att.com (I like forms, and forms like me) (05/03/89)

In article <28996@ucbvax.BERKELEY.EDU>, munson@renoir.Berkeley.EDU (Ethan V. Munson) writes:
> About two months ago I posted a message to the TEXHAX mailing list for
> help on how to include Macintosh generated illustrations in TeX documents
> which use the psfig macro package.  Many events have intervened, but I
> think that I finally have an answer that is sufficiently correct to
> post publicly.  I know of four basic approaches of which I consider
> only three effective.  They are:
 
> 1) MODIFY THE LASERPREP FILE (Ineffective): Several people reported
> success with this method, but I couldn't duplicate their results.  You

We've done this here in order to print out Mac drawings on our
UNIX(R) system, but it doesn't seem to solve our big problem in
incorporating them into troff documents using psfig, which is that
psfig needs a bounding box.

What we're trying to do is to find a relatively idiot-proof way of
incorporating MacDraw II drawings into troff documents with a
minimum of work.  The artists are not especially computer literate,
so the ideal would be to find a program that would convert the
drawings to a psfig-compatible format.

> 2) USE PS-FROM-MAC (Close but no cigar): PS-from-Mac is a Mac
> application which converts MacPaint and MacDraw files into plain
> printer-independent PostScript.  It was written by Alec Dunn of the
> University of Sydney.  He sells it for a reasonable price.  In
 
I'd like more information about this if you have it.  The problems
you mentioned seem like they would make it not useful for our
applications, but I would like to contact the author and ask some
questions.

> 3) CRICKET DRAW PLUS SOME GYRATIONS (Effective but many steps):
> Cricket Draw allows you to save a drawing as a PostScript file using
> its own printer-independent prologue.  Unfortunately, there is still a
> fair amount of massaging required.  The steps are:
> 
> Well, this series of steps is a pain, but frankly, most of it doesn't
> take that long.  Also, Cricket Draw is not very expensive and is
 
Too complicated for what we need.  Our artists don't care much about
computers beyond being able to use them to create drawings.  They
don't want to know anything else about them.

> 4) USE ADOBE ILLUSTRATOR (Effective and easy):  Adobe Illustrator
> files are PostScript files.  You construct your figure and save it.
 
Our artists generally find Illustrator too complicated to learn.
MacDraw II fills their needs very well, and there was a minimum of
training involved in switching from LisaDraw.

One possibility that intrigued me was using DrawOver, which comes
with the Illustrator 88 package.  Unfortunately, it seems to choke
on large drawings, dropping all the text (which DOES show up in the
preview you get).  The other problem is that smoothed lines within
MacDraw II are converted as straight lines.  Is Adobe aware of this?  
(Glenn?)
 
> I think that most of the file editing on the UNIX box can be automated, but
> a run of bbfig will always be required.
 
I haven't been able to get bbfig to run on our machine for some
reason, but I'm still trying.

Another option that occurred to me was to take Glenn Reid's
DistillPS/still.ps combination and use that.  Unfortunately, when I
print out the returned file, I get nothing BUT the text (now if only
I could combine the text from DistillPS with the output from
DrawOver....)

There are a couple of other options.  Aldus Freehand opens PICT
files directly, and can export to EPS format.  However, polygons
come out smoothed when they're opened by Freehand.

There's a program called The Curator which is supposed to catalog
drawings and transfer between formats.  I haven't been able to get a
demo of this yet.  Does anybody have any experience with how well
this works?

And if anyone at Apple is still reading this at this point, is there
a reason that LaserPrep doesn't provide Bounding Box information?
Is this changed in LaserPrep 6.0?  If not, are there any plans to
change it for any future release?

Sorry to go on at such length, but this problem has occupied a great
deal of my time for the past four of five months....

Ralph Brandi, contracted to
Tech Pubs/Commercial Arts/High Tech Publishing
AT&T, Middletown, New Jersey
-- 
Ralph Brandi    [most gateways in the known universe]!att!lzfme!ralph

Work flows toward the competent until they are submerged.

hammen@csd4.milw.wisc.edu (Robert J. Hammen) (05/04/89)

In article <1307@lzfme.att.com> ralph@lzfme.att.com (I like forms, and forms like me) writes:
>What we're trying to do is to find a relatively idiot-proof way of
>incorporating MacDraw II drawings into troff documents with a
>minimum of work.

There are a couple of possible solutions to your problem. A small company by
the name of Taylored Graphics has a utility program, I believe called Xris
Xros, that will take a PostScript file generated with Command F/K and convert
that file to an Adobe Illustrator document, which Illustrator could then save
as an EPSF document.

>One possibility that intrigued me was using DrawOver, which comes
>with the Illustrator 88 package.  Unfortunately, it seems to choke
>on large drawings, dropping all the text (which DOES show up in the
>preview you get).  The other problem is that smoothed lines within
>MacDraw II are converted as straight lines.  Is Adobe aware of this?  

I think they are. They have released a new program, Adobe Streamline, which 
can take TIFF, PICT (I believe) and MacPaint files and will do an intelligent
autotrace on them (much more powerful than the wimpy autotrace found in 
Illustrator 88 or FreeHand - they are using edge/centerline algorithms to
evaluate the drawing). I have used Streamline with TIFF files; I am notpositive
it will do PICT files, but it's worth a call to Adobe. Streamline lists at
around $395.

Robert

///////////////////////////////////////////////////////////////////////////
/ Robert Hammen  | hammen@csd4.milw.wisc.edu | uwmcsd1!uwmcsd4!hammen     /
/ Delphi: HAMMEN | GEnie: R.Hammen | CI$: 70701,2104 | MacNet: HAMMEN     /
/ Bulfin Printers | 1887 N. Water | Milwaukee WI 53202 | (414) 271-1887   /
/ 3839 N. Humboldt #204 | Milwaukee WI 53212 | (414) 961-0715 (h)         /
///////////////////////////////////////////////////////////////////////////