4

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" }
  }
}
Micah Walter
  • 908
  • 9
  • 19

1 Answers1

6

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 "|."
}
Jan Warchoł
  • 1,063
  • 1
  • 9
  • 22
  • I compiled the code above with Frescobaldi, and the text and the final bar line are colliding. I slightly tweaked the second line of the code into `\with-dimensions #'(-1 . -1) #'(0 . 0)` to get a nicer looking result. – gilbertohasnofb Sep 14 '13 at 16:27
  • 1
    Well, they touch (i wouldn't call that a collision). But your're right, using different values for with-dimensions gives nicer result. – Jan Warchoł Sep 14 '13 at 21:27
  • Any idea about how to get this to work with `\include lilypond-book-preamble.ly`? The markup ends up outside the box and is chopped. – JMH Jun 13 '14 at 12:01