Oh, please discard the attachment of the previous email, this one is the
current one ...
Am 08.05.2014 17:25, schrieb Urs Liska:
Hi David,
thanks for the assistance.
Am 08.05.2014 14:19, schrieb David Kastrup:
Urs Liska <u...@openlilylib.org> writes:
Hi,
I have this construct in a function that creates a combined time
signature:
(grob-interpret-markup grob
(markup #:override '(baseline-skip . 0) #:number
(#:line ((#:column (numOne denOne))
(#:column (numTwo denTwo))))))
It creates two columns from the four given arguments, but I want to be
able to create an arbitrary number of columns.
I see that #:line gets a list of (#:column ()) entries.
But I'm lost with the #: part. What does that mean?
That's the markup macro. It is documented in the Extending Guide. More
or less.
And how can I generate such a list with an arbitrary number of
columns?
You can't actually do it in time since the whole point of a macro is
that it operates on its elements _before_ they are evaluated.
So the Extending Guide says:
Known issues and warnings
.........................
The markup-list argument of commands such as ‘#:line’, ‘#:center’, and
‘#:column’ cannot be a variable or the result of a function call.
(markup #:line (function-that-returns-markups))
is invalid. One should use the ‘make-line-markup’,
‘make-center-markup’, or ‘make-column-markup’ functions instead,
(markup (make-line-markup (function-that-returns-markups)))
That's how far I got - after writing the email ...
So let's fiddle this in another way:
That's where I did _not_ get
Of course, we can just abandon hope regarding the markup macro and do
this as
and this neither.
But I could incorporate the second solution in my function, and now it's
a neat \alternatingTimeSignatures function.
Compile the attached file to see it in action.
I think this should be generally available, and if you don't think it
should be included in LilyPond I'll put it in the openLilyLib snippets.
Best
Urs
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user
\version "2.18.2"
alternatingTimeSignatures =
#(define-music-function (parser location timesigs)(list?)
(_i "Print alternating time signatures. The argument is a Scheme list
of lists. Each list describes one fraction to be printed.
When the function has executed the first of the given time signatures
will be the effective @code{\\time}, while the following are simply graphical.
When using it you will want to use @code{\\omit Score.TimeSignature}
before the next use of @code{\\time}. Please note that this does not
perform any checks regarding the used time signatures, so you're
responsible yourself to write consistent music. To return to normal
use of time signatures use @code{\\undo \\omit Score.TimeSignature}.")
(let ((firstsig (cons
(caar timesigs)
(cadar timesigs))))
#{ \once\override Staff.TimeSignature.stencil =
#(lambda (grob)
(grob-interpret-markup grob
#{ \markup \override #'(baseline-skip . 0)
\number
#(map (lambda (x) #{ \markup \column #(map number->string x) #})
timesigs)
#}))
\time #firstsig #}))
\relative c' {
\alternatingTimeSignatures #'((3 8) (4 8) (5 8))
c8 d e
\omit Score.TimeSignature
\time 4/8
f g a b
\time 5/8
c g c, f e
\time 3/8
d e f
g a b
\time 4/8
c b a b
\undo \omit Score.TimeSignature
\time 5/8
c b a g f
}
\relative c' {
\override TupletNumber.text = #tuplet-number::calc-fraction-text
\alternatingTimeSignatures #'((3 4) (4 7))
c4 d e
\omit Score.TimeSignature
\time 4/7
\tupletSpan 4*16/7
\tuplet 7/4 {
f e f fis
g a ais b
}
\time 3/4
c4 g c,
}
_______________________________________________
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user