Hello Jean Wow! Thank you for an excellent 9-minute response!
Already tested your solution and everything worked perfectly. You have saved me a lot of time typing AND increased the clarity of my code. I see: Scheme and Lilypond code. Aha. I understand. Thank you SO much for your detailed and helpful answer. Much appreciated. Jeremiah On Sun, Feb 20, 2022 at 3:34 PM Jean Abou Samra <j...@abou-samra.fr> wrote: > > > Le 20/02/2022 à 15:26, Jeremiah Reilly a écrit : > > I have a problem which I cannot figure out. > > > > Lilypond has a built-in function to engrave guitar fingerings in a score. > > > > The function works just fine, but is long and cumbersome to type, for > > example: > > > > \rightHandFinger #2 /(#2 = i = index finger)/ > > > > which fingers the attached note with the index finger label 'i'. > > > > I was able to follow the manual and create a shorthand for this function: > > > > #(define RH rightHandFinger) > > > > which works just fine, as illustrated with the following code (see > > attached score): > > > > #(define RH rightHandFinger) > > > > \new Staff \with { > > instrumentName = "Example" > > } > > > > \relative c' > > { > > \clef "treble_8" > > \key f \major > > \set strokeFingerOrientations = #'(up) > > a4\RH #2 c\RH #3 d\RH #2 e\RH #3 \bar "|." | > > } > > > > The code "\RH #2" is still more than I want to type. > > > > I want to create a fingering-function for the index finger as follows: > > > > \RHi (and similarly for all the fingerings i, m, a, and p). > > > > Can this be done? Am I missing a concept here? I tried: > > > > #(define RHi rightHandFinger #2) > > > > but this did not work. > > > > The LilyPond syntax for applying a command is > > \command arg1 arg2 > > In Schemeland, it doesn't work this way: you call functions. > The syntax for a call is > > (function arg1 arg2) > > Note the parentheses around the expression. LilyPond's > music functions happen to be callable as Scheme functions > too, so you should do > > #(define RHi (rightHandFinger 2)) > > or, probably simpler: > > RHi = \rightHandFinger 2 > > So why doesn't "RH = \rightHandFinger" work? Because \rightHandFinger > alone isn't a complete value, it's a command that expects further > arguments after it. However, you can use the syntax \etc to "cut" > the argument list and get a new function. Thus, > > RH = \rightHandFinger \etc > > is (for usual purposes) equivalent to > > #(define RH rightHandFinger) > > Best, > Jean > >