lilypond-user
[Top][All Lists]
Advanced

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

Creating TOC entry / page reference from inside a markup


From: Reinhold Kainhofer
Subject: Creating TOC entry / page reference from inside a markup
Date: Mon, 19 May 2008 18:05:27 +0200
User-agent: KMail/1.9.9

How can I add a TOC entry from inside a markup (or from a markup function)? 

I tried 
#(define-markup-command (piece-title layout props title) (markup?)
  (add-toc-item! 'tocItemMarkup title)
  (interpret-markup layout props (markup #:bold title))
)
but that does not add anything to the TOC :-(((

Nicolas' workaround is to call collect-music-for-book: 

#(define-public (add-toc-item parser markup-symbol text)
  (collect-music-for-book parser
   (add-toc-item! markup-symbol text)))

but for this approach I need the parser, which I do not have available in the 
markup command..
The reason I want this is that I automatically want all score titles to appear 
in the TOC, without having to duplicate the titles and manually insert loads 
of tocItem calls. 




Similarly, how can I add a reference to a position inside a markup? I tried
    \markup { Some interesting point \label #'refA. }
    \pageBreak
    \markup { As mentioned on page \page-ref #'refA "0" "?", there is 
      something interesting. }
but this only give a syntax error (syntax error, unexpected MUSIC_FUNCTION).

Of course, this example is stripped down and thus trivial and should better be 
written with \label outside the markup, but I have a preface with ~6 pages 
consisting of one \markuplines (the long biography of the composer and 
description of the work) and want to reference one thing mentioned in there 
later on in the score.


So, how can I add a TOC entry and a label from inside a markup function (both 
are really just the same problem)? A sample lilypond file is attached.

Thanks,
Reinhold
-- 
------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: address@hidden, http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/

Attachment: toc.ly
Description: Text Data

Attachment: toc.pdf
Description: Adobe PDF document


reply via email to

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