1

I am trying to place two LilyPond musical examples side-by-side in a LaTeX document, with captions. How can I achieve that?

This is the code I am using:

\usepackage{float}  
...
\begin{document}  
...  
  \begin{minipage}  
      \begin{example}  
       \centering  
\begin{lilypond}[staffsize=12]

Musical Example 1 comes here

\end{lilypond}
      \caption{Caption 1} 
      \label{ex1}
  \end{minipage}
  \begin{minipage}  
      \begin{example}  
       \centering  
\begin{lilypond}[staffsize=12]

Musical Example 2 comes here

\end{lilypond}
      \caption{Caption 2} 
      \label{ex2}
  \end{minipage}
\end{document}  

By the way, TeXShop with the LilyPond-Book implementation is a life saver!

Lotto
  • 63
  • Well, it was a question about a writting music excerpts in a DMA dissertation. Sorry if I cause any trouble,.. – Lotto May 11 '17 at 18:18

1 Answers1

0

(Apologies for posting this answer both here and at TeX.SE, but I wanted to be thorough. Please don't upvote.)

Your MWE is missing some information, but this seems to work fine for me:

\documentclass{article}

\begin{document}

\begin{figure}
    \centering
    \begin{minipage}{.5\textwidth}
        \centering
        \begin{lilypond}[fragment]
            c4
        \end{lilypond}
    \end{minipage}%
    \begin{minipage}{.5\textwidth}
        \centering
        \begin{lilypond}[fragment]
            c4
        \end{lilypond}
    \end{minipage}
\end{figure}

\end{document}

(Compiled with lilypond-book --output=out --pdf file.lytex, cd out, and pdflatex file.tex.)

enter image description here

Richard
  • 2,084