groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Groff] pspic: Text around picture?


From: Denis M. Wilson
Subject: Re: [Groff] pspic: Text around picture?
Date: Mon, 27 Dec 2010 16:51:54 +0000

In rfloat.tmac need to take environment attributes into account.
For example line length (this works for raw troff without a
macro package):

> >
> > .\" rfloat.tmac
> > .\"
> > .
> > .
> > .\" rfloat <image> <in-paragraph>
> > .\"
> > .\" Position an image to the right so that text is floating around  
> > the image.
> > .\" We assume that there is enough vertical space available for
> > the image.
> > .\"
> > .\" If there is a second argument, start the image one line
> > below. This is
> > .\" necessary if `rfloat' is called in the middle of a paragraph.
> > .\"
> > .\" The horizontal separation between the image and the floating  
> > text is
> > .\" given in register `\n[rfloat-hori-sep]' (set initially to 1m),
> > the .\" vertical separation in register `\n[rfloat-vert-sep]' (set  
> > initially
> > .\" to 0v since we measure from the base of the current line).
> > .
> > .de rfloat-macro-end
> > ..
> > .
> > .nr rfloat-hori-sep 1m
> > .nr rfloat-vert-sep 0v
> > .
> > .de rfloat
> > .  ie '\\$2'' \
> > .    nr rfloat-in-par 0
> > .  el \
> > .    nr rfloat-in-par 1
> > .
> > .  ev rfloat-env
> > .    di rfloat-div
> > .      PSPIC -L \\$1
> > .    di
> > .  ev
> > .
> > .  \" The vertical and horizontal dimensions of the image are now  
> > stored in
> > .  \" \n[dn] and \n[dl], respectively.  We disable vertical traps
> > so that we
> > .  \" can safely return to the current position.
> > .  nr rfloat-width \\n[dl].  nr rfloat-ll \\n[.l]
> > .  nr rfloat-start \\n[nl]
> > .  nr rfloat-end (\\n[nl] + \\n[dn] + \\n[rfloat-in-par]v)
> > .
> > .  vpt 0
> > .  mk
.  nr rfloat-ll \\n[.l]
> > .  ev rfloat-div-env
.    ll \\n[rfloat-ll]u
> > .    in (\\n[.l]u - \\n[rfloat-width]u)
> > .    sp +(\\n[rfloat-vert-sep]u + \\n[rfloat-in-par]v)
> > .    rfloat-div
> > .    sp +\\n[rfloat-vert-sep]u
> > .    in
> > .  ev
> > .  rt
> > .  vpt 1
> > .
> > .  \" Reduce right margin.
> > .  ll -(\\n[rfloat-width]u + \\n[rfloat-hori-sep]u)
> > .
> > .  \" Define macro to reset right margin and to remove trap.
> > Since the
> > .  \" effect of `.ll' is delayed until the current partial line is  
> > emitted,
> > .  \" we position the trap one line higher.
> > .  de rfloat-end-trap rfloat-macro-end
> > .    ll
> > .    wh (\\n[rfloat-end]u - 1v)
> > .  rfloat-macro-end
> > .
> > .  \" Set trap.
> > .  wh (\\n[rfloat-end]u - 1v) rfloat-end-trap
> > ..
> > .
> > .
> > .\" Adjust PSPIC to provide a correct width within a diversion.
> > .am PSPIC
> > .  vpt 0
> > \h'(\\n[ps-offset]u + \\n[ps-deswid]u)'
> > .  sp -1
> > .  vpt 1
> > ..
> > .
> > .
> > .\" Prepare environments.
> > .ev rfloat-env
> > .  in 0
> > .  ti 0
> > .ev
> > .
> > .ev rfloat-div-env
> > .  in 0
> > .  ti 0
> > .ev
> > .
> > .\" eof

Denis


-- 
()  ascii ribbon campaign - against html e-mail 
/\  www.asciiribbon.org   - against proprietary attachments



reply via email to

[Prev in Thread] Current Thread [Next in Thread]