chuck@morgan.com (Chuck Ocheret) (03/31/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 page 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--------
Dunstan_Vavasour@uunet.uu.net (04/25/89)
I looked into this in some detail a while back when trying to include f2ps output in a LaTeX document. The fundamental point is that the TeX \special function doesn't leave any room at all. It just reads in the Postscript file and splats it exactly where the \special command is. Now, I don't have any knowledge of Postscript at all, but as far as I understand it, TeX treats the point where the \special command is written as the origin of the Postscript file (the term use is "the user's (0,0) point"). This means the point where a paragraph of text would start is (typically) the bottom left corner of the Postscript image. The sort of construct you want is --- begin LaTeX code-------- \begin{figure}[tb] \vspace*{5.7in} \special{psfile=fig1.ps} \caption{Schematic of the static model} \end{figure} Start of next paragraph.... --- end LaTeX code-------- The blank lines are important - if you don't put them in things come out in funny places (a TeXpert will be able to explain why). I've never tried the hscale, vscale options to \special, but I have never got the offset options to work, so the scaling ones should be treated with some scepticism. If you wish to preview the results of this jiggery pokery before printing it, I suggest you use the RalPage Postscript previewer, which is freely available (though not in the Public Domain). Dunstan Vavasour Systems Design Division GEC Electrical Projects Boughton Road Rugby, Warwickshire, CV21 1BU Tel: (+44) 788 542144 Ext: 3535 Fax: (+44) 788 60767 Email: dv@gec-epl.co.uk dv%uk.co.gec-epl@uk.ac.ukc (JANET) ...mcvax!ukc!uk.co.gec-epl!dv [[ This really belongs in "TeXHax" and "comp.text". --wnl ]]
zifrony@TAURUS.BITNET (05/03/89)
I have noticed from your posting that you have tried to embedd a PostScript graphic data within your LaTex document as a figure. I have only succeeded in embedding a PostScript input within a LaTex file not in a figure environment. I used the \vskip command before it so that LaTeX will know that it has to skip the picture, then I put the \special command, which included an additional hoffset parameter to position the picture correctly in the page, and then continued. I found out that the picture is best put in a page of her own (surrounded by \eject from both sides). I only resorted to this solution because I needed to place a copy of the SUN screen in the file. Otherwise, for figures drawn by FIG, it is best to transfer the FIG file to LaTeX with fig2latex, and plant this information in a figure environment in your LaTeX file. BTW, you can add the figure caption in your PostScript file instead of using a figure environment. Alas, it will not appear in your table of figures. Doron Zifrony zifrony%taurus.bitnet@cunyvm.cuny.edu or zifrony@Math.Tau.Ac.IL