]> git.donarmstrong.com Git - lilypond.git/blobdiff - Documentation/user/changing-defaults.itely
* flower/include/std-string.hh:
[lilypond.git] / Documentation / user / changing-defaults.itely
index 1796ec64506785f3d16c2e7277cf078a491c0821..be62081aa053fdc42f420dc4d35c8f4482572cbf 100644 (file)
@@ -153,7 +153,7 @@ A practical application of @code{\new} is a score with many
 staves.  Each part that should be on its own staff, is preceded with 
 @code{\new Staff}.
 
-@lilypond[quote,verbatim,relative=2,raggedright,fragment]
+@lilypond[quote,verbatim,relative=2,ragged-right,fragment]
 << \new Staff { c4 c }
    \new Staff { d4 d }
 >>
@@ -203,7 +203,7 @@ They are combined by sending both to the same @context{Voice} context,
    \context Voice = "A" \arts
 >>
 @end example
-@lilypond[quote,raggedright]
+@lilypond[quote,ragged-right]
 music = { c4 c4 }
 arts = { s4-. s4-> }
 \relative c'' <<
@@ -447,7 +447,7 @@ time signature.
 @cindex polymetric scores
 @cindex Time signatures, multiple
 
-@lilypond[quote,relative=1,raggedright,verbatim,fragment]
+@lilypond[quote,relative=1,ragged-right,verbatim,fragment]
 \new Score \with {
   \remove "Timing_translator"
   \remove "Default_bar_line_engraver"
@@ -660,7 +660,7 @@ The next example shows how to build a different type of
 @code{Voice}, but prints centered slash noteheads only.  It can be used
 to indicate improvisation in Jazz pieces,
 
-@lilypond[quote,raggedright]
+@lilypond[quote,ragged-right]
 \layout { \context {
   \name ImproVoice
   \type "Engraver_group"
@@ -828,6 +828,7 @@ for many situations.  The next section will discuss the general use of
 * Navigating the program reference::  
 * Layout interfaces::           
 * Determining the grob property::  
+* Objects connected to the input::  
 * Difficult tweaks::            
 @end menu
 
@@ -1232,50 +1233,59 @@ the @internalsref{Fingering_engraver} plug-in says
 Fingering_engraver is part of contexts: @dots{} @b{@internalsref{Voice}}
 @end quotation
 
+@node Objects connected to the input
+@subsection Objects connected to the input
+
+In some cases, it is possible to take a short-cut for tuning graphical
+objects. For objects that result directly from a piece of the input,
+you can use the @code{\tweak} function, for example
+
+@lilypond[relative=2,fragment,verbatim,ragged-right]
+<
+  c
+  \tweak #'color #red d
+  g
+  \tweak #'duration-log #1  a
+>4-\tweak #'padding #10 -. 
+@end lilypond
+
+As you can see, properties are set directly in the objects directly,
+without mentioning the grob name or context where this should be
+applied.
+
+This technique only works for objects that are directly connected to
+an @internalsref{event} from the input, for example
+
+@itemize @bullet
+@item note heads, caused by chord-pitch.
+@item articulation signs, caused by articulation instructions
+@end itemize
+
+It notably does not work for stems and accidentals (these are caused
+by note heads, not by music events), clefs (these are not caused by
+music inputs, but rather by the change of a property value).
+In a similar vein, objects may be parenthesized by prefixing
+@code{\parenthesize} to the music event, 
+
+@lilypond[relative=2,fragment,verbatim,ragged-right]
+<
+  c
+  \parenthesize  d
+  g
+>4-\parenthesize -. 
+@end lilypond
+
+
+
+
 @node Difficult tweaks
 @subsection Difficult tweaks
 
 There are a few classes of difficult adjustments.  
 
 @itemize @bullet
-First, when there are
-several of the same objects at one point, and you want to adjust only
-one.  
-
-For example, if you want to change only one note head in a chord.
-
-In this case, the @code{\applyOutput} function must be used.  The
-next example defines a Scheme function @code{set-position-font-size}
-that sets the @code{font-size} property, but only  
-on objects that have @internalsref{note-head-interface} and are at the
-right Y-position.
-
-@lilypond[quote,verbatim]
-#(define ((set-position-font-size pos size) grob origin current)
-  (let*
-      ((meta (ly:grob-property grob 'meta))
-       (interfaces (cdr (assoc 'interfaces meta)))
-       (position (ly:grob-property grob 'staff-position)))
-   (if (and
-        ; is this a note head?
-        (memq 'note-head-interface interfaces)
-
-        ; is the Y coordinate right?
-        (= pos position))
-
-      ; then do it.
-      (set! (ly:grob-property grob 'font-size) size))))
-
-\relative {
-  c
-  \applyOutput #(set-position-font-size -2 4)
-  <c e g>
-}
-@end lilypond
 
-@noindent
-A similar technique can be used for accidentals.  In that case, the
-function should check for @code{accidental-interface}.
 
 @item
 Another difficult adjustment is the appearance of spanner objects,
@@ -1311,7 +1321,7 @@ if yes, it sets @code{extra-offset}.
 This procedure is installed into @internalsref{Tie}, so the last part
 of the broken tie is translated up.
 
-@lilypond[quote,verbatim,raggedright]
+@lilypond[quote,verbatim,ragged-right]
 #(define (my-callback grob)
   (let* (
          ; have we been split?