3

While making a song book I came to a point in which I wanted to insert lilypond code inside a table (tried also a box); this was due to some placing notes around texts and similarly things. But this returns some errors from which I deduced that it cannot be done in the way I'm doing it.

The code looks like this:

\documentclass[a4paper]{article}
\begin{document}
\begin{tabular}{c}
   first cell \\  
   \begin{lilypond} [fragment,relative=2,quote,staffsize=26,verbatim]
     d4 c b a
   \end{lilypond} 
\end{tabular}
\end{document}

Can something like this be done? I want to keep text and notes music in one file. Importing once compiled lilypond notes would works by something like \includegraphic, but music and text would not be in the same file.

Using MiKTex 2.9, Lilypond 2.18.2 on win 7. Files extensions are lytex and compilation is done lilypond-book at first and by pdflatex at second.

3

It can be done, but you must remove the quote option which makes lilypond-book produce \begin{quote} inside a tabular which in turn produces the error. The verbatim option could also be problematic. This should work:

\begin{tabular}{c}
   first cell \\  
   \begin{lilypond} [fragment,relative=2,staffsize=26]
     d4 c b a
   \end{lilypond} 
\end{tabular}

Result of the lilypond snippet inside a tabular environment

You can also use the \lilypond{} command inside a tabular environment for very simple music that does not need any additional braces:

\begin{tabular}{c}
   first cell \\  
   \lilypond[fragment,relative=2,staffsize=26]{d4 c b a}
\end{tabular}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.