Music: Practice & Theory Stack Exchange is a question and answer site for musicians, students, and enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to make music-snippet images using lilypond, but I'd like each snippet to always have trailing "whitespace" so that each of these images is of the same width.

I'm following the suggestions from the documentation, so I have a .ly file something like:

    bookTitleMarkup = ##f
    scoreTitleMarkup = ##f
    \relative c' { c4 d e f | g a b c } %insert whitespace to fill line here

and compile it using 'lilypond -dbackend=eps -dno-gs-load-fonts -dinclude-eps-fonts --png' and it produces a file that is 241 pixels wide.

If I make the snippet three bars, with c4 d e f | g a b c | c b a g, I get a file that is 335 pixels wide.

Ultimately, I'm going to insert these images into a document, and I'd like to be able to use the same width for all of the images, and have the staff/notes be the same size.

I don't want to key off of the height of the images (which is the same) in this case, because some of the snippets will span multiple lines.

share|improve this question
May I refer you to the LilyPond Users mailing list!? See also my answer on this question:… – PeterBjuhr Nov 5 '13 at 19:44
I am a novice when it comes to Lilypond, but I'd try to achieve this by padding the shorter snippets with invisible dummy notes. – Meaningful Username Apr 25 '14 at 18:44
I'm putting them into an org-mode document; I have found that in that context I always want to set the figure width; to keep myself sane, I want to be able to set the same width for all of the snippets -- thus I want Lilypond to do the padding for me. – Dave Apr 25 '14 at 22:45

You can fix this by adding in the \paper section:

  ragged-last = ##f

This will ensure that if your score is only one line, it will use the full line width you've specified.

share|improve this answer
True but not the solution I'm looking for -- short snippets get stretched out to fill the line, resulting in unattractively large spaces between the notes. – Dave Apr 25 '14 at 18:03
I see, so you really want completely white space to fill the right. I don't know what you're using to write the final document, but it seems like if you can left-justify your images to the desired margin, you should be all set with your original lilypond source. You'll end up with appropriate white space in the document itself rather than in the image you insert to the document, and you'll still have the peace of mind knowing that the line-width you set in lilypond will keep things from overflowing to the right. – David Tresner-Kirsch Apr 25 '14 at 21:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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