lilypond-user
[Top][All Lists]
Advanced

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

OpenLilyLib include-pattern, instrument header, and \include layout { }


From: Karlin High
Subject: OpenLilyLib include-pattern, instrument header, and \include layout { }
Date: Tue, 6 Aug 2024 22:21:07 -0500

Continuing from
<https://lists.gnu.org/archive/html/lilypond-user/2024-01/msg00239.html>

Intel Core i5-2400, 16 GB RAM, Windows 10 22H2, LilyPond 2.24.3

My project is an index of tunes for a hymnal that has never been
printed with notation, only lyrics, allowing the use of whatever tunes
are suitable.

The finished tune index will be part of a pocket-size book, 3-3/8" x
5" (85mm x 127mm) with ~10 single staves per page, each with notation
for the first line of a tune as sung.

OpenLilyLib (version 0.6.0) \includePattern is working well to include
233 (and counting) .ly files grouped by meter into 16 subdirectories.
Instead of having to write and maintain \include statements for each
file, there is an \includePattern for each directory.

Ideally, there would be a printed header at each meter change,
repeated at the top of following pages.

At first I tried using bookparts for this:

%
\bookpart {
  \header {
    instrument = "Short Meter"
  }

\includePattern "../M03 Short Meter" \pattern
}
%

That worked reasonably well, except I would like \bookpart to not
cause page breaks with unfull pages when a meter changes.

Now, I also want a global \include file for layout. Editorial feedback
so far, coming from an \aikenThinHeads music tradition, says the Staff
Size 11 I'm using needs larger noteheads and lighter staff lines. I
have the \override statements worked out to get those results. I am
sure there are more such requests to come.

I want the \override statements (or whatever equivalent) which I'd
normally enter in score-level \layout{ } blocks, to work like the
#(set-global-staff-size 11) statement that affects everything
\includePattern brings in. Enter one place, and it "does it to
everything."

But so far, I haven't figured out how to have \includePattern allow
using a variable defined in a top-level \include statement for \layout
{ } inside a \bookpart. Here is what I am seeing, in the Bash from Git
2.14.2.2 for Windows, in hopes of being more Linux-like with file
paths etc.

owner@LenovoM91p MINGW64 ~
$ cat globalLayout.ily
\version "2.24"
globalLayout = \layout {
  indent = 0
}

owner@LenovoM91p MINGW64 ~
$ cat ./tunes/song.ly
\version "2.24"
\include "english.ly"
\include "../globalLayout.ily"

\score {
  c'
  \globalLayout
}

owner@LenovoM91p MINGW64 ~
$ cat book.ly
\version "2.24"
\include "oll-core/package.ily"
\loadModule oll-core.util.include-pattern

pattern = ".*\\.ly"

% Works perfectly
\includePattern "tunes" \pattern

%{ gives error
\bookpart {
  \includePattern "tunes" \pattern
}
%}

If that last error-causing \bookpart is uncommented, it goes:

owner@LenovoM91p MINGW64 ~
$ /c/Program\ Files/lilypond-2.24.3/bin/lilypond.exe book.ly
Processing `book.ly'
Parsing...

oll-core: library infrastructure successfully loaded.
book.ly:12:1: error: syntax error, unexpected SYMBOL

  \includePattern "tunes" \pattern
tunes/../globalLayout.ily:2:1: error: syntax error, unexpected SYMBOL

globalLayout = \layout {
tunes/../globalLayout.ily:2:16: error: need \paper for paper block
globalLayout =
               \layout {
Interpreting music...
Preprocessing graphical objects...
Interpreting music...
Preprocessing graphical objects...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Finding the ideal number of pages...
Fitting music on 1 page...
Drawing systems...
Converting to `book.pdf'...
fatal error: failed files: "book.ly"

I expect I am misunderstanding something about \include and \bookpart.

Concluding summary:

What ways are there,
 to get the behavior of \header { instrument = "whatever" },
as seen with \bookpart,
but without the page breaks,
while having a global \include file for \layout { },
that is effective for everything loaded by OLL's \includePattern statements?

(Feels like the "All in the House That Jack Built" poem, only it is
Han-Wen, Jan, and others in this case.)
--
Karlin High
Missouri, USA



reply via email to

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