On 22-Feb-08 11:05:46, Michael(tm) Smith wrote: > Werner LEMBERG <[EMAIL PROTECTED]>, 2008-02-22 10:56 +0100: > >> > Is there an recommended way to create a background in an alternate >> > color for a certain block of text? >> >> First, you have to draw a coloured rectangle, then you must type the >> text. To get the dimensions of the text block, store the text in a >> diversion, get its height and width, then insert the diversion. > > I'm wondering if as starting point, I could copy the ms B1/B2 > macros and modify those? Or is it the case that those are just > drawing lines/borders instead of drawing an actual rectangle > (sorry, I ask because I don't know if there is a distinction in > groff between drawing a box and drawing a rectangle).
As B1/B2 are written, they simply draw the box as a series of lines, using \D'l .... '. This does not create a "closed object" which can be filled. However, if you use \D'P ... ' you will draw a polygon which will be filled (\D'p ... ' draws a polygon which will not be filled). In order to get the effect (I think) you want, you will also need to a) Before drawing the ploygon, set the colour to white so that the border is invisible; b) Set the "grey-level" of the fill using \Z'\D'f N'' where N is between 0 (white) and 1000 (black) [The \Z'...' is there to enforce zero motion -- otherwise \D'f N' causes a motion of amount Nu). c) Then draw the polygon using \D'P ... '; the result will be a grey-filled polygon with no visible border. d) Re-set the colour and the grey-level for filling before continuing. I don't have time just now to fill in the details of the above; can do it later. But you may be able to work it out yourself from the above outline! Best wishes, Ted. >> > So I'm wondering if I might be able to achieve a similar effect in >> > the PS output from DocBook-generated man pages. >> >> Well, in case the text blocks are marked as such, this is doable. But >> there is no standard way to do so in man pages. However, the next >> groff release will propagate the `.EX/.EE' block for examples in man >> pages (this is in an-ext.tmac). You could redefine them accordingly. > > OK, thanks > > --Mike > > -- > Michael(tm) Smith > http://people.w3.org/mike/ > http://sideshowbarker.net/ -------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 22-Feb-08 Time: 11:33:20 ------------------------------ XFMail ------------------------------