chuck@Morgan.COM (Chuck Ocheret) (03/14/89)
I am using dvi2ps (from MIT?) to convert LaTeX output to postscript. I am running on a network of Sun 3's and 4's (and one crummy 386i) under SunOS 4.0.1. The manual for dvi2ps mentions support for the TeX \special command which should allow the inclusion of encapsulated Postscript. I am not having any luck at all getting figures to appear where I want (if I can get them to appear at all). Would someone please e-mail directly to me ways to include the following Postscript code as a figure (with a caption) within a LaTeX document scaled arbitrarily? ---- begin postscript code ------------ %!PS-Adobe-1.0 %%Title: line drawing %%EndComments gsave 0 setlinewidth newpath % % Data varies between 0 and 1 in x and y % Data should be displayed in rectangular region within 1 inch border on page % % Translate by 1 inch 72.0 72.0 translate % % Scale to fit in rectangular region 468 648 scale % % Draw box 0 0 moveto 0 1 lineto 1 1 lineto 1 0 lineto 0 0 lineto % % Draw 'X' 1 1 lineto 0 1 moveto 1 0 lineto stroke showpage grestore ---- end postscript code ------------ I have tried things like the following with no success... --- begin LaTeX code-------- \begin{figure} \special{psfile=foo.ps hscale=.5 vscale=.5} \caption{test caption} \label{figure_x} \end{figure} --- end LaTeX code-------- -- +------------------+ Chuck Ocheret, Sr. Staff Engineer +------------------+ | chuck@morgan.com | Morgan Stanley & Co., Inc. | (212)703-4474 | | Duty now ... |19th Floor, 1251 Avenue of the Americas| for the future. | +------------------+ New York, N.Y. 10020 +------------------+
olof@hurratio.tde.lth.se (Olof Ekdahl) (03/17/89)
In article <240@terminus.Morgan.COM> chuck@Morgan.COM (Chuck Ocheret) writes: >I am using dvi2ps (from MIT?) to convert LaTeX output to postscript. Below is the LaTex file in which I have inserted a line which creates space for the figure (LaTex doesn't do it). Furthermore You should try the offset parameters 'hoffset' and 'voffset' within the '\special{}' command. Latex has its own translations and scaling, and together with the ones You put in the Postscript file, the figure might be placed outside the paper. Anyway, if the firgure is supposed to be in top of the paper, you must place the picture origo (with the 'vspace') so there is enough room. You must also run LaTex from the same directory as your foo.ps file. Otherwise declare the path in the 'special' command. >--- begin LaTeX code-------- >\begin{figure} \vspace{y} %% size in y. You have to create Your own figure space. >\special{psfile=foo.ps hscale=.5 vscale=.5} >\caption{test caption} >\label{figure_x} >\end{figure} Best regards / Olof Ekdahl
charlie@mica.stat.washington.edu (Charlie Geyer) (03/19/89)
Several people have asked lately how to include PostScript in TeX. The following is the way I have worked out after playing with it for about a year. It uses the LaTeX figure environment to get the exact placement on the page of the \special command. There are two macros \psinc (for PostScript INClude) and \framepsinc. The usage is \psinc(arg1,arg2){arg3} where arg1 is the width of the included figure in inches, arg2 the height, and arg3 the arguments to the \special command. The usage for \framepsinc is the same (it just puts the figure in a framebox). When the files "woof.inc" and "woof.tex" are cut out latex woof dvi2ps woof.dvi | lpr does the example. Note the comment about the PostScript showpage command in "woof.inc." Dvi2ps does not disable page ejects. If you are producing PostScript with a driver that is expecting its output to be printed directly, you have to remove the "showpage" commands with an editor before the file can be included. sed 's/showpage//g' file1 > file2 does the trick. Cut this out as the file "woof.inc" -------------- cut here ---------------------- %! Magic comment indicates PostScript to UNIX gsave /Helvetica findfont 14 scalefont setfont newpath 0 0 moveto (This is a test include file.) dup stringwidth pop 2 div 144 exch sub 28 moveto show grestore % showpage %%% comment out "showpage" commands, they upset TeX. -------------- cut here ---------------------- Cut this out as the file "woof.tex" -------------- cut here ---------------------- % % macros % \def\psinc(#1,#2)#3{ \setlength{\unitlength}{1in} \centering\begin{picture}(#1,#2) \put(0,0){\special{#3}} \end{picture}} % \def\framepsinc(#1,#2)#3{ \setlength{\unitlength}{1in} \centering\begin{picture}(#1,#2) \put(0,0){\framebox(#1,#2)[bl]{\special{#3}}} \end{picture}} % \def\postscript{{\sc PostScript}} % \documentstyle[12pt]{article} \begin{document} This is a test of including \postscript\ in \TeX\ (\LaTeX\ actually). The text up to here is set by \TeX. The large type in the Helvetica font is produced by the included \postscript\ file ``woof.inc.'' \begin{figure}[h] \psinc(4,1){psfile=woof.inc} \caption[]{A figure made by an included \postscript\ file.} \end{figure} Sometimes it is useful to put a frame around the area left for the included figure so that one can see how much of the alloted space the figure takes up, the margins \LaTeX\ leaves around the figure, and so forth. \begin{figure}[h] \framepsinc(4,1){psfile=woof.inc} \caption[]{The same figure in a framebox.} \end{figure} \end{document} -------------- cut here ----------------------