LSR: Update.
[lilypond/mpolesky.git] / Documentation / snippets / adding-indicators-to-staves-which-get-split-after-a-break.ly
blob1f01fcf6776132edb0a85efcd773d0901170ecd6
1 %% Do not edit this file; it is automatically
2 %% generated from LSR http://lsr.dsi.unimi.it
3 %% This file is in the public domain.
4 \version "2.13.29"
6 \header {
7 lsrtags = "staff-notation, vocal-music"
9 texidoc = "
10 This snippet defines the @code{\\splitStaffBarLine} command, which adds
11 arrows in north-east and south-east directions at a bar line, to denote
12 that several voices sharing a staff will each continue on a staff of
13 their own in the next system.
16 doctitle = "Adding indicators to staves which get split after a break"
17 } % begin verbatim
19 #(define-markup-command (arrow-at-angle layout props angle-deg length fill)
20 (number? number? boolean?)
21 (let* (
22 ;; PI-OVER-180 and degrees->radians are taken from flag-styles.scm
23 (PI-OVER-180 (/ (atan 1 1) 45))
24 (degrees->radians (lambda (degrees) (* degrees PI-OVER-180)))
25 (angle-rad (degrees->radians angle-deg))
26 (target-x (* length (cos angle-rad)))
27 (target-y (* length (sin angle-rad))))
28 (interpret-markup layout props
29 (markup
30 #:translate (cons (/ target-x 2) (/ target-y 2))
31 #:rotate angle-deg
32 #:translate (cons (/ length -2) 0)
33 #:concat (#:draw-line (cons length 0)
34 #:arrow-head X RIGHT fill)))))
36 splitStaffBarLineMarkup = \markup \with-dimensions #'(0 . 0) #'(0 . 0) {
37 \combine
38 \arrow-at-angle #45 #(sqrt 8) ##f
39 \arrow-at-angle #-45 #(sqrt 8) ##f
42 splitStaffBarLine = {
43 \once \override Staff.BarLine #'stencil =
44 #(lambda (grob)
45 (ly:stencil-combine-at-edge
46 (ly:bar-line::print grob)
47 X RIGHT
48 (grob-interpret-markup grob splitStaffBarLineMarkup)
49 0 0))
50 \break
53 \paper {
54 ragged-right = ##t
55 short-indent = 5\mm
58 \score {
60 \new ChoirStaff <<
61 \new Staff \with { instrumentName = #"High I + II" } {
63 \repeat unfold 4 f''1
65 \repeat unfold 4 d''1
67 \splitStaffBarLine
69 \new Staff \with { instrumentName = #"Low" } {
71 \repeat unfold 4 b'1
73 \repeat unfold 4 g'1
77 \new Staff \with { shortInstrumentName = #"H I" } {
78 R1*4
79 \repeat unfold 2 { r4 f''2 r4 } \repeat unfold 2 e''1
81 \new Staff \with { shortInstrumentName = #"H II" } {
82 R1*4
83 \repeat unfold 4 b'2 \repeat unfold 2 c''1
85 \new Staff \with { shortInstrumentName = #"L" } {
86 R1*4
88 \repeat unfold 4 g'1
90 \repeat unfold 4 c'1
95 \layout {
96 \context {
97 \Staff \RemoveEmptyStaves
98 \override VerticalAxisGroup #'remove-first = ##t