lilypond-book
generates each line/system as an independent PDF. Those PDFs contain no padding, and so if you have no dynamics, staff-text or ledger lines, the staffs can get crammed together like this.
Vertical space needs to be manually added between the staffs. But you don't want to manually edit lilypond-book
's auto-generated *.tex
because that change will get overwritten next time you run lilypond-book
.
Instead, define \betweenLilyPondSystem
. This macro is used in the generated *.tex
between each system, and the first argument (#1
) describes the number of systems that came before it.
In the question above, we need extra space after the first two lines, so we can use \ifnum#1<3 ... \fi
to add something that only applies to the first two gaps:
\def\betweenLilyPondSystem#1{
\ifnum#1<3\vspace{\baselineskip}\fi
\newline
}
Don't forget to reset the macro, so it doesn't affect anything you may include later:
\let\betweenLilyPondSystem\undefined
The full solution therefore looks like this:
\documentclass{book}
\begin{document}
Some text
\def\betweenLilyPondSystem#1{\newline\ifnum#1<3\vspace{1.5\baselineskip}\fi}
\lilypondfile{short-excerpt.ly}
\let\betweenLilyPondSystem\undefined
More text
\end{document}
And the output looks a lot better. You could play with the gain in-front of \baselineskip
to try to make the spacing "even", but I don't think "even-ness" is something we need to strive for.
There's some info about that here:
https://lilypond.org/doc/v2.23/Documentation/usage/latex
A couple of other hints for spacing:
\def\betweenLilyPondSystem#1{\par}
will add a paragraph between each line. Normally, a \pagebreak
will cause the space between paragraphs to increase to fill the page, and this will have an effect on this too.
Alternatively, the following will force as much space as needed between systems to fill the page.
\def\betweenLilyPondSystem#1{\vspace{\fill}\newline}