I am attempting to create a lilypond markup command which will display a guitar chord fingering above the chord on a stave. The code I have so far follows:

#(define-markup-command (chord_and_fingering layout props
  chord fingering) (ly:music? string?)
  (interpret-markup layout props
    #{ \markup { \center-column {
      \fret-diagram #(string-append "f:1;h:13;" fingering)
      \score {
        \new Staff {
          \clef "treble_8"
          \set fingeringOrientations = #'(left)
          #chord \bar "|."
        \layout {
          \override Staff.TimeSignature #'stencil = ##f
          \override Staff.Clef #'transparent = ##t

It works okay, but I cannot figure out how to pass a music expression directly to it. That is, I can use it like this with a temporary variable:

a_C_major_chord = {
  <c-3 e-2 g-0 c'-1 e'-0>1

a_C_major = \markup {

But would like to use it like this, without:

a_C_major = \markup {
    #{<c-3 e-2 g-0 c'-1 e'-0>1}

This however doesn't work. Could someone tell me where I am going wrong and what is the correct syntax for this?

Thank-you for your time and help.

1 Answer 1


Well, you can use either

\notemode {<c-3 e-2 g-0 c'-1 e'-0>1}

or (you were almost there)

##{<c-3 e-2 g-0 c'-1 e'-0>1#}

Remember: # throws you from LilyPond input modes into Scheme and #{ introduces stuff in LilyPond syntax into Scheme. Here you are combining both and so need ##{ at the start.

  • That's great. \notemode doesn't seem to work for me here, but the alternative is perfect, there's just a small typo in your answer; the closing } in the second example must also be pre-fixed with a # so ##{...#} is the construct. Thanks for the help.
    – tjm
    Jul 10, 2017 at 10:02

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.