Article View: comp.text
Article #2900Re: groff and .eps example needed
From: Vidiot
Date: Fri, 11 Dec 1992 08:32
Date: Fri, 11 Dec 1992 08:32
95 lines
3371 bytes
3371 bytes
In article <63630007@hpl-opus.hpl.hp.com> kk@hpl-opus.hpl.hp.com (Konstantinos Konstantinides) writes:
<groff and eps files
<
<I know about the .PSPIC macro, but it centers the .eps file at
<the center of the page.
<
<I just want to include a company logo at the left top and the
<\X'ps: import does not want to work.
<
<Does anyone have a simple example of including an .eps file in
<an arbitrary location in a groff document?
Here is a macro that I call .MBPIC:
***** CUT HERE *****
.\" .MBPIC Like PSPIC, but allows for absolute placement of the
.\" EPS file. The location is based upon the lower-left
.\" corner of the graphic. Since the resize will be
.\" proportional, only one axis is asked for. Also does
.\" drop shadow and rotation. The syntax is:
.\" .MBPIC filename x-loc y-loc x-size drop(1|0)
.\" 0 rotate-val
.\" Define the MBPIC macro.
.\"
.de MBPIC
.if (\\nI==0)&(\\n(.P==1) \{\
.br
.fl
.sy echo .ps-bb `psbb \\$1` >/tmp/psbb\\n[$$]
.so /tmp/psbb\\n[$$]
.nr ps-wid (\\n[ps-urx]-\\n[ps-llx])
.nr ps-ht (\\n[ps-ury]-\\n[ps-lly])
.if \\n[ps-wid]<0 .nr ps-wid 0-\\n[ps-wid]
.if \\n[ps-ht]<0 .nr ps-ht 0-\\n[ps-ht]
.prodef
.de tng-vid
ps: exec
MB
\\n[ps-llx] neg \\n[ps-lly] neg translate %Remove EPS offset
\\$7 rotate
\\$2 \\$3 translate
.8 .8 .8 setrgbcolor
6 -6 moveto
\\$4 \\n[ps-wid] div dup scale
\\..
.if 0\\$5==1 \{\
.am tng-vid
0 \\n[ps-ht] rlineto \\n[ps-wid] 0 rlineto 0 -\\n[ps-ht] rlineto closepath fill
\\..
.\}
.am tng-vid
0 0 0 setrgbcolor
%%BeginDocument: \\$1
\\..
.da tng-vid
.trf \\$1
.da
.am tng-vid
%%EndDocument
PE
\\..
.fl
\\Y[tng-vid]
.sy rm /tmp/psbb\\n[$$]
.\}
..
***** CUT HERE *****
The DROP flag is used to place a drop-shadow for included pictures. The 0
value in the option list must remain there. It is a personal option that
has been removed, but the placeholder must remain.
The MB and PE are dictionary definition additions, but they are as follows
and can be included directly in the code:
/MB{save /psv exch def resolution 72 div dup neg scale
0 0 translate 0 0 moveto /showpage {} def }def
/PE{psv restore}def
I suggest adding them to the dictionary. If not, you need to remove the
definitions of MB and PE and just include the code each time.
WARNING: The origin is based upon the graphic state of groff, which is the
upper-left corner. If you want it to be in the lower-left, you will need
to change the 0 0 values of translate in the MB procedure.
Use at your own risk. If it doesn't work for you, fix it. I fixed PSPIC
to work for me. This is a good base example for including EPS files and
placing them where you want them.
--
harvard\ spool.cs.wisc.edu!astroatc!vidiot!brown
Vidiot ucbvax!uwvax..........!astroatc!vidiot!brown
rutgers/ INTERNET:vidiot!brown%astroatc.UUCP@spool.cs.wisc.edu
brown@wi.extrel.com
Technical Details
Message-ID:
<4554@vidiot.UUCP>Path:
arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!daffy!uwvax!astroatc!vidiot!brownReferences:
<63630007@hpl-opus.hpl.hp.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!ogicse!uwm.edu!daffy!uwvax!astroatc!vidiot!brown From: brown@vidiot.UUCP (Vidiot) Newsgroups: comp.text Subject: Re: groff and .eps example needed Message-ID: <4554@vidiot.UUCP> Date: 11 Dec 92 08:32:35 GMT Article-I.D.: vidiot.4554 References: <63630007@hpl-opus.hpl.hp.com> Reply-To: brown@vidiot.UUCP (Vidiot) Organization: Vidiot's Hangout Lines: 95