did anyone make an effort to enhance the pspic-macro, to text flows
around the picture, like that:
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxx +---------+ xxxxxxxxxxx
xxxxx | | xxxxxxxxxxx
xxxxx | | xxxxxxxxxxx
xxxxx | | xxxxxxxxxxx
xxxxx | | xxxxxxxxxxx
xxxxx | | xxxxxxxxxxx
xxxxx +---------+ xxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxx
AFAIK, no.
Should be "fairly easy", if I'm right:
Hmm.
pspic already extracts and calculates things. In the simple case of
left or right-aligned pictures, we need to change indent (or page
offset?) and (only, for right-aligned) pictures the line length and
add a small margin (configurable? register?) for a little space
around the picture.
We also need to to suppress local vertical motion according to the
picture height, so text should run around the picture just fine.
In theory, this sounds fairly easy, but see below.
Next task would be more complicated: When do we need to reset the
po/indent/ll? Is there something like a "new line trap" which gets
called every new line? So pspic can hook into that and if the
vertical motion difference beween the call of pspic and the actual
position (add the margin men- tioned before) is greater than the
picture height, we can reset the values to saved ones from before
the pspic-call.
It's much simpler: Just set (vertical) traps at the end of the image
to reset the margins.
A quick solution for an image which should appear exactly at the
position where it is inserted in the source is straightforward. It's
far more complicated to do the same for floating images: Just imagine
that an image no longer fits on the current page and has to be shifted
around...
· Handle text around centered or indented pictures,
Even TeX can't do this...
· Provide some mechanism to center a picture description text under
the picture (-L|-R|-I also) which also gets added to the margin
calculation ("makes picture taller"),
I don't really understand this. Please give an example.
· Provide similar mechanisms for PICtures
It's basically the same: Put the pic drawing into a diversion so that
its dimensions get calculated, which can then in turn be used to make
the text float around the image. However, there's the same problem as
with other images, namely, what to do if the pic drawing is larger
than the remaining space on the current page.
Below is a first simple try which you could use to start with.
Werner
======================================================================
.\" 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-start \\n[nl]
. nr rfloat-end (\\n[nl] + \\n[dn] + \\n[rfloat-in-par]v)
.
. vpt 0
. mk
. ev rfloat-div-env
. 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