lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

lilypond-book-preamble and multiple bookparts


From: Urs Liska
Subject: lilypond-book-preamble and multiple bookparts
Date: Fri, 13 Apr 2018 18:13:54 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi all,

I try to bring two projects together and finally get to the point where I should properly learn what lilypond-book-preamble.ly actually does.

I have an infrastructure that retrieves and composes the material to be engraved from several places and finally produces the output with ly:book-process.

Now I want to integrate this in a LaTeX volume controlled by lyluatex. lyluatex uses lilypond-book-preamble.ly to produces individual PDFs per system. This didn't work out properly so I started looking into it. And I found the produced somewhat surprising.

This is a MWE to demonstrate how the document is generated:

\version "2.19.80"

%\include "lilypond-book-preamble.ly"

#(ly:book-process
  #{
    \book {
      \bookpart {
        \score { \new Staff { c' } }
        \score { \new Staff { d' } }
      }
      \bookpart {
        \score { \new Staff { e' } }
        \score { \new Staff { f' } }
      }
    }
  #}
  #{ \paper {} #}

  ; non-functional, placeholder
  $defaultlayout
  "unknown")

Expectedly this produces a two-page document with two short scores on each page.

However, if I uncomment the \include things go wrong. Instead of four indexed PDFs with one system each plus one cropped main PDF with all systems on one page I get

- One empty main PDF
- Two PDFs with the cropped content of each page.

Closer inspection reveals that it isn't (directly) related to the use of ly:book-process:

\version "2.19.80"

\include "lilypond-book-preamble.ly"

%\book {
%  \bookpart {
    \score { \new Staff { c' } }
    \score { \new Staff { d' } }
%  }
%  \bookpart {
    \score { \new Staff { e' } }
    \score { \new Staff { f' } }
%  }
%}

This file behaves as expected: There's one FILE.pdf with the four systems on one cropped page, plus four cropped files, one for each score.

However, if I wrap them in one bookpart:

\version "2.19.80"

\include "lilypond-book-preamble.ly"

\book {
  \bookpart {
    \score { \new Staff { c' } }
    \score { \new Staff { d' } }
%  }
%  \bookpart {
    \score { \new Staff { e' } }
    \score { \new Staff { f' } }
  }
}

(I also have to uncomment the \book block then) the result is not what I want anymore: One A4 FILE.pdf with the four scores tucked at the upper left corner plus one indexed file which is also A4 and has the four scores at the top left - but respecting the indent.

If I wrap the scores in *two* bookparts (like the original ly:book-process example):

\version "2.19.80"

\include "lilypond-book-preamble.ly"

\book {
  \bookpart {
    \score { \new Staff { c' } }
    \score { \new Staff { d' } }
  }
  \bookpart {
    \score { \new Staff { e' } }
    \score { \new Staff { f' } }
  }
}

I get one main file like before, plus two indexed files, one for each bookpart - which are now cropped (but respecting the indent).

###

I can *somehow* see how this behaviour relates to the fact that lilypond-book-preamble does stuff with score handlers and such functions. But as I've never understood what these actually do I'm at a loss here.

What I *need* is a way to produce PDFs for the individual systems, just like it's usually done with lilypond-book-preamble. Is it even possible to compile a construct like the first example above to a sequence of systems, or do I have to completely restructure my files so that I generate individual scores in each run?

The problem is that when compiling from LaTeX I will always want to compile a single score. But when compiling from LilyPond (while editing the scores) I need to compile sequences of scores and bookparts.

Thanks for any hints and clarifications

Urs




reply via email to

[Prev in Thread] Current Thread [Next in Thread]