Article View: uw.tex
Article #5Re: Mac generated figures in LaTex document?
From: Russell Almond
Date: Wed, 05 Jun 1991 05:17
Date: Wed, 05 Jun 1991 05:17
135 lines
5061 bytes
5061 bytes
% Almond Figure Macros and belief function definitions. This provides
% a package of interface routines to postsript figures.
% The routines in question use a definition called directory which
% points to the figure directory. That should be changed in each
% program.
% The principle routine is \psfig which takes 5 arguments. The first
% is the figure number, the second in [] is the name of the file
% (minus the .ps extension and the directory (which is taken from
% \directory)) The third is the caption for the figure, the fourth is
% hsize= horizontal dimension and the fifth is vsize= vertical
% dimension. The whole thing is finish with a /
% For example: \psfig3[graph]{A really stupid plot}}hsize=4in
% vsize=75pt/ This produces a figure with \directory/graph.ps as the
% postscript file. Its caption is {\it Figure 3. A really stupid
% plot\/} and a space of 75pt will be left for it the vertical space,
% and it will be centered as if it is four inches wide.
% The horizontal and vertical size parameters are sent via the hsize
% and vsize parameters of the special command. See dvi2ps
% documentation for more details.
%%%%%%%%%%%Collosally important note: There are at least three
% versions of dvi2ps running around (I've seen two on the Statistics
% Dept. machines). They use different units for passing hsize, vsize
% commands (most use bp, some use inches). This may need to be set
% for your local machine.
%% Figure insertion macros
\newdimen\fighoffset
\newdimen\figwidth
\newdimen\figheight
\newcount\countdimen
\newcount\countunit
\newdimen\dimenscratch
%% To turn off figure processing use \specialdofalse
\newif\ifspecialdo %include special commands or just leave space
\specialdotrue
%% To suppress the word Figure in captions (for two column papers)
%% reste this variable.
\def\Fig{Figure }
% Rescaling macros
\def\dividedimen#1/#2/{\dimenscratch=#1%
\countdimen=\dimenscratch\dimenscratch=#2%
\countunit=\dimenscratch \divide\countdimen by\countunit
%\the\countdimen
}
%%%%% Machine dependent
\def\psunit{1bp} % Was 1bp is now 1in, documentation has not changed.
% \psfig -- inserts a single figure with caption and leaving space as
% indicated.
\outer\def\psfig#1[#2]#3hsize=#4 vsize=#5/{
\midinsert
\figwidth= #4%
\fighoffset=\hsize \advance\fighoffset -\figwidth
\divide\fighoffset by 2%
\figheight= #5%
\vskip\figheight
\hskip\fighoffset
\dividedimen\figheight/\psunit/\edef\vs/{\the\countdimen}%
\dividedimen\figwidth/\psunit/\edef\hs/{\the\countdimen}%
\edef\specialcommand{psfile="\directory/#2.ps" hsize=\hs/
vsize=\vs/ }%
\ifspecialdo
\special\expandafter{\specialcommand}%
\fi\hfil\break
\centerline{\it \Fig #1. #3\/}
\endinsert
}
% twopsfig -- produces a,b figures (from files #2a.ps and #2b.ps) side
% by side. #3 and #4 are the two captions, hsize is the width of a
% single figure
\outer\def\twopsfig#1[#2]#3#4hsize=#5 vsize=#6/{
\midinsert
\figwidth= #5%
\fighoffset=\hsize \divide\fighoffset by 2%
\advance\fighoffset -\figwidth
\divide\fighoffset by 2%
\figheight= #6%
\vbox{
\settabs2\columns
\vskip\figheight
\dividedimen\figheight/\psunit/\edef\vs/{\the\countdimen}%
\dividedimen\figwidth/\psunit/\edef\hs/{\the\countdimen}%
\tabalign\hskip\fighoffset
\edef\specialcommand{psfile="\directory/#2a.ps" hsize=\hs/
vsize=\vs/ }%
\ifspecialdo
\special\expandafter{\specialcommand}%
\fi
&\hskip\fighoffset
\edef\specialcommand{psfile="\directory/#2b.ps" hsize=\hs/
vsize=\vs/ }%
\ifspecialdo
\special\expandafter{\specialcommand}%
\fi\cr
\medskip
\tabalign\hfill{\it \Fig #1a. #3\/}\hfill
&\hfill{\it \Fig #1b. #4\/}\hfill\cr
}
\endinsert
}
% This macro inserts a figure with no caption and no tag definition.
% arguments are interpreted the same was as in \psfig.
\def\innerpsfig[#1]hsize=#2 vsize=#3/{
\figwidth= #2%
\fighoffset=\hsize \advance\fighoffset -\figwidth
\divide\fighoffset by 2%
\figheight= #3%
\vskip\figheight
\hskip\fighoffset
\dividedimen\figheight/\psunit/\edef\vs/{\the\countdimen}%
\dividedimen\figwidth/\psunit/\edef\hs/{\the\countdimen}%
\edef\specialcommand{psfile="\directory/#1.ps" hsize=\hs/
vsize=\vs/ }%
\ifspecialdo
\special\expandafter{\specialcommand}%
\fi
}
Russell Almond Spring Sunshine,
U. Washington, Statistics, GN-22 The Tree-of-Cliques in Hyperbloom.
Seattle, WA 98195 Eschew Affine Constraints!
almond@stat.washington.edu, (206) 543-4302 (future ancient Japaneese Haiku)
Technical Details
Message-ID:
<1991Jun5.051514.6873@lisbon.stat.washington.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!milton!lisbon!almondReferences:
<1991Jun5.014748.1877@milton.u.washington.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!news-server.csri.toronto.edu!rpi!dali.cs.montana.edu!milton!lisbon!almond From: almond@lisbon.stat.washington.edu (Russell Almond) Newsgroups: uw.tex,comp.text.tex Subject: Re: Mac generated figures in LaTex document? Keywords: dvi2ps Message-ID: <1991Jun5.051514.6873@lisbon.stat.washington.edu> Date: 5 Jun 91 05:17:25 GMT References: <1991Jun5.014748.1877@milton.u.washington.edu> Sender: news@milton.u.washington.edu (News) Organization: U.W. Department of Statistics Lines: 135