<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- header_tag --> <html lang="en"> <head> <title>Spacing - LilyPond snippets</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta name="description" content="LilyPond snippets"> <meta name="generator" content="makeinfo 4.11"> <link title="Top" rel="start" href="index.html#Top"> <link rel="prev" href="Titles.html#Titles" title="Titles"> <link rel="next" href="MIDI.html#MIDI" title="MIDI"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <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="Spacing"></a> Next: <a rel="next" accesskey="n" href="MIDI.html#MIDI">MIDI</a>, Previous: <a rel="previous" accesskey="p" href="Titles.html#Titles">Titles</a>, Up: <a rel="up" accesskey="u" href="index.html#Top">Top</a> <hr> </div> <h2 class="unnumbered">Spacing</h2> <p>These snippets illustrate the Notation Reference, section <a href="../../../Documentation/user/lilypond/Spacing-issues.html#Spacing-issues">Spacing issues</a>. <p><a name="adjusting-lyrics-vertical-spacing.ly"></a> <h3 class="unnumberedsec">Adjusting lyrics vertical spacing</h3> <p>This snippet shows how to bring the lyrics line closer to the staff. <pre class="verbatim"> % Default layout: << \new Staff \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } \new Lyrics \lyricsto melody { aa aa aa aa aa aa aa aa aa } % Reducing the minimum space below the staff and above the lyrics: \new Staff \with { \override VerticalAxisGroup #'minimum-Y-extent = #'(-1 . 4) } \new Voice = melody \relative c' { c4 d e f g4 f e d c1 } \new Lyrics \with { \override VerticalAxisGroup #'minimum-Y-extent = #'(-1.2 . 1) } \lyricsto melody { aa aa aa aa aa aa aa aa aa } >> </pre> <p> <a href="../25/lily-be0a47ca.ly"> <img align="middle" border="0" src="../25/lily-be0a47ca.png" alt="[image of music]"> </a> </p> <p><a name="alignment-vertical-spacing.ly"></a> <h3 class="unnumberedsec">Alignment vertical spacing</h3> <p>By setting properties in <code>NonMusicalPaperColumn</code>, vertical spacing can be adjusted per system. <p>By setting <code>alignment-extra-space</code> or <code>fixed-alignment-extra-space</code> an individual system may be stretched vertically. <p>For technical reasons, <code>\overrideProperty</code> must be used for changing these properties within a staff; <code>\override</code> in a <code>\context</code> block may still be used for global overrides. <pre class="verbatim"> #(set-global-staff-size 13) \relative c'' \new StaffGroup << \new Staff { c1 \break c1 \break c1 \break } \new Staff { c1 | c | c } \new PianoStaff << \new Voice { \set PianoStaff.instrumentName = #"piano" \set PianoStaff.shortInstrumentName = #"pn" c1_"normal" \overrideProperty #"Score.NonMusicalPaperColumn" #'line-break-system-details #'((fixed-alignment-extra-space . 15)) c_"fixed-aligment-extra-space" \overrideProperty #"Score.NonMusicalPaperColumn" #'line-break-system-details #'((alignment-extra-space . 15)) c_"aligment-extra-space" } { c1 | c | c } >> >> </pre> <p> <a href="../9c/lily-a3881ca4.ly"> <img align="middle" border="0" src="../9c/lily-a3881ca4.png" alt="[image of music]"> </a> </p> <p><a name="allowing-fingerings-to-be-printed-inside-the-staff.ly"></a> <h3 class="unnumberedsec">Allowing fingerings to be printed inside the staff</h3> <p>By default, fingering numbers will be printed outside the staff. However, this behavior can be canceled. <pre class="verbatim"> \relative c' { <c-1 e-2 g-3 b-5>2 \once \override Fingering #'staff-padding = #'() <c-1 e-2 g-3 b-5>2 } </pre> <p> <a href="../51/lily-3f70c2ad.ly"> <img align="middle" border="0" src="../51/lily-3f70c2ad.png" alt="[image of music]"> </a> </p> <p><a name="page-label.ly"></a> <h3 class="unnumberedsec">Page label</h3> <p>Page labels may be placed inside music or at top-level, and referred to in markups. <pre class="verbatim"> #(set-default-paper-size "a6") #(define-markup-command (toc-line layout props label text) (symbol? markup?) (interpret-markup layout props (markup #:fill-line (text #:page-ref label "8" "?")))) \book { \markup \huge \fill-line { \null Title Page \null } \pageBreak \label #'toc \markup \column { \large \fill-line { \null Table of contents \null } \toc-line #'toc "Table of contents" \toc-line #'firstScore "First Score" \toc-line #'markA "Mark A" \toc-line #'markB "Mark B" \toc-line #'markC "Mark C" \toc-line #'unknown "Unknown label" } \pageBreak \label #'firstScore \score { { c'2 c' \mark \markup { A (page \concat { \page-ref #'markA "0" "?" ) } } \label #'markA c'2 c' \pageBreak \mark "B" \label #'markB d'2 d' d'2 d' \once \override Score.RehearsalMark #'break-visibility = #begin-of-line-invisible \mark "C" \label #'markC } \header { piece = "First score" } } } </pre> <p> <a href="../78/lily-f538e3cd.ly"> <img align="middle" border="0" src="../78/lily-f538e3cd.png" alt="[image of music]"> </a> </p> <p><a name="proportional-strict-notespacing.ly"></a> <h3 class="unnumberedsec">Proportional strict notespacing</h3> <p>If <code>strict-note-spacing</code> is set spacing of notes is not influenced by bars or clefs within a system. Rather, they are placed just before the note that occurs at the same time. This may cause collisions. <pre class="verbatim"> \paper { ragged-right = ##t } \relative c'' << \override Score.SpacingSpanner #'strict-note-spacing = ##t \set Score.proportionalNotationDuration = #(ly:make-moment 1 16) \new Staff { c8[ c \clef alto c c \grace { d16 } c8 c] c4 c2 \grace { c16[ c16] } c2 } \new Staff { c2 \times 2/3 { c8 \clef bass cis,, c } c4 c1 } >> </pre> <p> <a href="../7b/lily-72ebb147.ly"> <img align="middle" border="0" src="../7b/lily-72ebb147.png" alt="[image of music]"> </a> </p> <p><a name="vertically-aligned-dynamics-and-textscripts.ly"></a> <h3 class="unnumberedsec">Vertically aligned dynamics and textscripts</h3> <p>By setting the <code>Y-extent</code> property to a suitable value, all <code>DynamicLineSpanner</code> objects (hairpins and dynamic texts) can be aligned to a common reference point, regardless of their actual extent. This way, every element will be vertically aligned, thus producing a more pleasing output. <p>The same idea is used to align the text scripts along their baseline. <pre class="verbatim"> music = \relative c'' { c2\p^\markup { gorgeous } c\f^\markup { fantastic } c4\p c\f\> c c\!\p } { \music \break \override DynamicLineSpanner #'staff-padding = #2.0 \override DynamicLineSpanner #'Y-extent = #'(-1.5 . 1.5) \override TextScript #'Y-extent = #'(-1.5 . 1.5) \music } </pre> <p> <a href="../58/lily-531c047d.ly"> <img align="middle" border="0" src="../58/lily-531c047d.png" alt="[image of music]"> </a> </p> <p><a name="vertically-aligning-ossias-and-lyrics.ly"></a> <h3 class="unnumberedsec">Vertically aligning ossias and lyrics</h3> <p>This snippet demonstrates the use of the context properties <code>alignBelowContext</code> and <code>alignAboveContext</code> to control the positioning of lyrics and ossias. <pre class="verbatim"> \paper { ragged-right = ##t } \relative c' << \new Staff = "1" { c4 c s2 } \new Staff = "2" { c4 c s2 } \new Staff = "3" { c4 c s2 } { \skip 2 << \lyrics { \set alignBelowContext = #"1" lyrics4 below } \new Staff \with { alignAboveContext = #"3" fontSize = #-2 \override StaffSymbol #'staff-space = #(magstep -2) \remove "Time_signature_engraver" } { \times 4/6 { \override TextScript #'padding = #3 c8^"ossia above" d e d e f } } >> } >> </pre> <p> <a href="../52/lily-7de9f8d7.ly"> <img align="middle" border="0" src="../52/lily-7de9f8d7.png" alt="[image of music]"> </a> </p> <!-- footer_tag --><br><hr> <div class="node"> <p> Next: <a rel="next" accesskey="n" href="MIDI.html#MIDI">MIDI</a>, Previous: <a rel="previous" accesskey="p" href="Titles.html#Titles">Titles</a>, Up: <a rel="up" accesskey="u" href="index.html#Top">Top</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> </BODY></html>