groff
[Top][All Lists]
Advanced

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

Re: [Groff] delayed


From: Jon Snader
Subject: Re: [Groff] delayed
Date: Wed, 9 Jul 2003 14:27:18 -0400
User-agent: Mutt/1.4.1i

On Wed, Jul 09, 2003 at 03:02:49PM +0100, Mohammad Razwan wrote:

> First of all: thanks are in order for both yourself and Tadziu. I'll give 
> your suggestions a try.
> 
> Second: I am using -ms, would it not be easier to call .PT from .BT after 
> suitably modifying .PT and .BT. And what about marking the place in macro 
> address@hidden where .PT is normally called and then returning there from .BT
> 
> I tried that the other day and I couldn't get that to work. Is that something 
> to do with .PT being called in an environment, or maybe I just made a mistake?
> 
> Finally, I noted the same "mistake" the other day from a textbook done in 
> troff that the current header did not reflect the situation on the current 
> page, unless it was intended that way.
> 

You probably won't like it, but I'll tell you how I do this.  I got the
method from Rich Stevens who used it in all his books.  First modify
your chapter and section macros to output (via .tm) lines of the sort
    CH: 3 Another Boring Chapter 79
where the fields are tab delimited and this is an entry for chapter 3
entitled ``Another Boring Chapter'' that starts on page 79.

Then postprocess this with a (say) awk script to produce a file that
has lines like:

        .ds O1Hdr79 Another Boring Chapter
        .ds O2Hdr79 Chapter 3
        .ds E1Hdr80 Section 3.1
        .ds E2Hdr80 A Boring Section in a Boring Chapter

This file gets included at the beginning of your troff source.

Finally, for your PT macro you have calls to .tl that look something
like this:

.if e .tl @\s9\fB\\n%\fP\h'2m'\\*[E1Hdr\\n%]\s0@@\s9\\*[E2Hdr\\n%]\s0@
.if o .tl @\s9\\*[O1Hdr\\n%]\s0@@\s9\\*[O2Hdr\\n%]\h'2m'\fB\\n~\fP\s0@

The tricky part, as others have said, is what you do in the awk script.
The nice thing is, you can enforce any policy you like (first section
on page goes into header; last section on page goes into header).

Obviously we're talking about a multipass process here, but I do it all
with makefile magic, and it's pretty much transparent.

jcs

reply via email to

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