[comp.text] dvi2ps/PostScript -- including troff illustrations

lamy@ai.toronto.edu (12/02/86)

Including illustrations generated by troff (i.e. pic, graf, ideal, ...)
in TeX documents is straight-forward. The software below and the procedure
described here assume TranScript 2.0.

0) unpack the shar file below and copy 'extract' somewhere on your path, and
   psditTeX.ps to where your PostScript files are kept (/usr/lib/tex/ps, say)

1) generate the illustration using
       psroff -t >file.all

2) remove the definition part at the beginning of the file.
   (there is no need to download the definitions once per illustration)
       extract file.all >file.ps

3) Assuming foo.tex contains the \special{psfile=file.ps} command
   and has been TeXed/LaTeXed as usual,

   dvi2ps -i $TranScript/psdit.pro  -i /usr/lib/tex/ps/psditTeX.ps file

   will do it all.  $TranScript is the directory where the TranScript
   software lives.  'psditTeX.ps' redefines things so that coordinates
   come out o.k. and that no spurious page breaks occur.

Notes:  Read the BUGS section of the psroff man page, or else your
   pic output will come out funny.  Also, I have attempted to correct
   for troff's default margins of 1" -- you can use the hoffset parameter
   to \special to fix that if that is wrong for you.  See comment in code
   for a permanent fix, should you wish one.

Hope this helps.


Jean-Francois Lamy
AI Group, Dept of Computer Science     CSNet: lamy@ai.toronto.edu
University of Toronto		       EAN:   lamy@ai.toronto.cdn
Toronto, ON, Canada M5S 1A4	       UUCP:  lamy@utai.uucp

-------------------------------------------------------------------------------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	psdit.fix
#	extract
# This archive created: Mon Dec  1 15:54:59 1986
export PATH; PATH=/bin:$PATH
if test -f 'psdit.fix'
then
	echo shar: will not over-write existing file "'psdit.fix'"
else
cat << \SHAR_EOF > 'psdit.fix'
% TranScript 2.0 psroff/psdit  vs  dvi2ps interface code
% Jean-Francois Lamy, AI Group, University of Toronto
% lamy@ai.toronto.edu
$DITroff begin
/xi {-72              % Correct for default 1" margins.
  %72 11 mul        % we don't want to move up one page...
  0 translate 72 resolution div dup neg scale 0 0 moveto
  /fontnum 1 def /fontsize 10 def /fontheight 10 def /fontslant 0 def F
  /pagesave save def}def
/p{pop %showpage    % no spurious breaks please.
   pagesave restore /pagesave save def}def
end

SHAR_EOF
fi # end of overwriting check
if test -f 'extract'
then
	echo shar: will not over-write existing file "'extract'"
else
cat << \SHAR_EOF > 'extract'
#!/bin/sh
#  Remove header from 'psroff' or 'psdit' output.
#  Everything up to the 'ditstart' line is discarded, as we assume
#  that the header has been downloaded once and for all.
#
#  Jean-Francois Lamy, AI Group, University of Toronto
#  lamy@ai.toronto.edu
#
sed -e '/^ditstart/,$!d' $@
SHAR_EOF
chmod +x 'extract'
fi # end of overwriting check
#	End of shell archive
exit 0