Sophie

Sophie

distrib > Mandriva > 2009.0 > i586 > by-pkgid > 3a7b4dfc766af1222d90c7f03a0844e6 > files > 6380

lilypond-doc-2.11.57-1mdv2009.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!-- header_tag -->
<html lang="en">
<head>
<title>Tweaking methods - GNU LilyPond Learning Manual</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="description" content="GNU LilyPond Learning Manual">
<meta name="generator" content="makeinfo 4.11">
<link title="Top" rel="start" href="index.fr.html#Top">
<link rel="up" href="Tweaking-basics.fr.html#Tweaking-basics" title="Tweaking basics">
<link rel="prev" href="Naming-conventions-of-objects-and-properties.fr.html#Naming-conventions-of-objects-and-properties" title="Naming conventions of objects and properties">
<link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage">
<!--
Copyright (C) 1999--2007 by the authors

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.1 or any later version published by the Free Software
     Foundation; with no Invariant Sections.  A copy of the license is
     included in the section entitled ``GNU Free Documentation
     License''.
   -->
<meta http-equiv="Content-Style-Type" content="text/css">
<style type="text/css"><!--
  pre.display { font-family:inherit }
  pre.format  { font-family:inherit }
  pre.smalldisplay { font-family:inherit; font-size:smaller }
  pre.smallformat  { font-family:inherit; font-size:smaller }
  pre.smallexample { font-size:smaller }
  pre.smalllisp    { font-size:smaller }
  span.sc    { font-variant:small-caps }
  span.roman { font-family:serif; font-weight:normal; } 
  span.sansserif { font-family:sans-serif; font-weight:normal; } 
hr { border:0; height:1; color: #000000; background-color: #000000; }
/* hr {
  border:  none;
  height: 1px;
  color: #666666;
  background-color: #666666;
}
body {
  border-left: 1px solid #666666;
  border-right: 1px solid #666666;
  color: #332d28;
  margin-right: auto;
  margin-left: auto;
  width: 60em;
  list-style-type: square;
  font-family: Arial,Helvetica,sans-serif;
  padding-right: 1em;
  padding-left: 1em;
}
a {
  border-bottom: 1px dashed #344242;
  text-decoration: none;
  color: #344242;
}
a:link {
  text-decoration: none;
}
a:visited {
  border-bottom: 1px dashed #666666;
  color: #666666;
}
a:active {
  border-bottom: 1px solid #00cccc;
  color: #00cccc;
}
a:hover {
  border-bottom: 1px solid #1d7b85;
  color: #1d7b85;
}
blockquote {
  border: 1px solid #cccccc;
  padding: 3px;
  width: 40em;
}
.node {
  border-left: 1px solid #666666;
  margin: -0.5em 0px 1em;
  padding: 2px 1px 0px;
  font-style: italic;
}
.node a {
  border:  none;
  text-decoration: underline;
  font-style: normal;
  font-weight: bold;
}
.verbatim {
  font-family: "Courier New",Courier,monospace;
}
.unnumberedsubsubsec {
  font-size: large;
  color: #1d7b85;
}
.subsubheading {
  font-size: large;
  color: #3b220d;
}
.contents {
  border: 1px dashed #339999;
  margin: 3px 2em;
  list-style-type: square;
  padding-right: 1em;
  width: 40em;
  background-color: #fcfff9;
}
.contents a {
  border-bottom: 1px dashed #423d34;
  text-decoration: none;
  color: #423d34;
}
.contents a:visited {
  border-bottom: 1px dashed #666666;
  color: #666666;
}
.contents a:active {
  border-bottom: 1px solid #f0d86d;
  color: #f0d86d;
}
.contents a:hover {
  border-bottom: 1px solid #3b220d;
  color: #3b220d;
}
.menu {
  border-left: 1px dashed #339999;
  margin: 3px 2em 1em;
  list-style-type: square;
  padding-left: 1.4em;
  width: 40em;
}
.unnumbered {
}
h2 {
  font-size: x-large;
  color: #1d7b85;
}
*/
--></style>
</head>
<BODY BGCOLOR=WHITE TEXT=BLACK>

<div class="node">
<p>
<a name="Tweaking-methods"></a>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Naming-conventions-of-objects-and-properties.fr.html#Naming-conventions-of-objects-and-properties">Naming conventions of objects and properties</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Tweaking-basics.fr.html#Tweaking-basics">Tweaking basics</a>
<hr>
</div>

<h4 class="subsection">4.1.4 Tweaking methods</h4>

<p><strong>\override command</strong>

   <p><a name="index-override-command-331"></a><a name="index-g_t_005coverride-332"></a><a name="index-g_t_005coverride-333"></a>

   <p>We have already met the commands <code>\set</code> and <code>\with</code>,
used to change the properties of <strong>contexts</strong> and to remove
and add <strong>engravers</strong>, in
<a href="Modifying-context-properties.fr.html#Modifying-context-properties">Modifying context properties</a>, and <a href="Adding-and-removing-engravers.fr.html#Adding-and-removing-engravers">Adding and removing engravers</a>.  We now must meet some more important
commands.

   <p>The command to change the properties of <strong>layout objects</strong> is
<code>\override</code>.  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.

   <p>The general syntax of this command is:

<pre class="example">\override <var>Context</var>.<var>LayoutObject</var> #'<var>layout-property</var> = #<var>value</var>
</pre>
   <p class="noindent">This will set the property with the name <var>layout-property</var>
of the layout object with the name
<var>LayoutObject</var>, which is a member of the <var>Context</var>
context, to the value <var>value</var>.

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

   <p>Later sections deal comprehensively with properties and their
values, but to illustrate the format and use of these commands
we shall use just a few simple properties and values which are
easily understood.

   <p>For now, don't worry about the <code>#'</code>, which must precede the
layout property, and the <code>#</code>, 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.  Here is a simple example to change the color of the
note head:

   <blockquote>
<pre class="verbatim">     
     c d
     \override NoteHead #'color = #red
     e f g
     \override NoteHead #'color = #green
     a b c
</pre>
     <p>
 <a href="../8c/lily-93693c78.ly">
  <img align="middle"
    border="0" src="../8c/lily-93693c78.png" alt="[image of music]">
 </a>
</p>

   </blockquote>

   <p><strong>\revert command</strong>

   <p><a name="index-revert-command-334"></a><a name="index-g_t_005crevert-335"></a><a name="index-g_t_005crevert-336"></a>

   <p>Once overridden, the property retains its new value until it is
overridden again or a <code>\revert</code> command is encountered. 
The <code>\revert</code> 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 <code>\override</code>
commands have been issued.

<pre class="example">\revert <var>Context</var>.<var>LayoutObject</var> #'<var>layout-property</var>
</pre>
   <p>Again, just like <var>Context</var> in the <code>\override</code> command,
<var>Context</var> is often not needed.  It will be omitted
in many of the following examples.  Here we revert the color
of the note head to the default value for the final two notes:

   <blockquote>
<pre class="verbatim">     
     c d
     \override NoteHead #'color = #red
     e f g
     \override NoteHead #'color = #green
     a
     \revert NoteHead #'color
     b c
</pre>
     <p>
 <a href="../ec/lily-c94b8226.ly">
  <img align="middle"
    border="0" src="../ec/lily-c94b8226.png" alt="[image of music]">
 </a>
</p>

   </blockquote>

   <p><strong>\once prefix</strong>

   <p>Both the <code>\override</code> and the <code>\set</code> commands may be
prefixed by <code>\once</code>.  This causes the following
<code>\override</code> or <code>\set</code> command to be effective only
during the current musical moment before the property reverts
back to its default value.  Using the same example, we can
change the color of a single note like this:

   <blockquote>
<pre class="verbatim">     
     c d
     \once \override NoteHead #'color = #red
     e f g
     \once \override NoteHead #'color = #green
     a b c
</pre>
     <p>
 <a href="../3d/lily-cbb460f1.ly">
  <img align="middle"
    border="0" src="../3d/lily-cbb460f1.png" alt="[image of music]">
 </a>
</p>

   </blockquote>

   <p><strong>\overrideProperty command</strong>

   <p><a name="index-overrideProperty-command-337"></a><a name="index-g_t_005coverrideProperty-338"></a><a name="index-g_t_005coverrideProperty-339"></a>

   <p>There is another form of the override command,
<code>\overrideProperty</code>, which is occasionally required. 
We mention it here for completeness, but for details see
<a name="index-Difficult-tweaks-340"></a><a href="../lilypond/Difficult-tweaks.fr.html#Difficult-tweaks">Difficult tweaks</a>. 
<!-- Maybe explain in a later iteration  -td -->

   <p><strong>\tweak command</strong>

   <p><a name="index-tweak-command-341"></a><a name="index-g_t_005ctweak-342"></a><a name="index-g_t_005ctweak-343"></a>

   <p>The final tweaking command which is available is <code>\tweak</code>. 
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 <code>\override</code> would affect all the notes
within a chord, whereas <code>\tweak</code> affects just the following
item in the input stream.

   <p>Here's an example.  Suppose we wish to change the size of the
middle note head (the E) in a C major chord.  Let's first see what
<code>\once \override</code> would do:

   <blockquote>
<pre class="verbatim">     
       &lt;c e g>4
       \once \override NoteHead #'font-size = #-3
       &lt;c e g>
       &lt;c e g>
</pre>
     <p>
 <a href="../4e/lily-c85c0c72.ly">
  <img align="middle"
    border="0" src="../4e/lily-c85c0c72.png" alt="[image of music]">
 </a>
</p>

   </blockquote>

   <p>We see the override affects <em>all</em> the note heads in the chord. 
This is because all the notes of a chord occur at the same
<em>musical moment</em>, and the action of <code>\once</code> is to
apply the override to all layout objects of the type specified
which occur at the same musical moment as the <code>\override</code>
command itself.

   <p>The <code>\tweak</code> command operates in a different way.  It acts
on the immediately following item in the input stream.  However,
it is effective only on objects which are created directly from
the input stream, essentially note heads and articulations;
objects such as stems and accidentals are created later and
cannot be tweaked in this way.  Furthermore, when it is applied
to note heads these <em>must</em> be within a chord, i.e., within
single angle brackets, so to tweak a single note the <code>\tweak</code>
command must be placed inside single angle brackets with the
note.

   <p>So to return to our example, the size of the middle note of
a chord would be changed in this way:

   <blockquote>
<pre class="verbatim">     
       &lt;c e g>4
       &lt;c \tweak #'font-size #-3 e g>4
</pre>
     <p>
 <a href="../cd/lily-ec9e5537.ly">
  <img align="middle"
    border="0" src="../cd/lily-ec9e5537.png" alt="[image of music]">
 </a>
</p>

   </blockquote>

   <p>Note that the syntax of <code>\tweak</code> is different from that
of the <code>\override</code> command.  Neither the context nor the
layout object should be specified; in fact, it would generate
an error to do so.  These are both implied by the following
item in the input stream.  So the general syntax of the
<code>\tweak</code> command is simply

<pre class="example">\tweak #'<var>layout-property</var> = #<var>value</var>
</pre>
   <p>A <code>\tweak</code> command can also be used to modify just one in
a series of articulations, as shown here:

   <blockquote>
<pre class="verbatim">     
     a ^Black
       -\tweak #'color #red ^Red
       -\tweak #'color #green _Green
</pre>
     <p>
 <a href="../42/lily-b8be0511.ly">
  <img align="middle"
    border="0" src="../42/lily-b8be0511.png" alt="[image of music]">
 </a>
</p>

   </blockquote>

<p class="noindent">Note that the <code>\tweak</code> command must be preceded by an
articulation mark as if it were an articulation itself.

   <p><a name="index-tuplets_002c-nested-344"></a><a name="index-triplets_002c-nested-345"></a><a name="index-bracket_002c-tuplet-346"></a><a name="index-tuplet-bracket-347"></a><a name="index-triplet-bracket-348"></a><a name="index-TupletBracket-349"></a><a name="index-TupletBracket-350"></a>

   <p>The <code>\tweak</code> command must also be used to change the
appearance of one of a set of nested tuplets which begin at the
same musical moment.  In the following example, the long tuplet
bracket and the first of the three short brackets begin at the
same musical moment, so any <code>\override</code> command would apply
to both of them.  In the example, <code>\tweak</code> is used to
distinguish between them.  The first <code>\tweak</code> command
specifies that the long tuplet bracket is to be placed above the
notes and the second one specifies that the tuplet number is to be
printed in red on the first short tuplet bracket.

   <blockquote>
<pre class="verbatim">     
     \tweak #'direction #up
     \times 4/3 {
       \tweak #'color #red
       \times 2/3 { c8[ c8 c8] }
       \times 2/3 { c8[ c8 c8] }
       \times 2/3 { c8[ c8 c8] }
     }
</pre>
     <p>
 <a href="../c9/lily-843979a1.ly">
  <img align="middle"
    border="0" src="../c9/lily-843979a1.png" alt="[image of music]">
 </a>
</p>

   </blockquote>

   <p>If nested tuplets do not begin at the same moment, their
appearance may be modified in the usual way with
<code>\override</code> commands:

<!-- NOTE Tuplet brackets collide if notes are high on staff -->
<!-- See issue 509 -->
   <blockquote>
<pre class="verbatim">     
     \times 2/3 { c8[ c c]}
     \once \override TupletNumber
       #'text = #tuplet-number::calc-fraction-text
     \times 2/3 {
       c[ c]
       c[ c]
       \once \override TupletNumber #'transparent = ##t
       \times 2/3 { c8[ c c] }
     \times 2/3 { c8[ c c]}
     }
</pre>
     <p>
 <a href="../02/lily-f833be4e.ly">
  <img align="middle"
    border="0" src="../02/lily-f833be4e.png" alt="[image of music]">
 </a>
</p>

   </blockquote>

<p class="noindent">

<h5 class="subsubheading">See also</h5>

   <p class="indent">

   <p>Notation Reference:
<a name="index-The-tweak-command-351"></a><a href="../lilypond/The-tweak-command.fr.html#The-tweak-command">The tweak command</a>.

   <!-- footer_tag --><br><hr>
<div class="node">
<p>
Previous:&nbsp;<a rel="previous" accesskey="p" href="Naming-conventions-of-objects-and-properties.fr.html#Naming-conventions-of-objects-and-properties">Naming conventions of objects and properties</a>,
Up:&nbsp;<a rel="up" accesskey="u" href="Tweaking-basics.fr.html#Tweaking-basics">Tweaking basics</a>
</div>

<div style="background-color: #e8ffe8; padding: 2; border: #c0ffc0 1px solid;">
<p>
<font size="-1">
Cette page documente LilyPond-2.11.57 (branche de développement).
<br>
<address>
Rapportez toute anomalie en français à <a href="mailto:lilypond-user-fr@gnu.org">lilypond-user-fr@gnu.org</a> ou en anglais à <a href="http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs">http://post.gmane.org/post.php?group=gmane.comp.gnu.lilypond.bugs</a> </address>
<br>
Vos <a href="http://lilypond.org/web/devel/participating/documentation-adding">suggestions à propos de la documentation</a> sont les bienvenues.
</font>
</p>
</div>


<P>
 Autres langues&nbsp;: <a href="Tweaking-methods.es.html">español</a>.
 <BR>
 
</P>
</BODY></html>