1

I have many places in my Lilypond score where my line+text combination stand in different heights. I would like them to be in the same height. Here is an example:

enter image description here

I have defined these as:


dord = {\once \override TextSpanner.bound-details.right.text = # " ord "
        \once \override TextSpanner.bound-details.right.stencil-align-dir-y = #0
        \once\override Staff.TextSpanner.bound-details.right.arrow = ##t }
dspt = {\once \override TextSpanner.bound-details.right.text = # "  s.p. "
        \once \override TextSpanner.bound-details.right.stencil-align-dir-y = #0 
        \once\override Staff.TextSpanner.bound-details.right.arrow = ##t }

How can I force them to stay on the same y-position?

2 Answers 2

2

Do you use \new Dynamics? So for instance:

\new Staff { c''4 4 4 4 }
\new Dynamics { s4 s2.\p }
\new Staff { c'4 4 4 4 }
2
  • I don't see the relation of your answer to my question! In what way could using \new Dynamics solve my problem? Please elaborate more.
    – Student
    Commented Jun 28, 2023 at 6:13
  • My answer should have probably been a comment, but @Elements in Space has given a good example.
    – ksnortum
    Commented Jun 28, 2023 at 13:52
2

To get dynamics or similar markup to appear at a constant vertical position, use a \new Dynamic block. Fill this with spacer rests (s) of the right values to get the correct horizontal position. And attach the dynamics/markup to these spacers.
Combine the dynamic block with the regular staff block in parallel (<< \new Dynamics {...} \new Staff {...} >>) .

(This is particularly useful for instruments like piano that have their dynamics centred between two staves.)

dspt = {
    \once\override Staff.TextSpanner.bound-details.right.text = #" s.p."
    \once\override Staff.TextSpanner.bound-details.right.arrow = ##t 
}

dord = {
    \once\override Staff.TextSpanner.bound-details.right.text = #" ord"
    \once\override Staff.TextSpanner.bound-details.right.arrow = ##t
}

<<
     \new Dynamics {
        \dspt s1\startTextSpan |
        s4 s4\stopTextSpan \dord s2\startTextSpan |
        s2 s2\stopTextSpan |
    }
    \new Staff {
        r2 r4 e''8 8 |
        e''16 16 16 16 \repeat tremolo 8 {g''32} \repeat tremolo 16 {32} |
        \repeat tremolo 16 {32} c'''2 |
    }
>>

from the above code, example showing the text spanners at the same vertical position

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.