1 %% DO NOT EDIT this file manually; it is automatically
2 %% generated from LSR http://lsr.di.unimi.it
3 %% Make any changes in LSR itself, or in Documentation/snippets/new/ ,
4 %% and then run scripts/auxiliar/makelsr.py
6 %% This file is in the public domain.
10 lsrtags = "scheme-language, tweaks-and-overrides"
13 Sometimes you may want to affect a single articulation-type. Although
14 it is always possible to use @code{\\tweak}, it might become tedious to
15 do so for every single sign of a whole score. The following shows how
16 to tweak articulations with a list of custom-settings. One use-case
17 might be to create a style-sheet.
19 With 2.16.2 it is possible to put the proposed function,
20 @code{\\customScripts}, into a @code{\\layout}-block.
23 doctitle = "Overriding articulations of destinct type"
26 % Code by David Nalesnik and Thomas Morley
28 #(define (custom-script-tweaks ls)
30 (let* ((type (ly:prob-property
31 (assoc-ref (ly:grob-properties grob) 'cause)
33 (tweaks (assoc-ref ls type)))
36 (lambda (x) (ly:grob-set-property! grob (car x) (cdr x)))
40 #(define-music-function (settings)(list?)
42 \override Script.before-line-breaking =
43 #(custom-script-tweaks settings)
46 revertCustomScripts = { \revert Script.before-line-breaking }
52 % Predefine a list of desired tweaks.
53 #(define my-settings-1
55 ("staccato" . ((color . (1 0 0))(padding . 0.5)))
56 ("accent" . ((font-size . 0)(color . (1 0 0))))
57 ("tenuto" . ((rotation . (45 0 0)) (padding . 2)(font-size . 10)))
58 ("staccatissimo" . ((padding . 1) (color . (1 0 0))))
59 ("segno" . ((font-size . 0)(color . (1 0 0))))
62 #(define my-settings-2
64 ("staccato" . ((color . (0 1 0))))
65 ("accent" . ((font-size . 4)(color . (0 1 0))(padding . 1.5)))
66 ("tenuto" . ((font-size . 10)))
67 ("staccatissimo" . ((padding . 2) (color . (0 1 0))))
68 ("coda" . ((color . (0 1 0)) (padding . 1)))
74 \customScripts #my-settings-1
75 f-. f-! f-> f-- f-!\segno
83 \customScripts #my-settings-2
89 \new Voice { \voiceOne \one }
90 \new Voice { \voiceTwo \two }