lout-users
[Top][All Lists]
Advanced

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

Duplicate page numbers in index entries


From: Valeriy E. Ushakov
Subject: Duplicate page numbers in index entries
Date: Fri, 23 Oct 1998 20:23:00 +0400

On Fri, Oct 23, 1998 at 03:30:36PM +0200, Stephan Pabst wrote:

> Another, less serious problem are duplicate page numbers in the index.
> In some cases, when putting the same term twice into the index on one page,
> this causes the page number to appear twice in the index.  Currently a
> reduced version of the index has the following entries:
> 
>    Bundesanleihen   2, 7, 7, 9
>    Datenquellen
>      Handelsblatt   7, 9, 9
>    Postanleihen   2, 3, 5, 7, 7, 9
> 
> Although this problem disappears when I delete the corresponding index
> entries, I would be glad if there was an easier way to avoid duplicate
> page numbers.

The problem is the (wrong) way the @Merge works, see p.32 of the
expert's guide for details (2.8. Sorted Galleys).

The following document is the minimal test case for this bug:

    @SysInclude { langdefs }
    @SysInclude { fontdefs }
    @SysInclude { dl       }
    @SysInclude { docf     }
    
    @Use { @DocumentLayout @MakeIndex { Yes } }
    @Use { @OrdinaryLayout }

    @Doc @Text @Begin
    @LP Foo!
    foo @Index Foo
    foo @Index Foo
    @NP
    @LP Foo!
    foo @Index Foo
    foo @Index Foo
    @NP
    @LP Foo!
    foo @Index Foo
    foo @Index Foo
    @End @Text

It produces index entry:

          Foo, 1, 2, 2, 3


Here's what happens behind the scenes.  Consider stripped down version
of @Merge used to merge index entries:

    def @Merge left x right y {
      { x @Rump y } @Case {
        ""   @Yield x
        else @Yield {
          { { x @Rump y } @Common "," } @Case {
            ","  @Yield { x  &0s { x @Rump y } }
            else @Yield { x, &1s { x @Rump y } }
          }
        }
      }
    }


Folding "linearly" gives correct "Foo, 1, 2, 3":

    { Foo, 1 } @Merge { Foo, 1 } @Merge { Foo, 2 }
    @Merge { Foo, 2 } @Merge { Foo, 3 } @Merge { Foo, 3 }


Folding over a balanced tree, like Lout, does gives the wrong
"Foo, 1, 2, 2, 3":

    { {Foo, 1} @Merge { {Foo, 1} @Merge {Foo, 2} } }
    @Merge
    { {Foo, 2} @Merge { {Foo, 3} @Merge {Foo, 3 } } }


SY, Uwe
-- 
address@hidden                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen


reply via email to

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