Page size goes haywire

Eric Benson <[email protected]> Mon, 29 Jun 2026 11:16:37 -0700
Newsgroups gmane.comp.gnu.lilypond.devel
Message-ID <CAGbpyz6GCGE=8bAZdUNjaxf+ZGKuZEA-G0_St11PY=mf8Wv=gw@mail.gmail.com>
I have a large collection of lead sheets in LilyPond I've been working on
for several years. I believe I may have stumbled upon a strange bug. I had
been engraving these individually and assembling PDFs using LaTeX, but the
resulting files were huge because each separate PDF has its own separate
copy of its fonts. Combining PDFs this way doesn't offer any way to combine
fonts. I finally broke down and figured out how to compile these books
entirely within LilyPond, so the largest native-buit PDF is now about 10%
of the size of the assembled PDF.

Anyway, in the process of building these books I encountered a strange
problem. There is a particular song that causes the engraving to either go
past the right edge and bottom edge of the page, or shrink both margins so
that it uses a smaller part of the page. This condition persists in the
book until it engraves a different particular song that sets it back to the
correct size. I use a somewhat complicated system of include files to
enable these songs to be typeset in different keys. There is one key for
the "wrong size" song that makes it get too large. All the other keys that
I've tried make it get too small. The song is written in D, but if I
transpose it to C it spills over the limits of the page. If I keep it in D
or transpose to some other key it shrinks to a smaller portion of the page.
This new page size stays until the "right size" song gets engraved, then
the rest of the book uses the correct size.

Unfortunately, it isn't easy for me to isolate this to a simple example. My
project has gotten quite large and I have a somewhat complicated system of
\include files that I use to enable transpositions and to keep the layout
separate from the core music description. Fortunately a two-song book is
enough to illustrate the problem. I keep my source code in a public
repository on GitHub, so it wouldn't be too hard for a LilyPond maintainer
to set up the environment. I have some shell scripts and Python scripts
that I use, but I believe I have created a test case that would work with
this GitHub repository using only LilyPond itself.

I would be happy to find a workaround to avoid this problem, but I would
also like to do what I can to fix a bug that, although perhaps rare, is
something I'm sure you would like to see fixed.

My GitHub repository is

https://github.com/neonscribe/lilypond-lead-sheets

I have a couple of PDFs that I can share to show what happens, about 200KB
apiece. Please let me know if this is something that would be of interest.