LilyPond: markup text next to barline?

1.5k views Asked by At

I'm working with a score with a ragged-last system, and I'd like to fit a markup column next to the score, thus filling the gap between the final barline and the margin. What are some ways of accomplishing this?

Example:

\paper {
  ragged-last = ##t
}
\score {
  \new Staff <<
    \new Voice = "example" {
      c4 d e f | g a b c
      \bar "|."
    }
  >>
}
\markup {
  \column {
    \line { "Some text I want" }
    \line { "next to the score" }
  }
}
1

There are 1 answers

3
Jan Warchoł On BEST ANSWER

One way to do this would be to override BarLine stencil so that it will contain your markup:

\version "2.18.2"

barlineMarkup = \markup {
  \whiteout
  \pad-around #1
  \vcenter
  \column {
    "Some text I want"
    "next to the score"
  }
}

customBarLine = {
  \once \override Staff.BarLine #'stencil =
  #(lambda (grob)
     (ly:stencil-combine-at-edge
      (ly:bar-line::print grob)
      X RIGHT
      (grob-interpret-markup grob barlineMarkup)
      0))
}

{
  \override Score.BarLine.layer = 1
  c' d' e' c' \customBarLine \bar "|."
}