6

I'm creating score and parts from a single file with various \book blocks, and my instrument parts have some \break and \pageBreak commands, but I want my score to omit those breaks. I thought that something like this would be useful:

\layout {
    \context {
        \Staff \RemoveEmptyStaves
        \omit or \remove [Something, possibly "\break" and "\pageBreak", but that doesn't work]
    }
}

But I can't find any useful resource for omitting breaks throughout my entire score while keeping those in my instrument parts.

8

One possible way would be using tags. The basic idea is very simple: you can give tags to parts of the music and then you can choose which tags to keep.

A very basic example would look like this:

music = {
    c8 d e f g a b c | \tag #'breaks { \break }
    c b a g f e d c | \tag #'breaks { \pageBreak }
}

Both breaks are tagged with the tag #'breaks. Now, in your parts, you would just use \new Staff \new Voice \music (all tagged stuff is kept by default), while in the full score, you would use \new Staff \new Voice \removeWithTag #'breaks \music (everything that has the tag #'music is removed from there).

In your case, you could use some mass search-and-replace facility (I would use sed on Linux but you will probably want something different) to replace each \break with \tag #'breaks { \break }, and similarly for \pageBreak. I'm not sure if that's the best solution, but it will at least work.

And, by the way, if you want to make multiple scores out of one variable, tags are bit of a must. For instance, I needed to write a couple of guitar scores with tablature, and I of course wanted Lilypond to generate the tablature and engrave the score according to the same music, but often there need to be little tweaks for score and other little tweaks for tablature. So I'd use two tags, #'score and #'tab, to mark those tweaks, and then I'd use \keepWithTag #'score \someMusic and \keepWithTag #'tab \someMusic respectively.

2
  • 1
    Wow, I'd never heard of this before. I love learning new LilyPond tricks!
    – Richard
    Aug 8 at 16:42
  • I actually combined both answers and everything was way simpler. Thank you.
    – Kai Vinter
    Aug 9 at 1:37
8

While tags are the more versatile solution, there is always the sledge hammer approach of

    break = {}
    pageBreak = {}

which just overrides the commands.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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