4

I am preparing in LilyPond a music book divided into many sections, each having a title. I want to keep the formatting of all titles in a single place, to make future format changes easier, and know two methods to do so: using \define-scheme-function, and using \define-markup-command -

#(define-markup-command (section_title_MC layout props text) (markup?)
  (interpret-markup layout props
   #{ 
     \markup \bold \fontsize #3 { #text } 
   #}))

section_title_SF = #(define-scheme-function
     (parser location text)(markup?)
   #{
      \markup \column {
      \bold \fontsize #3 { #text }
      }
   #})

\markup \section_title_MC "Etudes in C Major"

{
  \key c \major
  c'1
}
  

\section_title_SF "Etudes in G Major"

{
  \key g \major
  g'1
}

result of above code, showing titles

My problem is that neither method seem to respect music symbols, such as \flat and \sharp:

\markup \section_title_MC "Etudes in B \flat Major"

{
  \key bes \major
  bes'1
}

\section_title_SF "Etudes in E \flat Major"

{
  \key ees \major
  ees'1
}

result of above code, showing titles not rendering strings as desired

Compare this with “direct” markup:

\markup {\bold \fontsize #3 { Etudes in B \flat Major }}

{
  \key bes \major
  bes'1
}

result of above code, rendering markup

Will appreciate any help.

1 Answer 1

5

A string is a string.

#(define-markup-command (section_title_MC layout props text) (markup?)
  (interpret-markup layout props
   #{ 
     \markup \bold \fontsize #3 { #text } 
   #}))

section_title_SF = #(define-scheme-function
     (parser location text)(markup?)
   #{
      \markup \column {
      \bold \fontsize #3 { #text }
      }
   #})

\markup \section_title_MC \line { Etudes in \concat { B \raise #1 \flat } Major }

{
  \key bes \major
  bes'1
}


\section_title_SF \markup { Etudes in \concat { E \raise #1 \flat } Major }

{
  \key ees \major
  ees'1
}
0

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.