<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- header_tag --> <html lang="en"> <head> <title>The set command - GNU LilyPond Notation Reference</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="description" content="GNU LilyPond Notation Reference"> <meta name="generator" content="makeinfo 4.11"> <link title="Top" rel="start" href="index.de.html#Top"> <link rel="up" href="Modifying-properties.de.html#Modifying-properties" title="Modifying properties"> <link rel="prev" href="Overview-of-modifying-properties.de.html#Overview-of-modifying-properties" title="Overview of modifying properties"> <link rel="next" href="The-override-command.de.html#The-override-command" title="The override command"> <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="The-set-command"></a> Next: <a rel="next" accesskey="n" href="The-override-command.de.html#The-override-command">The override command</a>, Previous: <a rel="previous" accesskey="p" href="Overview-of-modifying-properties.de.html#Overview-of-modifying-properties">Overview of modifying properties</a>, Up: <a rel="up" accesskey="u" href="Modifying-properties.de.html#Modifying-properties">Modifying properties</a> <hr> </div> <h4 class="subsection">5.3.2 The <code>\set</code> command</h4> <p><a name="index-properties-2683"></a><a name="index-g_t_005cset-2684"></a><a name="index-g_t_005cset-2685"></a> <a name="index-changing-properties-2686"></a> Each context can have different <em>properties</em>, variables contained in that context. They can be changed during the interpretation step. This is achieved by inserting the <code>\set</code> command in the music, <pre class="example">\set <var>context</var>.<var>prop</var> = #<var>value</var> </pre> <p>For example, <blockquote> <pre class="verbatim"> R1*2 \set Score.skipBars = ##t R1*2 </pre> <p> <a href="../e9/lily-798ce3d9.ly"> <img align="middle" border="0" src="../e9/lily-798ce3d9.png" alt="[image of music]"> </a> </p> </blockquote> <p>This command skips measures that have no notes. The result is that multi-rests are condensed. The value assigned is a Scheme object. In this case, it is <code>#t</code>, the boolean True value. <p>If the <var>context</var> argument is left out, then the current bottom-most context (typically <code>ChordNames</code>, <code>Voice</code>, or <code>Lyrics</code>) is used. In this example, <blockquote> <pre class="verbatim"> c8 c c c \set autoBeaming = ##f c8 c c c </pre> <p> <a href="../db/lily-c1dd1c9a.ly"> <img align="middle" border="0" src="../db/lily-c1dd1c9a.png" alt="[image of music]"> </a> </p> </blockquote> <p class="noindent">the <var>context</var> argument to <code>\set</code> is left out, so automatic beaming is switched off in the current <a name="index-Voice-2687"></a><a href="../lilypond-internals/Voice.de.html#Voice">Voice</a>. Note that the bottom-most context does not always contain the property that you wish to change – for example, attempting to set the <code>skipBars</code> property (of the bottom-most context, in this case <code>Voice</code>) will have no effect. <blockquote> <pre class="verbatim"> R1*2 \set skipBars = ##t R1*2 </pre> <p> <a href="../e7/lily-6ed882bb.ly"> <img align="middle" border="0" src="../e7/lily-6ed882bb.png" alt="[image of music]"> </a> </p> </blockquote> <p>Contexts are hierarchical, so if a bigger context was specified, for example <code>Staff</code>, then the change would also apply to all <code>Voice</code>s in the current stave. The change is applied ‘on-the-fly’, during the music, so that the setting only affects the second group of eighth notes. <p><a name="index-g_t_005cunset-2688"></a><a name="index-g_t_005cunset-2689"></a> <p>There is also an <code>\unset</code> command, <pre class="example">\unset <var>context</var>.<var>prop</var> </pre> <p class="noindent">which removes the definition of <var>prop</var>. This command removes the definition only if it is set in <var>context</var>, so <pre class="example">\set Staff.autoBeaming = ##f </pre> <p class="noindent">introduces a property setting at <code>Staff</code> level. The setting also applies to the current <code>Voice</code>. However, <pre class="example">\unset Voice.autoBeaming </pre> <p class="noindent">does not have any effect. To cancel this setting, the <code>\unset</code> must be specified on the same level as the original <code>\set</code>. In other words, undoing the effect of <code>Staff.autoBeaming = ##f</code> requires <pre class="example">\unset Staff.autoBeaming </pre> <p>Like <code>\set</code>, the <var>context</var> argument does not have to be specified for a bottom context, so the two statements <pre class="example">\set Voice.autoBeaming = ##t \set autoBeaming = ##t </pre> <p class="noindent">are equivalent. <p><a name="index-g_t_005conce-2690"></a>Settings that should only apply to a single time-step can be entered with <code>\once</code>, for example in <blockquote> <pre class="verbatim"> c4 \once \set fontSize = #4.7 c4 c4 </pre> <p> <a href="../c9/lily-23b8cd12.ly"> <img align="middle" border="0" src="../c9/lily-23b8cd12.png" alt="[image of music]"> </a> </p> </blockquote> <p>the property <code>fontSize</code> is unset automatically after the second note. <p>A full description of all available context properties is in the program reference, see <a name="index-Tunable-context-properties-2691"></a><a href="../lilypond-internals/Tunable-context-properties.de.html#Tunable-context-properties">Tunable context properties</a>. <!-- footer_tag --><br><hr> <div class="node"> <p> Next: <a rel="next" accesskey="n" href="The-override-command.de.html#The-override-command">The override command</a>, Previous: <a rel="previous" accesskey="p" href="Overview-of-modifying-properties.de.html#Overview-of-modifying-properties">Overview of modifying properties</a>, Up: <a rel="up" accesskey="u" href="Modifying-properties.de.html#Modifying-properties">Modifying properties</a> </div> <div style="background-color: #e8ffe8; padding: 2; border: #c0ffc0 1px solid;"> <p> <font size="-1"> Diese Seite ist für LilyPond-2.11.57 (Entwicklungszweig). <br> <address> Fehler bitte an <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> melden. </address> <br> Ihre <a href="http://lilypond.org/web/devel/participating/documentation-adding">Vorschläge für die Dokumentation</a> sind willkommen. </font> </p> </div> <P> Andere Sprachen: <a href="The-set-command.fr.html">français</a>, <a href="The-set-command.es.html">español</a>. <BR> </P> </BODY></html>