Dear Trevor and Valentin,
On 10/04/2008, Trevor Daniels wrote:
> Attached is a version of snippet 204 that works better with 2.11. I did
> this some time ago, but forgot to send it. It's still not quite perfect,
> though. I've annotated the extra statements with % td and commented out
> those that need to be removed in case anyone wishes to see the changes. You
> may want to edit these out or even fiddle with it a little more before
> adding it to the 2.11 snippet list.
I hope you don't mind that I added the minimum-Y-extent to your
example. Now the marks are placed closer to the staff, like in the
original one that's for 2.10.
-Risto
%%% Function: rhythmMark
%%% ============================================================
%%% Purpose: print a sophisticated rehearsal mark e.g
%%% for rhythm directives
%%% Usage: \rhythmMark label music1 music2
%%% ------------------------------------------------------------
%%% Variable: label (string)
%%% ------------------------------------------------------------
%%% Variable: music1 (ly:music)
%%% ------------------------------------------------------------
%%% Variable: music2 (ly:music)
%%% ------------------------------------------------------------
%%% Example: \rhythmMark #"Swing" \rhyMarkIIEighths
%%% \rhyMarkSlurredTriplets
%%% ------------------------------------------------------------
%%% Constants:
%%% rhythmMarkStaffReduce = #-3
%%% rhythmMarkLabelFontSize = #-2
%%% ------------------------------------------------------------
%%% Comment: see below for predefined values for music1&2
%%% ============================================================
% \version "2.11.43"
rhythmMarkStaffReduce = #-3
rhythmMarkLabelFontSize = #-2
rhythmMark = #(define-music-function (parser location label musicI musicII ) (string? ly:music? ly:music?)
#{
\mark \markup {
\line \vcenter {
\combine % 1st column in line
\italic \fontsize #rhythmMarkLabelFontSize $label
\transparent \italic \fontsize #rhythmMarkLabelFontSize f
% This fakes a uniform baseline (ie. create common anchor for vcenter)
\score { % 2nd column in line
\new Staff \with {
fontSize = #rhythmMarkStaffReduce
\override StaffSymbol #'staff-space = #(magstep rhythmMarkStaffReduce)
\override StaffSymbol #'line-count = #0
\override VerticalAxisGroup #'Y-extent = #'(0 . 0) % td
\override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 0) %RV
}
\relative { \stemUp $musicI }
\layout {
ragged-right= ##t
indent = 0
\context {
\Staff
\remove "Clef_engraver"
\remove "Time_signature_engraver" }
} % layout
} % 1st Score end
\hspace #-0.1 % 3rd column in line
% 4th column in line
\italic \fontsize #rhythmMarkStaffReduce "="
\score { % 5th column in line
\new Staff \with {
fontSize = #rhythmMarkStaffReduce
\override StaffSymbol #'staff-space = #(magstep rhythmMarkStaffReduce)
\override StaffSymbol #'line-count = #0
\override VerticalAxisGroup #'Y-extent = #'(0 . 0) % td
\override VerticalAxisGroup #'minimum-Y-extent = #'(0 . 0) %RV
}
\relative { \stemUp $musicII }
\layout {
ragged-right= ##t
indent = 0
\context {
\Staff
\remove "Clef_engraver"
\remove "Time_signature_engraver" }
} % layout end
} % 2nd Score end
} % line end
} % markup end
#})
%%% Function: rhythmMarkC
%%% ============================================================
%%% Purpose: print a sophisticated rehearsal mark e.g for
%%% rhythm directives in a column (music on top)
%%% Usage: \rhythmMarkC label music1 music2
%%% ------------------------------------------------------------
%%% Variable: label (string)
%%% ------------------------------------------------------------
%%% Variable: music1 (ly:music)
%%% ------------------------------------------------------------
%%% Variable: music2 (ly:music)
%%% ------------------------------------------------------------
%%% Example: \rhythmMarkC #"Swing" \rhyMarkIIEighths
%%% \rhyMarkSlurredTriplets
%%% ------------------------------------------------------------
%%% Constants:
%%% rhythmMarkCStaffReduce = #-4
%%% rhythmMarkCLabelFontSize = #-2
%%% ------------------------------------------------------------
%%% Comment: see below for predefined values for music1&2
%%% ============================================================
rhythmMarkCStaffReduce = #-4
rhythmMarkCLabelFontSize = #-2
rhythmMarkC = #(define-music-function (parser location label musicI musicII ) (string? ly:music? ly:music?)
#{
\mark \markup
{
\combine
\line {
\hspace #0
\translate #'(-0.1 . -3.25) \italic \fontsize #rhythmMarkCLabelFontSize $label
} % end Line
\line \vcenter {
\score { % 1st column in line
\new Staff \with {
fontSize = #rhythmMarkCStaffReduce
\override StaffSymbol #'staff-space = #(magstep rhythmMarkCStaffReduce)
\override StaffSymbol #'line-count = #0
\override VerticalAxisGroup #'Y-extent = #'(0 . 0) % td
}
\relative { \stemUp $musicI }
\layout {
ragged-right= ##t
indent = 0
\context {
\Staff
\remove "Clef_engraver"
\remove "Time_signature_engraver" }
} % layout
} % 1st score
\hspace #-0.1 % 2nd column in line
% 3rd column in line
\italic \fontsize #rhythmMarkCStaffReduce "="
\score { % 4th column in line
\new Staff \with {
fontSize = #rhythmMarkCStaffReduce
\override StaffSymbol #'staff-space = #(magstep rhythmMarkCStaffReduce)
\override StaffSymbol #'line-count = #0
\override VerticalAxisGroup #'Y-extent = #'(0 . 0) % td
}
\relative {
\stemUp $musicII
}
\layout {
ragged-right= ##t
indent = 0
\context {
\Staff
\remove "Clef_engraver"
\remove "Time_signature_engraver" }
} % layout
} % 2nd score end
} % line end
% end combine
} % markup end
#})
%%% predefined ly:music-Variables for use
%%% in function rhythmMark and rhythmMarkC
%%% ============================================================
rhyMarkI = { b'1 }
rhyMarkII = { b'2 }
rhyMarkIV = { b'4 }
rhyMarkEighth = { b'8 }
rhyMarkIIEighths = {
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 4) % tight
\override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 3 16) % even
b'8[ b8]
}
rhyMarkTriplets = {
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 2) % super-tight
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 4) % tight
\override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 3 16) % even
\times 2/3 { b'4 b8 }
}
rhyMarkSlurredTriplets = {
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 4) % tight
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 5 32) % slighty tighter as even
\override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 8) % even
\times 2/3 { b'8 ~ b8 b8 }
}
rhyMarkDottedEighths = {
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 4) % tight
\override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 3 16) % even
% \override Score.SpacingSpanner #'common-shortest-duration = #(ly:make-moment 1 8) % loose
{ b'8. b16 }
}
%%% Begin Example
%%% ============================================================
spacer = {
| g'1
\noBreak
| g'1
| g'1
}
spacerII = {
| g'1
\noBreak
| g'1
}
\score {
{
\override Score.RehearsalMark #'self-alignment-X = #LEFT
\override Score.BarNumber #'break-visibility = #all-invisible
% \override Score.RehearsalMark #'padding = #-2
\once \override Score.RehearsalMark #'X-offset = #5 % td
\rhythmMark #"Swing" \rhyMarkIIEighths \rhyMarkSlurredTriplets
\spacer
\rhythmMark #"straight" \rhyMarkEighth \rhyMarkEighth
\spacer
\rhythmMark #"Shuffle" \rhyMarkIIEighths \rhyMarkDottedEighths
\spacer
\once \override Score.RehearsalMark #'X-offset = #5 % td
\rhythmMark #"straight" \rhyMarkIIEighths \rhyMarkIIEighths
\spacer
\rhythmMark #"Swing" \rhyMarkIIEighths \rhyMarkTriplets
\spacer
\rhythmMark #"in 2" \rhyMarkII \rhyMarkIV
\spacer
\once \override Score.RehearsalMark #'X-offset = #5 % td
\rhythmMark #"Swing feel" \rhyMarkDottedEighths \rhyMarkTriplets
\spacer
\rhythmMark #"Maestoso" \rhyMarkII \rhyMarkI
\spacer
\rhythmMark #"suassa" \rhyMarkII \rhyMarkI % This is just to proof that the basline-fake really works
\spacer
\once \override Score.RehearsalMark #'X-offset = #5 % td
\break
\rhythmMarkC #"Swing" \rhyMarkIIEighths \rhyMarkSlurredTriplets
\spacerII
\rhythmMarkC #"straight" \rhyMarkEighth \rhyMarkEighth
\spacerII
\rhythmMarkC #"Shuffle" \rhyMarkIIEighths \rhyMarkDottedEighths
\spacerII
\rhythmMarkC #"straight" \rhyMarkIIEighths \rhyMarkIIEighths
\spacerII
\rhythmMarkC #"Swing" \rhyMarkIIEighths \rhyMarkTriplets
\spacerII
\rhythmMarkC #"in 2" \rhyMarkII \rhyMarkIV
\spacerII
\once \override Score.RehearsalMark #'X-offset = #5 % td
\rhythmMarkC #"Swing feel" \rhyMarkDottedEighths \rhyMarkTriplets
\spacerII
\rhythmMarkC #"Maestoso" \rhyMarkII \rhyMarkI
\spacerII
}
\layout {
ragged-right= ##t
indent = 0
}
}
_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user