groff
[Top][All Lists]
Advanced

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

RE: [Groff] how to write this section-break macro?


From: Ted Harding
Subject: RE: [Groff] how to write this section-break macro?
Date: Fri, 28 May 2004 13:24:32 +0100 (BST)

On 26-May-04 Dorai Sitaram wrote:
> I'd like to write a section-break macro, say .SB, with the following
> properties:
> 
> (1) If the break occurs in the middle of a page -- i.e., with pre-break
> and post-break text on the same page -- then the break is representated
> as some tell-tale vertical space.
> 
> (2) If however the break occurs at a page break, then the new page
> starts with an ornament, such as a centered ***.
> 
> The rationale for (2) is that we need some indication that the section
> break occurred -- since there is no vertical space marking it. 
> 
> Any ideas would be much appreciated.  I think groff must have enough
> registers that can be checked to pull this off, except I don't know
> which.

The register ".t" contains the distance to the next vertical position
trap, and there is normally one of these at the foot of the page.
So, if you have no other traps lurking, the following basic ".SB" 
seems to work.

I've written it on the assumption that you don't want a single line
from the top of the next Section at the bottom of the page. You should
either get a single line space followed by 2 or more lines of the next
section at the bottom of the page or, if there is not room for this,
a page break (leaving 0, 1 or 2 blank lines at the bottom) and then
the next section preceded by "* * *" at the top of the page and a
half-line space.

Tested using 'ms' macros.

.de SB
.ie \\n[.t]<3v \{
. bp
. ce
* * *
.sp 0.5v
.\}
.el .sp
..

I hope this helps!
Ted.


--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 27-May-04                                       Time: 20:46:52
------------------------------ XFMail ------------------------------

--------------------------------------------------------------------
E-Mail: (Ted Harding) <address@hidden>
Fax-to-email: +44 (0)870 167 1972
Date: 28-May-04                                       Time: 13:24:32
------------------------------ XFMail ------------------------------


reply via email to

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