Page 1 of 1

Lyx and Lilypond

Posted: Thu Aug 01, 2013 10:01 pm
by Aleks
I'm trying to write some excercises and lessons using Lyx and Lilypond, but the lilypond snippet takes up a whole page, only to be written on the bottom "music engraving by lilypond", like this:

Image

When I use the lilypond extension in LibreOffice, it doesn't happen, so maybe it's something with the Lyx settings?

Re: Lyx and Lilypond

Posted: Fri Aug 02, 2013 6:47 am
by raboof
Aleks wrote:When I use the lilypond extension in LibreOffice, it doesn't happen, so maybe it's something with the Lyx settings?
It's been ages since I last used lilypond, but isn't this a lilypond option? (that perhaps LibreOffice sets correctly by default?)

LyX is pretty cool btw. Used it a lot when i was still at uni.

Re: Lyx and Lilypond

Posted: Fri Aug 02, 2013 7:07 am
by Joermungand
Hi, I’m quite familiar with LyX, although not so much with Lilypond. Could you upload a sample LyX file I can look at? I’m positive it’s only a matter of options… I ran the LyX Lilipond example file and it typeset correctly.

Re: Lyx and Lilypond

Posted: Fri Aug 02, 2013 7:58 am
by Aleks
Yeah, ofcourse.

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

Re: Lyx and Lilypond

Posted: Fri Aug 02, 2013 9:23 am
by Joermungand
OK, I got to the bottom of this. The whole thing about cropping is that the coordinates should be given in bp (big point; 1 in = 72 bp; 1 cm = 72/2.54 bp). It turns out the LyX dialogue will not allow you to input units (e.g. 20 cm) hence you will have to convert all coordinate values to bp. All coordinates are measured from the lower left corner of the Lilypond page (which is the normal page size on your system (mine is A4)), so you need to input the x and y coordinates of the crop’s bottom left and top right corners respectively, with respect to the whole (Lilypond) page.

You can see the values in the LyX file I’ve attached and the resulting pdf.

Of course, fiddling with values is not exactly anyone’s idea of fun. I got much quicker results by using LyX’s ‘LilyPond Book’ module (Document > Settings > Modules). This provides you with a custom inset (available under Insert > Custom insets), which will allow you to paste the Lilypond code directly in the document and will result in an appropriately cropped picture.

Please let me know if it works any better.

Re: Lyx and Lilypond

Posted: Fri Aug 02, 2013 12:51 pm
by Aleks
...Custom insets...
As you said, who would fiddle around with crop stettings, this is just what I needed. Thank you very much :)

Re: Lyx and Lilypond

Posted: Fri Aug 02, 2013 3:15 pm
by Joermungand
You’re welcome. Please post back if you run into any other issue (there might be a few, apparently). There is also a dedicated manual for this (available under ‘Help > Specific Manuals’) you might want take a look at as well. It explains some of its idiosyncrasies.

Re: Lyx and Lilypond

Posted: Fri Aug 02, 2013 9:31 pm
by Aleks
Well, I just ran into a problem, actually. Is there a way to make Lyx to export/print Cyrillic characters by using unicode? I tried this:


http://wiki.lyx.org/Tips/Cyrillic

But it's not working.

EDIT: Solved! I had to install Cyrillic support for texlive from the Software Center. I just lo-oove Linux :D