]> git.donarmstrong.com Git - lilypond.git/blob - Documentation/snippets/positioning-segno-and-coda-with-line-break.ly
LSR: update.
[lilypond.git] / Documentation / snippets / positioning-segno-and-coda-with-line-break.ly
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.20"
5
6 \header {
7   lsrtags = "repeats, breaks"
8
9   texidoc = "
10 If you want to place an exiting segno sign and add text like @qq{D.S.
11 al Coda} next to it where usually the staff lines are you can use this
12 snippet. The coda will resume in a new line. There is a variation
13 documented in this snippet, where the coda will remain on the same
14 line.
15
16 "
17   doctitle = "Positioning segno and coda (with line break)"
18 } % begin verbatim
19
20 {
21   \clef treble
22   \key g \major
23   \time 4/4
24   \relative c'' {
25     \repeat unfold 2 {
26       | c4 c c c
27     }
28
29     % Set segno sign as rehearsal mark and adjust size if needed
30     % \once \override Score.RehearsalMark #'font-size = #3
31     \mark \markup { \musicglyph #"scripts.segno" }
32     \repeat unfold 2 {
33       | c4 c c c
34     }
35
36     % Set coda sign as rehearsal mark and adjust size if needed
37     \once \override Score.RehearsalMark #'font-size = #4
38     \mark \markup { \musicglyph #"scripts.coda" }
39     \repeat unfold 2 {
40       | c4 c c c
41     }
42
43     % Should Coda be on anew line?
44     % Coda NOT on new line: use \nobreak
45     % Coda on new line: DON'T use \nobreak
46     % \noBreak
47
48     \bar "||"
49
50     % Set segno sign as rehearsal mark and adjust size if needed
51     \once \override Score.RehearsalMark #'break-visibility = #begin-of-line-invisible
52     % \once \override Score.RehearsalMark #'font-size = #3
53     \mark \markup { \musicglyph #"scripts.segno" }
54
55     % Here begins the trickery!
56     % \cadenzaOn will suppress the bar count and \stopStaff removes the staff lines.
57     \cadenzaOn
58       \stopStaff
59         % Some examples of possible text-displays
60
61         % text line-aligned
62         % ==================
63         % Move text to the desired position
64         % \once \override TextScript #'extra-offset = #'( 2 . -3.5 )
65         % | s1*0^\markup { D.S. al Coda } }
66
67         % text center-aligned
68         % ====================
69         % Move text to the desired position
70         % \once \override TextScript #'extra-offset = #'( 6 . -5.0 )
71         % | s1*0^\markup { \center-column { D.S. "al Coda" } }
72
73         % text and symbols center-aligned
74         % ===============================
75         % Move text to the desired position and tweak spacing for optimum text alignment
76         %\once \override TextScript #'extra-offset = #'( 8 . -5.5 )
77         \once \override TextScript #'word-space = #1.5
78         \once \override TextScript #'X-offset = #8
79         \once \override TextScript #'Y-offset = #1.5
80         | s1*0^\markup { \center-column { "D.S. al Coda" \line { \musicglyph #"scripts.coda" \musicglyph #"scripts.tenuto" \musicglyph #"scripts.coda"} } }
81
82         % Increasing the unfold counter will expand the staff-free space
83         \repeat unfold 4 {
84           s4 s4 s4 s4
85           \bar ""
86         }
87         % Resume bar count and show staff lines again
88      \startStaff
89    \cadenzaOff
90
91    % Should Coda be on new line?
92    % Coda NOT on new line: DON'T use \break
93    % Coda on new line: use \break
94    \break
95
96    % Show up, you clef and key!
97    \once \override Staff.KeySignature #'break-visibility = #end-of-line-invisible
98    \once \override Staff.Clef #'break-visibility = #end-of-line-invisible
99
100    % Set coda sign as rehearsal mark and adjust size and position
101
102    % Put the coda sign ontop of the (treble-)clef dependend on coda's line-position
103
104      % Coda NOT on new line, use this:
105      % \once \override Score.RehearsalMark #'extra-offset = #'( -2 . 1.75 )
106
107      % Coda on new line, use this:
108      \once \override Score.RehearsalMark #'extra-offset = #'( -8.42 . 1.75 )
109
110    \once \override Score.RehearsalMark #'font-size = #5
111    \mark \markup { \musicglyph #"scripts.coda" }
112
113    % The coda
114    \repeat unfold 5 {
115       | c4 c c c
116     }
117     \bar"|."
118   }
119 }
120