2

I've been struggling with doing some \markups inside \figuremode because I would like to define some commands or functions to include all the boilerplate code inside.

For example, trying to put parentheses around some 'figure number, this code is working:

\version "2.20.0"
#(define-markup-command (parsis layout props strNumber) (string?)
   (interpret-markup layout props
                     (markup #:fontsize -2 (#:number (#:parenthesize strNumber)))))
<<
{\clef bass g2 g2}

\new FiguredBass {
  \figuremode {
    \bassFigureExtendersOn
    <7 \markup \parsis "6">2
    <7 5>2
  }
}
>>

The problem is I would like to call directly the command without the previous \markup, as:

<7 \parsis "6">2

But I have not succeeded. I tried to define some music-function or scheme-function which called \parsis, following the directions of these questions:

Modify markup with a scheme function

lily-scheme function to display a chord both as music and as markup

I even tried to follow the instructions given at Lilypond tutorial for Scheme:

https://lilypond.org/doc/v2.24/Documentation/extending/doubling-a-note-with-slurs-_0028example_0029

If anyone could give me some piece of advice I would be very grateful.

(Another less important question is I cannot call the argument as a number, but it works as a string).

3
  • Your code works with version 2.24, but you have to change the fontsize to -4 to get it to match with the other figures. Commented Apr 30 at 11:40
  • Another option is to just use square brackets, as seen in the documentation: lilypond.org/doc/v2.23/Documentation/notation/… Commented Apr 30 at 11:47
  • @ElementsInSpace Yes, the code works but I would like to include the \markup statement within a function or command to make the code cleaner and clearer. I am also already using the brackets for another purpose. Thank you.
    – Mike Music
    Commented Apr 30 at 13:17

1 Answer 1

2

You are creating a scheme command. This is not a regular function, but a special command used in \markup ... that is evaluated at a later point. Rather than doing that you want to create an actual function that returns a markup:

parsis =
#(define-scheme-function (strNumber) (string?)
   (markup #:fontsize -2 #:number #:parenthesize strNumber))

This allows you to do \parsis "6". You will still find that \figuremode does not expect to resolve a function within <...>, which is why you’ll need to directly evaluate this function from scheme:

<<
{\clef bass g2 g2}

\new FiguredBass {
  \figuremode {
    \bassFigureExtendersOn
    <7 #(parsis "6")>2
    <7 5>2
  }
}
>>
3
  • Is there any way you can get the function to accept the number 6 (as apposed to "6")? Commented May 2 at 10:45
  • @ElementsInSpace Yes. Change the predicate string? to number? and use (number->string ...) instead. Or use the predicate scheme? and use (format #f "~a" ...) to allow everything and hope it works out.
    – Lazy
    Commented May 2 at 12:03
  • 1
    Everything works perfectly, also with the numerical argument. I leave the code written explicitly for this last case: parsis = #(define-scheme-function (nNumber) (number?) (markup #:fontsize -2 #:number #:parenthesize (number->string nNumber)))
    – Mike Music
    Commented May 2 at 13:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.