lilypond-user
[Top][All Lists]
Advanced

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

Re: Accessing header properties from ordinary markup


From: Reinhold Kainhofer
Subject: Re: Accessing header properties from ordinary markup
Date: Thu, 22 May 2008 22:13:07 +0200

Am Mittwoch, 21. Mai 2008 schrieben Sie:
> Le 21 mai 08 à 18:21, Reinhold Kainhofer a écrit :
> > [...] how can I access the header fields from a top-level markup?
>
> Book and score title are dealt with in a special way: when they
> are interpreted, the header variables are added to the properties
> provided to the command, which can then retrieve the header
> variables.

Ah, thanks for the thorough explanation and the implicit hint to RTFC...

> This is not the case of other markups. You may work around that
> by using variables defined in the paper block, and then retreiving
> them using the command layout argument.

The alternative is to implement a \markupWithHeader, which does exactly this: 
Add the variables defined in the header block to the props (i.e. mimicking 
the mark-up-title command) before interpreting the markup.

My attempt for this is attached and works quite well. The PDF is too large for 
the mailing list, so I uploaded it to our server:
http://www.fam.tuwien.ac.at/~reinhold/temp/using_header_fields_in_arbitrary_markup.pdf

The only problem I'm experiencing is that I can only pass markups stored in a 
variable, but not explicit markups. I.e. while

    testMarkup = \markup {Title: \fromproperty #'header:title }
    \markup \markupWithHeader \testMarkup

works, the following does not work

   \markup \markupWithHeader \markup {Title: \fromproperty #'header:title }


What's the difference of the two?

The other thing I'm missing is a way to retrieve the local header module if 
the markup is placed inside a score (see the score in the attached example). 
In particular, how can I get the score, so I can call ly:score-header on it? 
Currently, I'm only using the global header block...

Also, I suppose there is no way to get rid of the first \markup and simply use 
\markupWithHeader instead, since the parser checks for \markup explicitly and 
does a lot of stuff on it, right?

Cheers,
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: using_header_fields_in_arbitrary_markup.ly
Description: Text Data


reply via email to

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