Re: [Groff] colored background?

From:

Tadziu Hoffmann

Subject:

Re: [Groff] colored background?

Date:

Mon, 25 Feb 2008 10:36:36 +0100

User-agent:

Mutt/1.5.16 (2007-06-09)

> Is there a way I could modify it so that the filled box
> extends all the way across the whole line length? (i.e.,
> from the left margin / page offset to the right margin).
Sure. You mean like this?:
(If the boxed text itself uses .in, you may need to save the
indent of the surrounding text in a custom register in BB and
restore it in EB.)
.\" ----------------------------------------------------------------
.de BB
.br
.in 1n
.ll -1n
.di BX
..
.de EB
.br
.di
.in
.ll
.nr BW \\n(dl+1n
.nr BH \\n(dn+.5v
.ne \\n(BHu+.5v
.in 0
\M[grey90]\v'-.5v'\D'P \\n(BWu 0 0 \\n(BHu -\\n(BWu 0 0 -\\n(BHu'\M[]
.sp -.5v
.nf
.BX
.in
.sp .5v
.fi
..
.sp 3c
.ll 4c
Some text.
Some text.
Some text.
Some text.
.in +4n
Some text.
Some text.
Some text.
Some text.
.BB
Text in a box.
Text in a box.
Text in a box.
Text in a box.
.EB
More text.
More text.
More text.
More text.
.in -4n
More text.
More text.
More text.
More text.
.\" ----------------------------------------------------------------
> Also, when I process a doc with this, it displays as expected but
> I get a message saying "troff: automatically ending diversion `BX'
> on exit." Is there some tweak I need to make to eliminate that?
That shouldn't happen. Usually a message like this indicates
that you have a call to BB (which starts diverting into BX)
without a corresponding EB (which ends that diversion again).