[comp.lang.postscript] MacIntosh postscript documents in TeX

wikh@mathrt0.math.chalmers.se (Ronny Wikh) (05/29/89)

Hi!

There's supposed to be a way to get MacIntosh MacDraw, MacPaint etc pictures
into your TeX document. The only problem is: How?

As I understand it, you're supposed to make the MacIntosh to produce a special
postscript file. Then you take a part of the printer driver and include both
these files in your TeX document.

If anyone knows how to do this, please mail me a description of the procedures.

Ronny Wikh

===============================================================================
  E-mail: wikh@math.chalmers.se
  Mail:   Dept of Mathematics,
	  Chalmers University of Technology,
          S-412 96 Goteborg,
	  Sweden
  Phone: dept: +46 (0)31 723533, home: +46 (0)300 18107

siegman@sierra.Stanford.EDU (Anthony E. Siegman) (05/31/89)

				
HOW TO INSERT FIGURES INTO TEX DOCUMENTS USING TEXTURES ON THE MAX

These are some pretty elementary notes on how to do the above, which
I wrote for nontechnical staff members in our lab; Mac experts, please
don't be offended by the elementary parts.  Also, the "R" and "S"
characters that may appear at certain points are non-ASCII quote marks
I was too lazy to edit out.

1) Get the figure into a Macintosh file somehow, and Copy it onto the
Clipboard.

This means you have to prepare the figure using a "paint" or "draw"
program, like MacPaint, MacDraw, SuperPaint or other similar programs,
or scan it into the Mac using a scanner.

Once the figure is in the Mac, you can Copy either the whole figure or
part of it to the Clipboard using the appropriate Select and Copy
commands for whatever program you're using. (Note that you often only
want to Select the main part of the figure, not the whole page or
window the figure is in.  To do this, you may have to learn to use the
Selection Tool or the Lasso or other selection tool in your paint
program.)  Then Quit the draw or paint program, leaving the figure on
the Clipboard.

If you are processing several figures, it is much more convenient to
Copy and then Paste them all one by one into the Scrapbook as a
temporary storage place, since the Clipboard can only hold one item at
a time.

2) Start up Textures, and open up the TeX document in which you want
to use the figure(s)

3) Select the Pictures window for that document, using the Windows
menu in Textures

4) Get the figure you want to insert on the Clipboard (Copying it from
the Scrapbook if necessary), paste the figure from the Clipboard into
this window, and give it a name

When you Paste the figure in, it will appear in the window.  There
will also be a small box where you can click and type in a name for
the figure.  This name must be one word (no blanks in it).  You use
this name to refer to the figure in the Tex document from then on.
The dimensions (width and height) of the figure will also
automatically appear in two boxes below the name.

If you have multiple figures in the Scrapbook, you can open up the
Scrapbook on top of the Textures window, and Select, Copy and Paste
the figures one at a time from the Scrapbook into the Textures picture
window.  (Or there are other desk accessory programs like Paint
Grabber or Desk Paint which you can open on top of Textures and use to
grab and Paste figures into the Textures window.)  Give each figure a
one-word name as you paste it in.

5)  Use the figure(s) in the Textures document as follows:

You put the picture into your typeset Textures document basically by
saying in the source code for your document, at the right spot:

	\special{picture figure-name}

where \special and picture are special TeX commands, and figure-name
is the name you gave your figure in the pictures window.

The above command will insert the figure in your document at the same
size it is stored.  If you want to scale the printed size up or down,
you must say

	\special{picture figure-name scaled scale-factor}

where scale-factor is a number which gives the amount, relative to
1000, by which the printed figure size is to be scaled.  For example,

	a scale-factor of 1000 leaves the picture at its initial size
	a scale-factor of  500 prints it half size
	a scale-factor of  750 prints it at 3/4 of its initial size
	a scale-factor of 2000 will print it double size 

and so on.

The basic rule is that TeX inserts (or really, overlays) the figure on
top of whatever else may be on your output page, with the lower
left-hand corner of the figure located at wherever TeX thinks it is in
the output page when you give the \special command.

For example, if you have a figure that is 2" high you must skip down
2" on the page using, e.g., a "\vskip 2 in" command to create the
needed 2" of white space BEFORE giving the \special command.  If you
don't do this, the figure will go in on TOP of whatever text is
already in place for 2" above the insertion point.

Furthermore, TeX thinks the figure is just a dot of zero width and
height, so inserting the figure does NOT push other text out of the
way.  If you want to put in a figure, then put something to the right
of it on the page, you must figure out the correct horizontal skip to
insert, after you insert the figure itself.

6) Here is a short macro which will insert a given figure as a
\midinsert inside a Textures document.  (A \midinsert inserts its
material where it comes on the page if there is room enough at that
point; otherwise it pushes the material over to the top of the
following output page.)  This macro automatically computes the
necessary spacing, and centers the figure on the page.  The arguments
of the macro are explained in the comment lines inside the macro.
	
\def\figure#1#2#3#4#5{  
% arguments of this macro are as follows
%	#1=the name of the figure (one word!)
%	#2=the width of the figure in inches
%	#3=the height of the figure in inches   (you read these dimensions
%	   from the pictures window when you Paste the figure in)
%	#4=scale factor (relative to 1000) to scale the printed figure
%	#5=a complete caption for the figure
\midinsert		% start the \midinsert
\medskip		% put a little space above the figure
% Get the height of the figure, scale it, and move down 
% by the scaled figure height
\dimen0=#3 truein	
\divide\dimen0 by 1000 \multiply\dimen0 by #4
\vskip \dimen0
% get the figure width, scale it, move over the correct distance 
% to center the scaled figure
\dimen1 = \hsize \divide\dimen1 by 2
\dimen2 = #2 truein 
\divide\dimen2 by 1000 \multiply\dimen2 by #4
\divide\dimen2 by 2
\noindent  \hskip \dimen1  \hskip-\dimen2
% TeX is now at the correct insertion point for the scaled figure, 
% so insert it!
\special{picture #1 scaled #4}		
\bigskip	% put a bigskip space between the figure and the caption
% narrow the margins and insert the caption
% (you can modify the following line as you wish)
{\parindent 20 pt \narrower \narrower \noindent #5  \par}
\medskip	% put a little space below the caption
\endinsert}	% end the insert, and end the macro

Here is an example of this macro being used to insert a figure in a
report, with the figure being scaled to 60% of its original size:

\figure{Figure3}{5.68}{6.19}{600}{FIGURE 3: Schematic layouts of a
mode-locked optical parametric oscillator and a mode-locked
external-cavity diode laser.}

7) Some additional notes:

a) As mentioned above, there are some very handy desk accessory
programs with which you can open up MacPaint files that are on your
disk, without leaving Textures, RgrabS the figures one by one, and
Paste them into the TeX document's picture window.  RPaint GrabberS is
one such program, RDesk PaintS is another.

b) If you prepare your original figures using a RdrawS program,
instead of a RpaintS program (for example, using MacDraw rather than
MacPaint, or the Draw layer rather than the Paint layer of
SuperPaint), and if you include text in your figure, then the specific
fonts used in preparing that figure are remembered as part of the
figure.

[To get technical here, RpaintS-type figures are stored as
bitmapsQjust collections of black and white pixels; while RdrawS-type
figures are stored as collections of QuickDraw commands in what is
called a PICT file.  This difference is entirely invisible to you when
you Copy or Paste the figure; but the Mac knows and keeps track of
which type the figure is.]

Hence, when you finally print a TeX document with a RdrawS-type figure
in it on a LaserWriter, the LaserWriter wants the same fonts used in
the figure.  If the figure was prepared using the Geneva fonts,, for
example, which are commonplace on the Mac but are not in the
LaserWriter, TeX will have to send bit images of this font over to the
LaserWriter.  You will get a message about this when you print, and
the printing will be slowed down.

The bottom line: When preparing RdrawS-type figures for eventual use
in TeX documents, use the LaserWriter fonts in the draw program also
if at all possible.