+(define (format-time-element time-sig)
+ (cond ((number-pair? time-sig)
+ (format-time-fraction (list (car time-sig) (cdr time-sig))))
+ ((pair? (cdr time-sig))
+ (format-time-fraction time-sig))
+ (else
+ (format-time-numerator time-sig))))
+
+(define (format-time-list time-sig)
+ (make-override-markup '(baseline-skip . 0)
+ (make-line-markup
+ (insert-markups (map format-time-element time-sig)
+ (make-vcenter-markup "+")))))
+
+(define (format-compound-time time-sig)
+ (make-number-markup
+ (cond
+ ((number? time-sig) (format-time-element (list time-sig)))
+ ((number-pair? time-sig)
+ (format-time-element (list (car time-sig) (cdr time-sig))))
+ ((pair? (car time-sig)) (format-time-list time-sig))
+ (else (format-time-element time-sig)))))
+
+(define-markup-command (compound-meter layout props time-sig)
+ (number-or-pair?)
+ #:category music
+ "Draw a numeric time signature.
+
+@lilypond[verbatim,quote]
+\\markup {
+ \\column {
+ \\line { Single number: \\compound-meter #3 }
+ \\line { Conventional: \\compound-meter #'(4 . 4)
+ or \\compound-meter #'(4 4) }
+ \\line { Compound: \\compound-meter #'(2 3 8) }
+ \\line { Single-number compound: \\compound-meter #'((2) (3)) }
+ \\line { Complex compound: \\compound-meter #'((2 3 8) (3 4)) }
+ }
+}
+@end lilypond
+"
+ (interpret-markup layout props (format-compound-time time-sig)))
+
+(add-simple-time-signature-style 'numbered make-compound-meter-markup)
+
+(add-simple-time-signature-style 'single-digit
+ (lambda (fraction) (make-compound-meter-markup (car fraction))))