groff
[Top][All Lists]
Advanced

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

Re: [Groff] .br after .box *invariably* generates an output line?


From: Tadziu Hoffmann
Subject: Re: [Groff] .br after .box *invariably* generates an output line?
Date: Fri, 1 Mar 2013 20:15:32 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

I'm not sure why we actually need the box request, since the
desired functionality can be achieved with the macros below
(and they don't create a blank line if the box is empty!).

They circumvent the problem of the existing partially filled
line by starting a new environment.  The only caveat with
this approach is that an environment carries with it its own
font size, line length, etc., so their values might need
to be set explicitly when first entering the environment.
On the other hand, this is not necessarily a bad idea,
for example when creating framed boxes in which the line
length needs to be a bit shorter anyway.


.\"
.\" ------------------------------------------------------------------------
.\" wrapper
.de box
.ie '\\$1'' .EB
.el         .BB \\$1
..
.\" begin box
.de BB
.ev \\$1
.di \\$1
..
.\" end box
.de EB
.br
.di
.ev
..
.\" print box
.de PB
.ev \\$1
.nf
.\\$1
.fi
.ev
..
.\" print box (variant)
.de PB1
.nf
.\\$1
.fi
..
.\" ------------------------------------------------------------------------
.sp 2c
Before the box.
.BB XX
.gcolor red
In the box.
.EB
.PB XX
After the box.
.sp 2c
Before the box.
.BB XX
.gcolor red
In the box.
.EB
.PB1 XX
After the box.


The "box" macro is not necessary if you prefer separate begin
and end box macros; it only serves to provide an interface
with a similar syntax as the box request. Also, if you do not
intend to nest boxes, you can hardcode the environment name
(or number) and the diversion name, and always recycle those.





reply via email to

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