Quoting Jon Wild <[EMAIL PROTECTED]>:

How can I specify a layout block that applies to all scores in a book? I wrote a program to generate musical examples, and each snippet is to go on its own staff. So my program writes them in separate scores like this, each with its own layout block:

==begin .ly file==

\book {
  \score {
    { <c' ees' fes' g' aes'>1 <cis' d' eis' fis' a'>1 }
    \layout {
      ragged-right = ##t
      \context {
        \Staff
        \remove "Time_signature_engraver"
        \remove "Bar_engraver"
      }
    }
  }
  \score {
    { <c' des' e' f' aes'>1 <d' ees' fis' g' bes'>1 <a' c'' des'' e''
f''>1 <b' d'' ees'' fis'' g''>1 }
    \layout {
      ragged-right = ##t
      \context {
        \Staff
        \remove "Time_signature_engraver"
        \remove "Bar_engraver"
      }
    }
  }
}

==end .ly file==

But when there are dozens of snippets in the file, the file is much bigger than it needs to be because of the duplication of layout instructions. Can I include a layout block once to cover all scores in the book? If so, where does it go? I tried this structure:

\book {
  \layout {
  }
  \score {
  }
  \score {
  }
}

but that didn't work. Thanks for any tips.  --Jon


Strange, that's what I would have proposed. However, if your .ly file only has a single \book{...} block, then you can simply remove the "\book{" and corresponding right brace at the end, since LilyPond automatically adds an implicit \book block
if there isn't one in the file. Then, you can do
\layout {
 ...
}
\score {
...
}
\score {
...
}
...


The only reason to explicitly use \book in a .ly file is if you have several of them, since each \book block will
result in a separate PDF output file.

  /Mats




_______________________________________________
lilypond-user mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to