leadsheets icon indicating copy to clipboard operation
leadsheets copied to clipboard

Include PDF snippet from Lilypond to the song environment

Open tappoz opened this issue 2 years ago • 2 comments

I am trying to include some minimal music score into the \begin{song} ... \end{song} environment. The idea is to provide at the top of the song lyric (with chords) some basic melodies for nursery rhymes e.g. "Old MacDonald has a farm".

I went with a basic Lilypond file just to try something out with the simplest melody.

I have ly/sample.ly with:

% command `lilypond --version`
\version "2.20.0"
{
  c' e' g' e'
}

Then I invoke the following command to generate sample.pdf:

cd $(PWD)/songs/ly && \
	lilypond --pdf --pspdfopt=TeX sample.ly

Then in nursery-rhymes-old-macdonald-had-a-farm.tex inside \begin{song} ... \end{song} I have:

\begin{figure}[htpb]
    \centering
    \includegraphics[width=0.8\textwidth]{ly/sample.pdf}
    \caption{The score for the main melody}
    \label{fig:sample-score}
\end{figure}

But this leads to the error ! LaTeX Error: Not in outer par mode. that I am not able to troubleshoot.

I have to say that I come from an endless list of various attempts, some of the bumps are related to the issues with the command lilypond-book not expanding LaTeX code from this leadsheets library like \includeleadsheet[gobble-preamble=false]{songs/nursery-rhymes-old-macdonald-had-a-farm.tex}.

Is this kind of flow possible at all within leadsheets?

tappoz avatar Jan 12 '22 16:01 tappoz