home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / text / 1455 next >
Encoding:
Internet Message Format  |  1992-12-11  |  3.2 KB

  1. Path: sparky!uunet!ogicse!uwm.edu!daffy!uwvax!astroatc!vidiot!brown
  2. From: brown@vidiot.UUCP (Vidiot)
  3. Newsgroups: comp.text
  4. Subject: Re: groff and .eps example needed
  5. Message-ID: <4554@vidiot.UUCP>
  6. Date: 11 Dec 92 08:32:35 GMT
  7. Article-I.D.: vidiot.4554
  8. References: <63630007@hpl-opus.hpl.hp.com>
  9. Reply-To: brown@vidiot.UUCP (Vidiot)
  10. Organization: Vidiot's Hangout
  11. Lines: 95
  12.  
  13. In article <63630007@hpl-opus.hpl.hp.com> kk@hpl-opus.hpl.hp.com (Konstantinos Konstantinides) writes:
  14. <groff and eps files
  15. <
  16. <I know about the .PSPIC macro, but it centers the .eps file at
  17. <the center of the page.
  18. <
  19. <I just want to include a company logo at the left top and the
  20. <\X'ps: import does not want to work.
  21. <
  22. <Does anyone have a simple example of including an .eps file in
  23. <an arbitrary location in a groff document?
  24.  
  25. Here is a macro that I call .MBPIC:
  26.  
  27.  
  28. ***** CUT HERE *****
  29. .\" .MBPIC        Like PSPIC, but allows for absolute placement of the
  30. .\"            EPS file.  The location is based upon the lower-left
  31. .\"            corner of the graphic.  Since the resize will be
  32. .\"            proportional, only one axis is asked for.  Also does
  33. .\"            drop shadow and rotation.  The syntax is:
  34. .\"            .MBPIC filename x-loc y-loc x-size drop(1|0)
  35. .\"                0 rotate-val
  36. .\" Define the MBPIC macro.
  37. .\"
  38. .de MBPIC
  39. .if (\\nI==0)&(\\n(.P==1) \{\
  40. .br
  41. .fl
  42. .sy echo .ps-bb `psbb \\$1` >/tmp/psbb\\n[$$]
  43. .so /tmp/psbb\\n[$$]
  44. .nr ps-wid (\\n[ps-urx]-\\n[ps-llx])
  45. .nr ps-ht (\\n[ps-ury]-\\n[ps-lly])
  46. .if \\n[ps-wid]<0 .nr ps-wid 0-\\n[ps-wid]
  47. .if \\n[ps-ht]<0 .nr ps-ht 0-\\n[ps-ht]
  48. .prodef
  49. .de tng-vid
  50. ps: exec
  51. MB
  52. \\n[ps-llx] neg \\n[ps-lly] neg translate    %Remove EPS offset
  53. \\$7 rotate
  54. \\$2 \\$3 translate
  55. .8 .8 .8 setrgbcolor
  56. 6 -6 moveto
  57. \\$4 \\n[ps-wid] div dup scale
  58. \\..
  59. .if 0\\$5==1 \{\
  60. .am tng-vid
  61. 0 \\n[ps-ht] rlineto \\n[ps-wid] 0 rlineto 0 -\\n[ps-ht] rlineto closepath fill
  62. \\..
  63. .\}
  64. .am tng-vid
  65. 0 0 0 setrgbcolor
  66. %%BeginDocument: \\$1
  67. \\..
  68. .da tng-vid
  69. .trf \\$1
  70. .da
  71. .am tng-vid
  72. %%EndDocument
  73. PE
  74. \\..
  75. .fl
  76. \\Y[tng-vid]
  77. .sy rm /tmp/psbb\\n[$$]
  78. .\}
  79. ..
  80. ***** CUT HERE *****
  81.  
  82. The DROP flag is used to place a drop-shadow for included pictures.  The 0
  83. value in the option list must remain there.  It is a personal option that
  84. has been removed, but the placeholder must remain.
  85.  
  86. The MB and PE are dictionary definition additions, but they are as follows
  87. and can be included directly in the code:
  88.  
  89. /MB{save /psv exch def resolution 72 div dup neg scale
  90.   0 0 translate 0 0 moveto /showpage {} def }def
  91. /PE{psv restore}def
  92.  
  93. I suggest adding them to the dictionary.  If not, you need to remove the
  94. definitions of MB and PE and just include the code each time.
  95.  
  96. WARNING:  The origin is based upon the graphic state of groff, which is the
  97. upper-left corner.  If you want it to be in the lower-left, you will need
  98. to change the 0 0 values of translate in the MB procedure.
  99.  
  100. Use at your own risk.  If it doesn't work for you, fix it.  I fixed PSPIC
  101. to work for me.  This is a good base example for including EPS files and
  102. placing them where you want them.
  103. -- 
  104.       harvard\                          spool.cs.wisc.edu!astroatc!vidiot!brown
  105. Vidiot  ucbvax!uwvax..........!astroatc!vidiot!brown
  106.       rutgers/            INTERNET:vidiot!brown%astroatc.UUCP@spool.cs.wisc.edu
  107.                                    brown@wi.extrel.com
  108.