4

I'm writing a drum sheet template for LilyPond and I'd like to place a drum key box to the left of the header. Here is what I've done so far:

Drum sheet template on LilyPond LilyBin link for fiddling with my markup: http://lilybin.com/yx9viw/1

The problem I'd like to solve is vertically positioning the score or the DrumStaff inside the box, to remove all the blank space at the top. I figure removing the Stem_engraver would help (and is also desirable, since I only want to show the note heads in the drum key), but it doesn't really work (see line 63 on LilyBin), and while \hide-ing the stems does work, it doesn't eliminate the vertical space occupied by them.

So, does anyone know how I can:

  1. Remove (not hide) the stem engraver from the score inside the \box (line 60 on LilyBin), and
  2. Vertically position the entire score so it stays at the top of the \box, thus eliminating all that whitespace?
2
  • 1
    If you use \omit Stem instead of \hide Stem, you will get rid of the stems (and they won't take up any space), but I have no idea about what is making that whitespace. Nor why the stems are rendered when Stem_engraver is removed...
    – Ramillies
    Jan 4, 2018 at 17:30
  • @Ramillies thank you, I didn't know the \omit function =). Eliminating the stems I figured the whitespace is generated by the \markup texts I use to label the note heads. Even when I override the TextScript position using #'extra-offset, the text leaves behind the whitespace it should have occupied without the override. (lilybin.com/yx9viw/3)
    – nunks
    Jan 4, 2018 at 19:42

1 Answer 1

4

Hm, is there any reason why you have the markups with the labels connected to invisible notes on the left and the right? Why not just put it in a line like this: http://lilybin.com/yx9viw/4 .

What I did is \box { \line { \raise #something \left \score { ... } \raise #something \right } }. It works OK it seems. (The #something's were chosen to make the labels match with the note columns.)

(This is better because you can \raise the labels into the right places (this command generally works only for moving a part of markup relative to the rest of the markup).)

2
  • I used invisible notes because I didn't know any better =) Thank you so much, this is a cleaner solution than I was expecting for LilyPond, and the knowledge that the \line function can contain whole \scores opens up a lot of possibilities!
    – nunks
    Jan 5, 2018 at 1:00
  • @nunks.lol: Yeah, the markup system is very general and powerful. \line just grabs some markups and puts them into a line :—). And a markup can contain \score (it's "just" a markup command in the same way as e. g. \italic is). (Maybe you can see why I like Lilypond so much? :—))
    – Ramillies
    Jan 5, 2018 at 12:17

Your Answer

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

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