bug-lilypond
[Top][All Lists]
Advanced

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

Re: wrong page-numbers


From: David Kastrup
Subject: Re: wrong page-numbers
Date: Tue, 11 Oct 2016 23:26:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Thomas Morley <address@hidden> writes:

> With this code
>
> \markuplist \table-of-contents
> \bookpart { { \tocItem "on-page-2" 1 \pageBreak \tocItem "on-page-3" 1 } }
> \bookpart { { \tocItem "on-page-4" 1 } }
>
> The table-of-contents displays partly wrong page-numbers, see cut-off
> png attached.
>
> I first noticed it in 2.19.49 but I followed it back to 2.14.2, my
> oldest installed version. It may very well exist even longer.
>
> Some analysis:
>
> Adding
>   (format #t "\n(toc-items)\n~y" (toc-items))
> at appropriate place in table-of-contents from toc-init.ly returns:
>   ((toc97 tocItemMarkup "on-page-2")
>    (toc98 tocItemMarkup "on-page-3")
>    (toc99 tocItemMarkup "on-page-4"))
> which is correct so far and at first sight.
>
> Further adding
>   (display-scheme-music (ly:output-def-lookup layout 'label-page-table))
> at appropriate place in page-ref from define-markup-commands.scm
> returns 3 instances of
> (list (cons (quote toc97) 2)
>       (cons (quote toc98) 2)
>       (cons (quote toc98) 3)
>       (cons (quote toc99) 4))
> Ofcourse it's clear why it is displayed three times, but why two
> elements with toc98?? One with the correct page-number, the other is
> wrong!
>
> I don't understand why there are _four_ entries in this list.
> And if four, why does the gensym-procedure used in toc-init.ly does
> not _warrant_ different naming??

In lily/page-breaking.cc I read

  // By reversing the table, we ensure that duplicated labels (eg. those
  // straddling a page turn) will appear in the table with their last
  // occurence first.
  label_page_table = scm_reverse_x (label_page_table, SCM_EOL);
  book_->top_paper ()->set_variable (ly_symbol2scm ("label-page-table"), 
label_page_table);

At the start of the routine, however, the previous value of
label-page-table is loaded which already has been reversed.

So the "duplicated labels" fix by reversing the list would seem to work
only for every second instance of calling the functions since the
reversals happen back and forth.

-- 
David Kastrup



reply via email to

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