lilypond-user
[Top][All Lists]
Advanced

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

Re: enlarge vertical distance in time signature


From: pabuhr
Subject: Re: enlarge vertical distance in time signature
Date: Mon, 29 Oct 2012 22:39:18 -0700

   I consider it much nicer to make "strg" of type fraction?, and then num
   can be (car strg) and denom can be (cdr strg).
   and
   can just be \spreadTimeSignature #8 2/4 ... which is nicer on the eyes.

I was intrigued and tried to modify the code as you suggested as a learning
exercise. But I ran into a problem I do not understand. I assumed that fraction
is a pair of two numbers, so num and denom are of type number. "column" needs
strings so the numbers have to be converted. However, I get the following
error:

test12.ly:18:25: error: syntax error, unexpected NUMBER_IDENTIFIER
         (number->string 
                         $num)
/usr/local/lilypond/usr/share/lilypond/current/ly/init.ly:61:0: error: error in 
#{ ... #}

I think I'm close but missing some subtle issue about the types.

============================================================================================

\version "2.16.0"
\language english
#(set-global-staff-size 30)

spreadTimeSignature =
#(define-music-function (parser location baselineSkip strg music)(number? 
fraction? ly:music?)
  (let* ((num (car strg))
         (denom (cdr strg)))
   #{
   \override Staff.TimeSignature #'stencil =
   #(lambda (grob)
     (grob-interpret-markup grob
      #{
      \markup %\fontsize #5
      \vcenter
      \override #`(baseline-skip . ,baselineSkip)
      \column {
         (number->string $num)
         (number->string $denom)
      }
      #}))
   $(make-music 'TimeSignatureMusic 'beat-structure '() 'denominator denom 
'numerator num)
   $music
   #}))

% ---------------- test

\relative c' {
  \spreadTimeSignature #3 2/4
  c8 c c c

  \spreadTimeSignature #8 3/4
  c16 c c c   c c c c c4
}



reply via email to

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