groff
[Top][All Lists]
Advanced

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

Re: [Groff] A less than trivial indexing problem and an erroneous soluti


From: Werner LEMBERG
Subject: Re: [Groff] A less than trivial indexing problem and an erroneous solution
Date: Sat, 16 Mar 2002 08:03:10 +0100 (CET)

Sorry for answering late, but your examples showed up the .asciify
bug in the latest versions of groff which I had to fix first.

Please get the latest CVS version for testing.

> A test document using them can be found below. It formats correctly,
> but the strings \*[tit] and \*[per] are printed empty to the output
> stream, and my question is: Why?

You are missing two .br statements to flush the final partially filled
lines to the diversion.  I've added some comments below.

> .open TEST test.txt
> .de title
> .di tit
> ..
> .de /title

Here you have to insert `.br'.  But `.di' includes the current partial
outline line also which is not what you want.  `.box' is your
friend...

> .di
> .asciify tit
> .write TEST title: \\*[tit] ... \\n[PN]

`.write' will fail if the diversion is longer than a single line.
`.writem' will do the trick.

> .tit
> ..
> .de person
> .di per
> ..
> .de /person

Here you have to insert `.br'.

> .di
> .asciify per
> .write TEST person: \\*[per] ... \\n[PN]
> .per
> ..
> .LP
> The
> .title
> .person
> Karen Ludvigsdatter Rosenkrantz
> ./person
> Prayer book
> ./title
> contains a
> .title
> Book of hours,
> ./title
> and a
> .title
> Calendar
> ./title

Here a working solution, using `box' and `writem'.  It would be
possible to further refine it to get single lines in the auxiliary
files.  Note that your solution with `.de' doesn't work recursively.

The use of `å' is for demonstration purposes only.


    Werner


======================================================================

.open TEST test.txt
.
.de title
.  box tit
..
.
.de /title
.  br
.  box
.  asciify tit
.  write TEST title:
.  writem TEST tit
.  write TEST ... \\n[PN]
.  tit
..
.
.de person
.  box per
..
.
.de /person
.  br
.  box
.  asciify per
.  write TEST person:
.  writem TEST per
.  write TEST ... \\n[PN]
.  per
..
.
.LP
The
.title
.person
Kåren Ludvigsdatter Rosenkrantz
./person
Prayer book
./title
contains a
.title
Book of
.title
hours
./title
./title
and a
.title
Calendar
./title

reply via email to

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