lilypond-user
[Top][All Lists]
Advanced

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

Re: Cannot pass number variable to \markup.


From: Jean Abou Samra
Subject: Re: Cannot pass number variable to \markup.
Date: Sun, 07 May 2023 16:15:13 +0200
User-agent: Evolution 3.48.1 (3.48.1-1.fc38)

Le dimanche 07 mai 2023 à 10:09 -0400, dfro a écrit :

Hello, fellow music engravers.

I would like to pass a number variable to \markup, but my attempts are not working.

When I try to pass a number variable to \markup I get the following message:

"error: syntax error, unexpected NUMBER_IDENTIFIER".

Examples:

<code start> fontsize-number = #5 { c'1^\markup \fontsize \fontsize-number "text" }

<code end>

or,

<code start>

raise-number = #5 { c'1^\markup \raise \raise-number "text" }

<code end>

Could someone help me to comprehend how to do this?



That is... interesting, I wonder if we should treat it as a bug actually.

The thing is that

\markup \raise 5 "text"

does not work because "5" in markup mode is not a number but the raw string made of the digit character 5. Due to the internal way the backslash works, this extends to \raise-number, even though there is no reason in this case.

Anyway, use the form

\version "2.24.1"

fontsize-number = #5
{ c'1^\markup \fontsize #fontsize-number "text" }


where "#" switches to Scheme mode in order to access the variable, just like \markup \raise #5 ... uses Scheme to write the number.

Jean

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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