Jump to content

Vertically aligned dynamics and textscripts: Difference between revisions

From LilyPond wiki
Import snippet from LSR
 
mNo edit summary
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
All <code>DynamicLineSpanner</code> objects (hairpins and dynamic texts) are placed with their reference line at least <code>'staff-padding</code> from the staff, unless other notation forces them to be farther. Setting <code>'staff-padding</code> to a sufficiently large value aligns the dynamics.
For all <code>DynamicLineSpanner</code> objects (i.e., hairpins and dynamic texts), the vertical minimum distance between their reference line and the staff is given by the value in the <code>staff-padding</code> property, unless other notation elements forces them to be farther away. Setting this property to a sufficiently large value aligns the dynamics.


The same idea, together with <code>\textLengthOn</code>, is used to align the text scripts along their baseline.
The same idea, together with <code>\textLengthOn</code>, is used to align text scripts along their baseline.


<lilypond version="2.24.0" full>
<lilypond version="2.24">
music = \relative c' {
music = \relative c' {
   a'2\p b\f
   a'2\p b\f
Line 18: Line 18:
   \music
   \music
}
}
\paper { tagline = ##f }
</lilypond>
</lilypond>


[[Category:Spacing]]
[[Category:Spacing]]
[[Category:Tweaks and overrides]]
[[Category:Tweaks and overrides]]
[[Category:Workaround]]
[[Category:Included in the official documentation]]
[[Category:Included in the official documentation]]
[[Category:Workaround]]
[[Category:Snippet]]

Latest revision as of 15:46, 30 December 2025

For all DynamicLineSpanner objects (i.e., hairpins and dynamic texts), the vertical minimum distance between their reference line and the staff is given by the value in the staff-padding property, unless other notation elements forces them to be farther away. Setting this property to a sufficiently large value aligns the dynamics.

The same idea, together with \textLengthOn, is used to align text scripts along their baseline.

\version "2.24"

music = \relative c' {
  a'2\p b\f
  e4\p f\f\> g, b\p
  c2^\markup { \huge gorgeous } c^\markup { \huge fantastic }
}

{
  \music
  \break
  \override DynamicLineSpanner.staff-padding = 3
  \textLengthOn
  \override TextScript.staff-padding = 1
  \music
}