<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- header_tag --> <html lang="en"> <head> <title>Adding and removing engravers - 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.html#Top"> <link rel="up" href="Contexts-and-engravers.html#Contexts-and-engravers" title="Contexts and engravers"> <link rel="prev" href="Modifying-context-properties.html#Modifying-context-properties" title="Modifying context 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="Adding-and-removing-engravers"></a> Previous: <a rel="previous" accesskey="p" href="Modifying-context-properties.html#Modifying-context-properties">Modifying context properties</a>, Up: <a rel="up" accesskey="u" href="Contexts-and-engravers.html#Contexts-and-engravers">Contexts and engravers</a> <hr> </div> <h4 class="subsection">3.3.5 Adding and removing engravers</h4> <p><a name="index-engravers_002c-adding-311"></a><a name="index-engravers_002c-removing-312"></a> <a name="index-g_t_005cconsists-313"></a><a name="index-g_t_005cconsists-314"></a> <a name="index-g_t_005cremove-315"></a><a name="index-g_t_005cremove-316"></a> <p>We have seen that contexts each contain several engravers, each of which is responsible for producing a particular part of the output, like bar lines, staves, note heads, stems, etc. If an engraver is removed from a context, it can no longer produce its output. This is a crude way of modifying the output, but it can sometimes be useful. <h5 class="subsubheading">Changing a single context</h5> <p>To remove an engraver from a single context we use the <code>\with</code> command placed immediately after the context creation command, as in the previous section. <p>As an illustration, let's repeat an example from the previous section with the staff lines removed. Remember that the staff lines are produced by the <code>Staff_symbol_engraver</code>. <blockquote> <pre class="verbatim"> \new Staff \with { \remove Staff_symbol_engraver } \relative c' { c4 \set fontSize = #-4 % make note heads smaller d e \set fontSize = #2.5 % make note heads larger f g \unset fontSize % return to default size a b } </pre> <p> <a href="../7b/lily-48cfa4dd.ly"> <img align="middle" border="0" src="../7b/lily-48cfa4dd.png" alt="[image of music]"> </a> </p> </blockquote> <p><a name="index-ambitus-engraver-317"></a> Engravers can also be added to individual contexts. The command to do this is <p><code>\consists </code><var>Engraver_name</var>, <p class="noindent">placed inside a <code>\with</code> block. Some vocal scores have an ambitus placed at the beginning of a staff to indicate the range of notes in that staff – see <a name="index-ambitus-318"></a><a href="../music-glossary/ambitus.html#ambitus">ambitus</a>. The ambitus is produced by the <code>Ambitus_engraver</code>, which is not normally included in any context. If we add it to the <code>Voice</code> context, it calculates the range from that voice only: <blockquote> <pre class="verbatim"> \new Staff << \new Voice \with { \consists Ambitus_engraver } \relative c'' { \voiceOne c a b g } \new Voice \relative c' { \voiceTwo c e d f } >> </pre> <p> <a href="../52/lily-280ca753.ly"> <img align="middle" border="0" src="../52/lily-280ca753.png" alt="[image of music]"> </a> </p> </blockquote> <p class="noindent">but if we add the ambitus engraver to the <code>Staff</code> context, it calculates the range from all the notes in all the voices on that staff: <blockquote> <pre class="verbatim"> \new Staff \with { \consists Ambitus_engraver } << \new Voice \relative c'' { \voiceOne c a b g } \new Voice \relative c' { \voiceTwo c e d f } >> </pre> <p> <a href="../e5/lily-79ec3e24.ly"> <img align="middle" border="0" src="../e5/lily-79ec3e24.png" alt="[image of music]"> </a> </p> </blockquote> <h5 class="subsubheading">Changing all contexts of the same type</h5> <p><a name="index-g_t_005clayout-319"></a><a name="index-g_t_005clayout-320"></a> <p>The examples above show how to remove or add engravers to individual contexts. It is also possible to remove or add engravers to every context of a specific type by placing the commands in the appropriate context in a <code>\layout</code> block. For example, if we wanted to show an ambitus for every staff in a four-staff score, we could write <blockquote> <pre class="verbatim"> \score { << \new Staff << \relative c'' { c a b g } >> \new Staff << \relative c' { c a b g } >> \new Staff << \clef "G_8" \relative c' { c a b g } >> \new Staff << \clef "bass" \relative c { c a b g } >> >> \layout { \context { \Staff \consists Ambitus_engraver } } } </pre> <p> <a href="../e2/lily-9a2a7276.ly"> <img align="middle" border="0" src="../e2/lily-9a2a7276.png" alt="[image of music]"> </a> </p> </blockquote> <p class="noindent">The values of context properties may also be set for all contexts of a particular type by including the <code>\set</code> command in a <code>\context</code> block in the same way. <p class="noindent"> <h5 class="subsubheading">See also</h5> <p class="indent"> <p>Notation Reference: <a name="index-Modifying-context-plug_002dins-321"></a><a href="../lilypond/Modifying-context-plug_002dins.html#Modifying-context-plug_002dins">Modifying context plug-ins</a>, <a name="index-Changing-context-default-settings-322"></a><a href="../lilypond/Changing-context-default-settings.html#Changing-context-default-settings">Changing context default settings</a>. <!-- footer_tag --><br><hr> <div class="node"> <p> Previous: <a rel="previous" accesskey="p" href="Modifying-context-properties.html#Modifying-context-properties">Modifying context properties</a>, Up: <a rel="up" accesskey="u" href="Contexts-and-engravers.html#Contexts-and-engravers">Contexts and engravers</a> </div> <div style="background-color: #e8ffe8; padding: 2; border: #c0ffc0 1px solid;"> <p> <font size="-1"> This page is for LilyPond-2.11.57 (development-branch). <br> <address> Report errors to <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> Your <a href="http://lilypond.org/web/devel/participating/documentation-adding">suggestions for the documentation</a> are welcome. </font> </p> </div> <P> Other languages: <a href="Adding-and-removing-engravers.fr.html">français</a>, <a href="Adding-and-removing-engravers.es.html">español</a>. <BR> </P> </BODY></html>