Open tappoz opened 2 years ago
without testing it my first guess is that the float is the problem here.
Does
% \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}
work? If yes, I suggest to drop the float and just use a center
environment. Together with the caption
package that would look something like
\begin{center}
\includegraphics[width=0.8\textwidth]{ly/sample.pdf}
\captionof{figure}{The score for the main melody}
\label{fig:sample-score}
\end{center}
The float might be the reason, in fact now I just use \includegraphics
, however I didn't manage to get something working with lilipond-book
.
I found out this LaTeX/Lua package \usepackage[program=/usr/bin/lilypond]{lyluatex}
.
I basically write lots of dummy .tex
files to include just the Lilypond file e.g.
\documentclass{scrartcl}
% `which lilypond`
\usepackage[program=/usr/bin/lilypond]{lyluatex}
\begin{document}
\lilypondfile[staffsize=17]{old-macdonald-had-a-farm.ly}
\end{document}
I then just throw these files away, they help generating the PDF snippet I need (see below).
This generates a folder tmp-ly
where I find a small PDF sample with a filename based on a UUID e.g. 34ca8fd9fddd6b0a8a58f64bb8b5786c-1.pdf
. I cannot force this to have a name of my choice, it looks like an hash-code of whatever I write inside the .ly
file.
I just need to react to whatever is produced in that folder and then do: \includegraphics[width=130mm]{songs/ly/tmp-ly/34ca8fd9fddd6b0a8a58f64bb8b5786c-1}
inside the leadsheets
environment \begin{song} ... \end{song}
.
Now: I doubt leadsheets
was a problem at all, I am not super familiar with LaTeX so I might be missing some obvious context here. Anyway: I got something kind of working with a minimum acceptable automation.
It would be good to combine leadsheets
with Lilypond and perhaps guitar/ukulele chord diagrams. This would lead to very useful songbooks.
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:Then I invoke the following command to generate
sample.pdf
:Then in
nursery-rhymes-old-macdonald-had-a-farm.tex
inside\begin{song} ... \end{song}
I have: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 thisleadsheets
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
?