Hi Risto

Two changes seem to be required to make this snippet work in
2.11.  This may not be the optimum solution, though.

a) The vertical alignment of the inserted score blocks seems
different in the two releases.  In 2.11 their vertical
extend is used to centre them vertically.  This did not seem
to happen in 2.10, although I can't test this.  This can be
fixed in 2.11 by the trick Mats recently suggested - reduce
their Y-extent to zero.  So in each of the \Staff \with
blocks add

  \override VerticalAxisGroup #'Y-extent = #'(0 . 0)  % td

b) The horizontal alignment of the rehearsal mark in 2.11 is
by default on the bar line, or if no bar line is visible, on
the clef.  In 2.10 it was just aligned to the bar line.
Aligning it to the clef causes it to be raised to avoid the
collision.  However, simply restoring this behaviour in 2.11
does not help much.  The very first rehearsal mark can be
instead aligned to the time signature with

\override Score.RehearsalMark
      #'break-align-symbols = #'(staff-bar time-signature)
% td

which fixes its vertical alignment by permitting it to drop
down, but doesn't help with the ones at the start of
subsequent lines as there is no time signature to align them
to.  So instead, I think we need to fall back on changing
individual X-offsets to move these:

\once \override Score.RehearsalMark #'X-offset = #5  % td

I attach an amended snippet which seems to work in 2.11.34.

Trevor D

ps As you remarked in a later note, setting 'padding does
not have any effect, AFAICS.

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:lilypond-user-bounces+t.daniels=treda.co.u
> [EMAIL PROTECTED] Behalf Of
> Risto Vääräniemi
> Sent: 10 February 2008 00:14
> To: lilypond-user@gnu.org
> Subject: Rhythm mark snippet in LSR not 2.11. compatible?
>
>
> Hi again,
>
> I found a wonderful snippet in LSR that explained
> how to create rhythm
> marks (http://lsr.dsi.unimi.it/LSR/Item?id=204).
> I tested it and found
> out that it doesn't work that well with
> 2.11.(37). The space between
> the mark and the staff is much bigger than in the
> example image. If
> you have a look at the attached images you'll get
> the drift.
>
> To my eye the code contains pretty normal stuff
> and I cannot see what
> affects the spacing but I'm no expert anyway. Do
> you think there's any
> hope making it work properly in 2.11?
>
> -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
%%% ============================================================

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
            }

            \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
            }

            \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
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to