Hello, > It may help your understanding to know > that \tweak itself is implemented as a music function taking 3 arguments.
> The syntax of \tweak is > \tweak symbol value music_expression OK, thank you, that's very clear. That fact, for any given keyword, would tell a user immediately whether (s)he could just write a macro or would be forced to define a function for some expression involving the keyword. Is the information (1) number of arguments or preferably (2) the syntax documented explicitly anywhere for all keywords? I don't write to this list much, but I would like to thank you for the concise and clear answers you have provided to so many questions. -- Tom ------------------------------------------------------------ On Thu, 30 Nov 2006, Mats Bengtsson wrote: > > > [EMAIL PROTECTED] wrote: > > Hello, > > > > > >>> Does it work just to define this macro at the top level > >>> > >>> fraction = \tweak #'text #tuplet-number::calc-fraction-text > >>> > > > > > >> No, this doesn't work. > >> > > > > OK, but I have a question. It is common to write such things as > > > > push = \once \override NoteColumn #'extra-X-extent = #'(0 . 2) > > > > and then later to use \push before a note in the music. > > However the above definition of fraction doesn't yield a valid > > \fraction macro call, as you pointed out. > > > > Is there any clear criterion for knowing in advance whether a given > > expression for a macro definition will actually work? > > > > > The syntax of \tweak is > \tweak symbol value music_expression > where music_expression is the music expression you want the tweak to > apply to. You can only define a macro for a complete syntactical expression > (I know that this is a somewhat vague definition), whereas you tried to > define a macro for only half of it. It may help your understanding to know > that \tweak itself is implemented as a music function taking 3 arguments. > > What I get out of your function definition of fraction (below) is that > > \fraction is intrinsically a function that has to be followed by a music > > argument. But even though > > > > \once \override NoteColumn #'extra-X-extent = #'(0 . 2) > > > > would have to be followed by a note to make any sense, that doesn't > > seem to make it a function-with-one-argument. I accept the fact that > > > > \tweak #'text #tuplet-number::calc-fraction-text > > > > *is* a function-with-one-argument, but in general how is one supposed to > > know whether a given expression is just a state-creator or it's a > > function-with-one-or-more-arguments? > > > > > The only strict definition of the input syntax is the source code of the > parser > lily/parser.yy in the source code tree. Also, more and more features of the > syntax are implemented as music functions instead of being hard coded > into the parser, so it's not entirely easy to figure out, apart from > using trial > and error. > > /Mats > _______________________________________________ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user