Previous: Naming conventions of objects and properties, Up: Tweaking basics


4.1.4 Tweaking methods

We have already met the commands \set and \with, used to change the properties of contexts and to remove and add engravers, in Modifying context properties and Adding and removing engravers. We now must meet one more command.

The command to change the properties of layout objects is \override. Because this command has to modify internal properties deep within LilyPond its syntax is not as simple as the commands you have met so far. It needs to know precisely which property of which object in which context has to be modified, and what its new value is to be. Let's see how this is done.

The general syntax of this command is:

\override context.layout_object #'layout_property = #value

This will set the property with the name layout_property of the layout object with the name layout_object, which is a member of the context context, to the value value.

The context can be omitted (and usually is) when the required context is unambiguously implied and is one of lowest level contexts, i.e., Voice, ChordNames or Lyrics, and we shall omit it in many of the following examples. We shall see later when it must be specified.

For now, don't worry about the #', which must precede the layout property, and the #, which must precede the value. These must always be present in exactly this form. This is the most common command used in tweaking, and most of the rest of this chapter will be directed to presenting examples of how it is used.

Once overridden, the property retains its new value until it is overridden again or a \revert command is encountered. The \revert command has the following syntax and causes the value of the property to revert to its original default value; note, not its previous value if several \override commands have been issued.

\revert context.layout_object #'layout_property

Again, just like context in the \override command, context is often not needed. It will be omitted in many of the following examples.

There is another form of the override command, \overrideProperty, which is occasionally required. We mention it here for completeness, but for details see Difficult tweaks.

The final tweaking command which is available is \tweak. This should be used to change the properties of objects which occur at the same musical moment, such as the notes within a chord. Using \override would affect all the notes within a chord, whereas \tweak affects just the following item in the input stream. You may find the details in Objects connected to the input.


Previous: Naming conventions of objects and properties, Up: Tweaking basics

Cette page documente LilyPond-2.11.40 (branche de développement).

Rapportez toute anomalie en français à lilypond-user-fr@gnu.org ou en anglais à http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs

Vos suggestions à propos de la documentation sont les bienvenues.