LaTeX forum ⇒ LyXEmbedding of Lilypond File

Information and discussion about LyX, a WYSIWYM editor, available for Linux, Windows and Mac OS X systems.
Sash
Posts: 3
Joined: Thu Aug 01, 2013 3:33 pm

Embedding of Lilypond File

Postby Sash » Thu Aug 01, 2013 3:39 pm

Hello! I'm trying to embed a LilyPond file in LyX, but when I try to export it to PDF or preview, I get a message.
  1. An error occurred while running:
  2. lilypond -dbackend=eps -dsafe --pdf

Can somebody help me with this?

Tags:

Sash
Posts: 3
Joined: Thu Aug 01, 2013 3:33 pm

Postby Sash » Fri Aug 02, 2013 12:08 am

Ok, solved that somehow, but now I have another problem. The LilyPond snippet takes up a whole page, only to be written on the bottom "Music engraving by LilyPond", like this.
lilypond-lyx.jpg
lilypond-lyx.jpg (10.21 KiB) Viewed 3754 times

When I use the LilyPond extension in Libre Office, it doesn't happen, so maybe it's something with the LyX settings?
Last edited by localghost on Fri Aug 02, 2013 8:38 am, edited 1 time in total.
Reason: Preferably no external links (see Board Rules). Attachments go onto the forum server where possible.

scottkosty
Site Moderator
Posts: 521
Joined: Sat Sep 01, 2012 6:38 am

Postby scottkosty » Fri Aug 02, 2013 12:17 am

Hi Sash,

Please provide a minimal LyX example. Also with LyX questions it's useful if you give your LyX version number, operating system, and TeX distribution (e.g. TeX Live).

Sash
Posts: 3
Joined: Thu Aug 01, 2013 3:33 pm

Postby Sash » Fri Aug 02, 2013 9:59 am

Sure. Here are two .lyx files with their corresponding .ly files that I tried to insert. In the second I tried to crop the .ly file with various settings but either the LilyPond didn't show at all on the pdf preview, or it was taking up a whole page. I guess I don't know how to use the crop with all the 4 parameters. But the strangest thing to me is that with the extension in LibreOffice I don't have such problems at all.

The version of Lyx: 2.0.6-1
TeX, Version 3.1415926 (TeX Live 2009/Debian)
OS: Ubuntu 12.04
Attachments
LyxFiles.zip
(2.09 KiB) Downloaded 144 times

scottkosty
Site Moderator
Posts: 521
Joined: Sat Sep 01, 2012 6:38 am

Postby scottkosty » Sat Aug 03, 2013 9:16 am

Disclaimer: I've never used LilyPond before.

Solution 1:
Inserting LilyPond files with the external material inset uses the following command:
  1. lilypond -dbackend=eps -dsafe --pdf YOURFILE.ly

If you run that manually, you will see that this produces full page EPS and PDF files. Further, these can't be cropped with, e.g. pdfcrop, because of the note (that you mentioned in your post also) at the bottom. To remove this note, take a look here (or just google the message followed by "remove"):
http://lilypond.1069038.n5.nabble.com/R ... 39566.html

You can modify the command run above by going to Tools > Preferences > File Handling > Converters

Solution 2:
In LyX, there is a LilyPond specific manual. It might be in the examples folder or in Help > Specific Manuals > LilyPond (I forget for 2.0.6-1). There you can see examples where the LilyPond code is put in directly to LyX. And as you can see in the output there are no full-page problems. The reason for this is that when you put the LilyPond code in directly, LyX passes all of the LaTeX code to LilyPond so that LilyPond knows to convert everything in-line (that is, understanding that there are things around it). It runs this command:
  1. lilypond-book --safe --pdf --latex-program=pdflatex --lily-output-dir=ly-pdf "lilypond.lytex"


Return to “LyX”

Who is online

Users browsing this forum: No registered users and 3 guests