When trying to use babel lilypond for music engraving inside org, I have got the following problem: The paper size used by lilypond is always a full page. But what I want is a minimal, growing paper size, suitable for rendering only one or more staffs and not using a full page for that.

What I have tried so far is the following:

#+name: lily_init
#+begin_src lilypond
#(set! paper-alist (cons '("preview" . (cons (* 210 mm) (* 20 mm))) paper-alist))
\paper {
  #(set-paper-size "preview")
\header{ tagline="" }

#+begin_src lilypond :file mixolydian.png :noweb yes
\relative c' {a b c}

Which works, but is not exactly what I expected, as I have to create a paper-size for each staff count I am using.

The example from the ob-lilypond page does not render correctly for me (their example PDF looks fine though). If I try to render it, it renders one lilypond example per page, instead of placing them inline. See: Lilypond Example Org File Lilypond Example PDF

Is this the expected behaviour? Am I doing something wrong? Should I try to fix ob-lilypond?


2 Answers 2


The issue was fixed in f78a3c2b. The code below is no longer needed.

I updated lilypond.org to reflect changes in the lilypond codebase, so I think the problem is fixed, but let me know either way. You can find more information in the documentation. Basically, you will also need:

#(ly:set-option 'use-paper-size-for-page #f)
#(ly:set-option 'tall-page-formats 'pdf)

I use this config for small examples and guitar chords. It works fine when exported.

\paper {
      indent = 0\mm
      top-margin = 100\mm
      bottom-margin = 100\mm
      oddHeaderMarkup = ""
      evenHeaderMarkup = ""
      oddFooterMarkup = ""
      evenFooterMarkup = ""

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.