lilypond-user
[Top][All Lists]
Advanced

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

Re: Creating markup macros (functions actually)


From: Paul Scott
Subject: Re: Creating markup macros (functions actually)
Date: Sat, 27 Nov 2004 04:35:49 -0700
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5

Nicolas Sceaux wrote:

Paul Scott <address@hidden> writes:

Ok, that looks pretty simple but I'm not quite sure yet how to combine
my two definitions so I won't have to type '\markup' each time.  (see
below).

Even so I would like to understand the scheme code.  I have been
searching through the scm directory trying to make sense of all of
this.  In scm/translation-functions.scm I found references to
numerator and denominator which are listed as properties in the
manual.

1. Is that code actually referring to the same properties listed in
the manual?

If you mean the manual page
http://lilypond.org/doc/v2.5/Documentation/user/out-www/lilypond-internals/Music-properties.html
then absolutely. Music expressions (that you manipulate when using
a music function) have properties, which can be accessed with
`ly:music-property'.
Does this make any sense?

#(def-markup-command (testOne layout props) ()
 (interpret-markup layout props
  (markup #:number
   (lambda (x) (ly:music-property x 'numerator)))))

2. In that same file there is a reference to 'make-bold-markup' but I
can't find it's definition anywhere.  I thought that might help me
discover how to define 'one' so I can do R1*3/4^\one as you have
suggested.

The `def-markup-command' macro does a couple of thing:
- it "registers" the command, so that the parser can know what to do
when \markup \MYCOMMAND ... is encountered
- it defines a make-MYCOMMAND-markup function
- some internal things, such as the actual markup function
definition.

When the \bold markup command is defined with def-markup-command, a
`make-bold-markup' function is also defined, that you can use to
programmatically build a bold markup: (make-bold-markup "foo"). Note
that this is equivalent to writing: (markup #:bold "foo").
Thanks.

See scm/new-markups.scm.
I'll keep reading this but I don't understand it yet. Can you recommend any online reading to understand scheme better?


Note that in the case of \one, something like
  one=\markup \number 1
will be enough!
Ok.  Thanks,

Paul





reply via email to

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