groff
[Top][All Lists]
Advanced

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

Re: [Groff] MS: Keeping the TOC


From: Tadziu Hoffmann
Subject: Re: [Groff] MS: Keeping the TOC
Date: Fri, 26 Mar 2010 11:26:32 +0100
User-agent: Mutt/1.5.17 (2007-11-01)

> I want the headers (.NH) automatically create TOC entries,
> for which reason, right in my document's file, I defined
> the following macro:
> 
> .de HD
> .NH \\$1
> \\$2
> .XS
> \\$2
> .XE
> ..
> 
> which creates both a header and a TOC entry for it, so I
> would no longer bother about the actuality of my TOC.
> 
> My problem is that even an empty document like this:
> 
> .TC
> 
> creates one empty TOC entry, as if groff interprets the
> .XS ... .XE pair inside the definition of .HD like actual
> commands... Am I doing something wrong? Is it incorrect to
> define additional macros inside the document's file? Where
> to define it then?

In the GNU ms macros, the name "HD" seems to be reserved
for a user-supplied page header and/or footer macro, which
(if it exists) gets called at some place during the page
initialization.  Since you have defined HD, this gets called,
and in turn calls XS and XE but with no useful text (since
\\$2 is empty if HD is called without arguments), thus
creating the empty TOC entry.

So, to answer your question: it is okay to define macros
in the document, but you have to be careful to choose names
which are not already used (unless you want to overwrite a
particular macro on purpose).






reply via email to

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