LilyPond Beginnershandleiding
LilyPond Beginnershandleiding
LilyPond Beginnershandleiding
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Hoofdstuk 4: Tweaking output 91<br />
The \overrideProperty command<br />
There is another form of the override command, \overrideProperty, which is occasionally<br />
required. We mention it here for completeness, but for details see Sectie “Difficult tweaks” in<br />
Uitbreidingen.<br />
The \tweak command<br />
The final tweaking command which is available is \tweak. This should be used when several<br />
objects occur at the same musical moment, but you only want to change the properties of<br />
selected ones, such as a single note within a chord. Using \override would affect all the notes<br />
within a chord, whereas \tweak affects just the following item in the input stream.<br />
Here’s an example. Suppose we wish to change the size of the middle note head (the E) in a<br />
C major chord. Let’s first see what \once \override would do:<br />
4<br />
\once \override NoteHead.font-size = #-3<br />
4<br />
4<br />
<br />
<br />
<br />
<br />
We see the override affects all the note heads in the chord. This is because all the notes of a<br />
chord occur at the same musical moment, and the action of \once is to apply the override to all<br />
layout objects of the type specified which occur at the same musical moment as the \override<br />
command itself.<br />
The \tweak command operates in a different way. It acts on the immediately following item<br />
in the input stream. In its simplest form, it is effective only on objects which are created directly<br />
from the following item, essentially note heads and articulations.<br />
So to return to our example, the size of the middle note of a chord would be changed in this<br />
way:<br />
4<br />
4<br />
<br />
<br />
<br />
Note that the syntax of \tweak is different from that of the \override command. The<br />
context should not be specified; in fact, it would generate an error to do so. Both context and<br />
layout object are implied by the following item in the input stream. Note also that an equals<br />
sign should not be present. So the simple form of the \tweak command is<br />
\tweak layout-property #value<br />
A \tweak command can also be used to modify just one in a series of articulations, as shown<br />
here:<br />
a4^"Black"<br />
-\tweak color #red ^"Red"<br />
-\tweak color #green _"Green"