I am using MuseScore 1.3 on Ubuntu 14.04 to write my scores. Then I save them as LilyPond files, and include them in my tex document using \lilypondfile, like this:



Larger examples can be put into a separate file, and introduced with \verb+\lilypondfile+.



Then, to compile, I do:

$ lilypond-book --pdf solfeo.lytex

$ xelatex solfeo.tex

However, the width of the inserted score doesn't fit into the document, and it extends beyond the limits of the page.

Screenshot of a score that doesn't fit

Also, lilypond-book seems to be ignoring the settings I am passing to it in \lilypondfile[quote,noindent]{scores/Exercise_1.05.ly}. If I understood well, quote prints the notes before the score and noindent removes the indentation of the first line. Neither it is quoting the notes nor is it removing the indentation.

I'm new to Lilypond and I have tried to change the margins of the document in MuseScore, and I tried some tex commands too, but I can't find the way to make it fit. If I compile the ly file with lilypond the PDF looks perfect (but in that case I only get the score). Its only when I embed a .ly file into a .lytex file that the score extends beyond the margins. Would appreciate your suggestions or corrections. ¿What am I doing wrong? Thanks!

Update 1

As @user13554 suggested, I'm pasting the output of the compilation of lilypond-book, although I'm not sure how useful it will be for you, since it it in Spanish:

$ lilypond-book --pdf solfeo.lytex

lilypond-book (GNU LilyPond) 2.18.2
Reading solfeo.lytex...
Running `pdflatex' on file `/tmp/tmpN3IGhy.tex' to detect default page settings.

Writing snippets...
Running lilypond...
GNU LilyPond 2.18.2
Procesando «snippet-map-3001632500490555250.ly»
Procesando «solfeo.lytex»
Renombrando la entrada a: «scores/Exercise_1.05.ly»
Interpretando la música...[8]
Preprocesando los objetos gráficos...
Calculando los saltos de línea... 
Dibujando los sistemas... 
Salida de la página hacia «ba/lily-399811ac.eps»...
Convirtiendo en «ba/lily-399811ac.pdf»...
Salida de la página hacia «ba/lily-399811ac-1.eps»...
Salida de la página hacia «ba/lily-399811ac-2.eps»...
Convirtiendo en «ba/lily-399811ac-1.pdf»...
Convirtiendo en «ba/lily-399811ac-2.pdf»...
Escribiendo «ba/lily-399811ac-systems.texi»...
Escribiendo «ba/lily-399811ac-systems.tex»...
Escribiendo «ba/lily-399811ac-systems.count»...
Enhorabuena. La compilación se ha completado satisfactoriamente.
Linking files...
Compiling /media/admin/DATOS/Dropbox/code/solfeo-book/out/solfeo.tex...
Writing `/media/admin/DATOS/Dropbox/code/solfeo-book/out/solfeo.tex'...

I hope this helps

Update 2

I have tried another approach. I have exported from MuseScore to MusicXML instead. Then I have used:

musicxml2ly Exercise_1.05.xml -o Exercise_1.05_.ly

to convert the .xml file into an .ly file, and compiled again. Still the width is not fitting the screen =( I have run out of ideas.

  • Possibly a bug?
    – Richard
    Nov 9, 2014 at 19:17
  • Most likely MuseScore 1.3 is setting the output width in the ly file it creates. Maybe you could also post the generated .ly file so we can take a look at it?
    – Lazy
    Feb 22, 2023 at 12:49

3 Answers 3


If you use the musicxml2ly approach you could try adding the option --npl which means 'no page layout'. That way you let LilyPond do the layout settings itself, which in my experience not only helps solving problems like yours but also creates a better output.


I'd try to find a way to change the paper variables in the lilypond file, basically to set the page width to be something appropriate for a figure in a document. I'm not sure whether you can do this via MuseScore, but if you go in and edit the .ly file by hand, you should be able to make it narrower.

  • Thanks Dave. I would prefer to avoid editing the .ly file, since I will be generating a lot of files and I need some automation. So editing some settings in MuseScore would be more practical in my case. Cheers Sep 22, 2014 at 12:58

LilyPond comes with documentation. lilypond-book in particular is documented in the Usage Reference. In particular, the option quote does not do what you think it does.

lilypond-book should likely output information on the terminal and complain when it has difficulties figuring out margins and similar. Without that information, diagnosing what goes wrong here is not really possible.

  • I've been reading the LilyPond documentation for almost 3 days now and my eyes are already over the table, he he. I have updated my question to include the output of the compilation. I hope it helps. Sep 22, 2014 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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