[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: how to alias commands?
From: |
Lukas-Fabian Moser |
Subject: |
Re: how to alias commands? |
Date: |
Sat, 31 Dec 2022 12:45:06 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 |
Hi Kenneth,
Am 31.12.22 um 11:26 schrieb Kenneth Flak:
Is there a way to alias a command in lilypond? F.x. I would like to substite
`\markup \rN` with simply `\rn`. Defining `rn` as a variable doesn't work, so
what are the ways?
Usually it does actually work:
\version "2.24.0"
something = \trill
{
a'4\something
}
The problem is that \rN (I assume you refer to David Nalesnik's roman
numeral library) is a markup function, and these are special. If you
want to have a shorthand for situations where you use \markup \rN ... in
music (or lyrics), you can do:
rN = #(define-scheme-function (arg) (markup?) (markup #:rN arg))
For example:
\version "2.24.0"
% Some arbitrary definition of rN as a markup command
#(define-markup-command (rN layout props arg) (markup?)
(interpret-markup layout props
#{ \markup { \huge \italic #arg } #}))
rN = #(define-scheme-function (arg) (markup?) (markup #:rN arg))
{
a'-\rN Text
}
\new Lyrics \lyricmode {
\rN test
}
I'm not 100% sure if there might be some disaster lurking if you (like
me) take the exact name of the markup function for the shorthand; if you
want to be on the safe side, just take a different name (like rn, as you
proposed).
Lukas