home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fonts 1 / freshfonts1.bin / programs / amiga / pastex / macros / misc / epsfig.sty < prev    next >
Text File  |  1994-06-08  |  27KB  |  859 lines

  1. \def\fileversion{v1.0}
  2. \def\filedate{3 Dec 91}
  3. \immediate\write16{Document style option `epsfig', \fileversion\space
  4. <\filedate> (edited by SPQR)}
  5. %%%--------------------------------------------------------------------
  6. %%% psfig merged with EPSF =epsfig Release 1 
  7. %%%
  8. %%% code rearranged by Sebastian Rahtz from work by
  9. %%% Trevor Darrell; Tom Rokicki; Daniel Smith; H. Payne, Robert Russell
  10. %%%
  11. %%% This is a version of Darrell's `psfig' macros which are designed  only
  12. %%% to be used with Rokicki's dvips program and the `epsf' macros (these
  13. %%% are automaticaly included by the style file). I did this because the
  14. %%% \special commands used by `epsf' appear to be more robust and 
  15. %%% portable than the raw \specials used by `psfig', but I preferred the
  16. %%% psfig interface, and wanted to use some of its features which epsf
  17. %%% did not offer (specifically, clipping to the BoundingBox). This system
  18. %%% preserves the psfig interface, but mainly uses epsf macros to carry out
  19. %%% the job. The user interface is identical to \psfig, but you just use  
  20. %%% \epsfig instead. Clipping and rotation uses the original psfig macros, 
  21. %%% as do specific settings of the Bounding Box in the call to the macro. 
  22. %%% I could not work out how to do rotation or clipping with the epsf macros.
  23. %%%
  24. %%% One behaviour which may confuse people is that setting width= and 
  25. %%% height will *not* force a change in the aspect ratio. If you need
  26. %%% behaviour, use the \psfig macro instead of \epsfig. Rokicki's macros
  27. %%% do not provide a way of doing the aspect ration stuff.
  28. %%%  
  29. %%% If you *really* want old psfig behaviour regardless, use \psfig. It is
  30. %%% still there. Some of the features have gone, however. \figurepath
  31. %%% seemed redundant, since it could be controlled by the TEXINPUTS
  32. %%% variable anyway. I am not sure whether rheight= etc work or not, I
  33. %%% cannot remember the syntax!
  34. %%%  
  35. %%% As an added feature, if a file cannot be found, a file called `file'.bb
  36. %%% is searched for. This should simply contain a %%BoundingBox line. It is
  37. %%% assumed that if this exists, then `file'.Z exists, and is a Unix
  38. %%% compressed file. The macros then read the BB from `file'.bb, but insert
  39. %%% "zcat `file'.Z" in the  output for dvips to interpret (don't worry, it
  40. %%% knows about this). Saves a lot  of space! Actually, its more
  41. %%% complicated than that; the string passed to dvips for file `foo.ps' is
  42. %%% actually "zcat `texfind foo.ps.Z`", where `texfind' is assumed to be  a
  43. %%% shell script which searches the TEXINPUTS path for `foo.ps.Z'. Such a
  44. %%% script comes with dvips. Just alias it to `cat' if you have problems.
  45. %%% If you are *not* on a Unix system and use this, deliberately or by 
  46. %%% mischance, you will have problems!
  47. %%% 
  48. %%% This file can be included in a dumped format, or used as a LaTeX
  49. %%% style file, or used in plain TeX. It does not load itself twice.
  50. %%%
  51. %%% Sebastian Rahtz December 1991 spqr@uk.ac.soton.ecs
  52. %--------------------------------------------------------------------
  53. %--------------------------------------------------------------------
  54. %%% previous notes. this copy of psfig.tex inherited from version 1.7
  55. %--------------------------------------------------------------------
  56. %%% All psfig/tex software, documentation, and related files
  57. %%% in this distribution of psfig/tex are 
  58. %%% Copyright 1987, 1988, 1991 Trevor J. Darrell
  59. %
  60. %%% Permission is granted for use and non-profit distribution of psfig/tex 
  61. %%% providing that this notice be clearly maintained. The right to
  62. %%% distribute any portion of psfig/tex for profit or as part of any commercial
  63. %%% product is specifically reserved for the author(s) of that portion.
  64. %%%
  65. %%% Thanks to Greg Hager (GDH) and Ned Batchelder for their contributions
  66. %%% to this project.
  67. %%%--------------------------------------------------------------------------
  68. %%% GDH 7/26/87 -- changed so that it first looks in the local directory,
  69. %%% then in a specified global directory for the ps file.
  70. %%% SPQR 12/91 removed that last change. it follows TEXINPUTS anyway
  71. %%% RPR 6/25/91 -- changed so that it defaults to user-supplied name if
  72. %%% boundingbox info is specified, assuming graphic will be created by
  73. %%% print time.
  74. %%% SPQR 12/91 removed that last change. use LaTeX error message instead
  75. %%% SPQR 12/91 -- `no file found' produces LaTeX error message.
  76. %%%                If you recover from that the file name is set in draft
  77. %%%                mode in place of the file.
  78. %%%
  79. %%% Modified by J. Daniel Smith on 9 October 1990 to accept the
  80. %%% %%BoundingBox: comment with or without a space after the colon.  Stole
  81. %%% file reading code from Tom Rokicki's EPSF.TEX file (see below).
  82. %%% --- SPQR 12.91 removed most of this to use epsf directly
  83. %%%
  84. %%% More modifications by J. Daniel Smith on 29 March 1991 to allow the
  85. %%% the included PostScript figure to be rotated.  The amount of
  86. %%% rotation is specified by the "angle=" parameter of the \epsfig command.
  87. %%%
  88. %%% Modified by Robert Russell on June 25, 1991 to allow users to specify
  89. %%% .ps filenames which don't yet exist, provided they explicitly provide
  90. %%% boundingbox information via the \epsfig command. Note: This will only work
  91. %%% if the "file=" parameter follows all four "bb???=" parameters in the
  92. %%% command. This is due to the order in which psfig interprets these params.
  93. %%% ---- SPQR 12.91 removed all this
  94. %%%
  95. %%% 3 Jul 1991    JDS    check if file already read in once
  96. %%%
  97. %%% Modified by H. Payne on 9 October 1991 to allow rotation through
  98. %%% arbitrary angles, not just angles in the first quadrant.
  99. %--------------------------------------------------------------------------
  100. %%%
  101. %%% check to see if macros already loaded in (maybe some other file says
  102. %%% "\input epsfig") ...
  103. %%% from a suggestion by eijkhout@csrd.uiuc.edu to allow
  104. %%% loading as a style file:
  105. \edef\epsfigRestoreAt{\catcode`@=\number\catcode`@\relax}
  106. \catcode`\@=11\relax
  107. \ifx\typeout\undefined%
  108.     \newwrite\@unused
  109.     \def\typeout#1{{\let\protect\string\immediate\write\@unused{#1}}}
  110. \fi
  111. \ifx\undefined\epsfig%
  112. \else
  113.     \typeout{EPSFIG --- already loaded}\endinput
  114. \fi
  115. %
  116. %
  117. % we try to put a box round space of missing figures. plain TeX
  118. % doesn't have an easy command, so just ignore it
  119. \ifx\undefined\fbox\def\fbox#1{#1}\fi
  120. %%%
  121. %%% we need Rokicki's EPSF macros anyway, unless they are already loaded
  122. %
  123. \ifx\undefined\epsfbox\input epsf\fi
  124. %
  125. %% SPQR 12.91 handling of errors using standard LaTeX error 
  126. %% mechanism. In case we are plain TeX we first define the
  127. %% error routines...
  128. \ifx\undefined\@latexerr
  129.     \newlinechar`\^^J
  130.     \def\@spaces{\space\space\space\space}
  131.     \def\@latexerr#1#2{%
  132.     \edef\@tempc{#2}\expandafter\errhelp\expandafter{\@tempc}%
  133.     \typeout{Error. \space see a manual for explanation.^^J
  134.      \space\@spaces\@spaces\@spaces Type \space H <return> \space for
  135.      immediate help.}\errmessage{#1}}
  136. \fi
  137. %------------------------
  138. %% a couple of LaTeX error messages
  139. \def\@whattodo{You tried to include a PostScript figure which 
  140. cannot be found^^JIf you press return to carry on anyway,^^J
  141. The failed name will be printed in place of the figure.^^J
  142. or type X to quit}
  143. \def\@whattodobb{You tried to include a PostScript figure which 
  144. has no^^Jbounding box, and you supplied none.^^J
  145. If you press return to carry on anyway,^^J
  146. The failed name will be printed in place of the figure.^^J
  147. or type X to quit}
  148. %------------------------
  149. %
  150. \newwrite\@unused
  151. %------------------------------------------------------------------------
  152. %------------------------------------------------------------------------
  153. %%% @psdo control structure -- similar to Latex @for.
  154. %%% I redefined these with different names so that psfig can
  155. %%% be used with TeX as well as LaTeX, and so that it will not 
  156. %%% be vunerable to future changes in LaTeX's internal
  157. %%% control structure,
  158. %
  159. \def\@nnil{\@nil}
  160. \def\@empty{}
  161. \def\@psdonoop#1\@@#2#3{}
  162. \def\@psdo#1:=#2\do#3{\edef\@psdotmp{#2}\ifx\@psdotmp\@empty \else
  163.     \expandafter\@psdoloop#2,\@nil,\@nil\@@#1{#3}\fi}
  164. \def\@psdoloop#1,#2,#3\@@#4#5{\def#4{#1}\ifx #4\@nnil \else
  165.        #5\def#4{#2}\ifx #4\@nnil \else#5\@ipsdoloop #3\@@#4{#5}\fi\fi}
  166. \def\@ipsdoloop#1,#2\@@#3#4{\def#3{#1}\ifx #3\@nnil 
  167.        \let\@nextwhile=\@psdonoop \