Placing rehearsal marks other than above the top staff
Appearance
	
	
Currently, placing rehearsal marks somewhere else than above the top staff is not possible by default. This is due to a malfunction in the Staff_collecting_engraver, see Issue 2199. This solution (courtesy of Shevek, see the lilypond-user archive) defines a custom MarkLine context which will display all metronome and rehearsal marks and may be inserted anywhere between staff and other lines.
Remark from LSR-editor: Issue 2199 is solved in 2.21. In this regard this snippet is deprecated, for now we let it in as an example how to define a custom context like MarkLine.
\version "2.24.0"
global = {
  \tempo "Largo" 4=30
  s1*2
  \mark \default
  s1*2
}
foo = \relative c' {
  c4 d e f |
  g f e d |
  c e g b |
  d2 c2 |
}
baz = {
  R1*4
}
\score {
  <<
    \new Staff << \global \foo >>
    \new MarkLine \global
    \new Staff << \global \foo >>
    \new MarkLine \global
    \new Staff << \global \foo >>
  >>
  \layout {
    \context {
      \name "MarkLine"
      \type "Engraver_group"
      \consists Output_property_engraver
      \consists Axis_group_engraver
      \consists Mark_engraver
      \consists Metronome_mark_engraver
      \consists Staff_collecting_engraver
      \override RehearsalMark.extra-spacing-width = #'(0 . 1)
      \override MetronomeMark.extra-spacing-width = #'(0.5 . 0)
      \override VerticalAxisGroup.minimum-Y-extent = #'(-2 . 2)
      \override VerticalAxisGroup.staff-staff-spacing =
      #'((basic-distance . 1)
         (minimum-distance . 1)
         (padding . 1)
         (stretchability . 3))
    }
    \context {
      \Score
      \remove Mark_engraver
      \remove Metronome_mark_engraver
      \remove Staff_collecting_engraver
      \accepts MarkLine
    }
  }
}