[Top][All Lists]

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

Re: [Groff] ms Section Heading String

From: Larry Kollar
Subject: Re: [Groff] ms Section Heading String
Date: Wed, 24 Dec 2003 10:38:34 -0500

   I writing a book using the ms macro package.  I'd like the even page
footer to contain the section title associated with the most recent .NH
call.  What string must I reference?

Unfortunately, the .NH macro doesn't store the section title anywhere.
What you'll need to do is define your own heading macro like this:

.\" $1 is the heading level, $2 is the title
.de H
.ds SecTitle \\$2
.NH \\$1

.EF '\\\\*[SecTitle]'middle'right'
.H 2 "Some heading here"

puts the section title in your footer. Note that there's *four* backslashes in front of SecTitle; that's required to get the current value of the string
instead of whatever is in the string when you call the EF macro.

I tried this with a short -ms document I had laying around, and it works. The only problem is that if a first thing on an odd page is a heading, you may (i.e. probably will :-) see its title in the footer on the previous page. You can insert a .bp in front of those headings to force groff to output the
page before processing the next section.

If you have to use canonical -ms for whatever reason, you'll have to
modify the @NH and @LP commands to copy section titles into a
diversion or something.

Hope that helps,
Larry Kollar     k  o  l  l  a  r  @  a  l  l  t  e  l  .  n  e  t
Unix Text Processing: "UTP Revival"

reply via email to

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