[XeTeX] XETEX and Lilypond

Gareth Hughes garzohugo at gmail.com
Mon Mar 1 00:52:49 CET 2010

Fr. Michael Gilmary wrote:
> Raphael Frey wrote:
>> Hello everyone,
>> I’m a musician and I often have to write documents including notes.
>> Since a while now I use Lilypond and LATEX for this purpose but I’d like
>> to change to XETEX because of the Open Type support. (I’m a typography
>> enthusiast and my preferred free font Linux Libertine has some features
>> [1] that cannot be accessed by LATEX.) Unfortunately lilypond-book
>> doesn’t work with files including XETEX source code. While looking for
>> some tutorials or informations on the Internet I came across this short
>> “tutorial” [2] in the archive of this mailing list. The technique
>> described there – separating the header from the rest of the document
>> (“main text”) – does’t seem to be a problem for lilypond-book – although
>> the content of the header file plus the content of the “main text” file
>> is identical to the single file where lilypond-book doesn’t work, what I
>> don’t understand. However there’s something wrong with the PDF file
>> generated by XETEX (respectively xelatex): the (virtual) box with the
>> notes doesn’t stop at the right page margin (see attached files). I also
>> wonder why lilypond-book works with a separate header and a “main text”
>> file but not with one single file including the whole source text.
>> The attached file test.tex is a simple LATEX file that works without any
>> problems. The two separated files I’d like to use with XETEX are
>> headers.tex and document.tex; they are nearly identical to test.tex. The
>> last document, headers.pdf, shows what I get when executing:
>> lilypond-book --output=out/ --pdf headers.tex
>> cd out
>> xelatex headers.tex
> Hi Raphael:
> Here's a sample of your original = document.tex with a couple changes
> (using the ifxetex package, etc --- change the fonts to suit your
> needs). Also attached is an engine you can run via TeXShop if you're on
> Mac (copy it to ~/Library/TeXShop/Engines/ and it should appear in the
> drop down box for engines ... or you can use the preliminary %!TEX
> TS-program =  Lilypond-XeLaTeX line as in the included file). Otherwise,
> just use the lilypond-book as you have learned and it will do as you need.
> You might have to look into the engine file to set the path to your
> Lilypond.app.
> HTH.

Yes, you just have to hide the XeTeX-specific bits of the header from
Lilypond-Book, and using ifxetex is the easiest way to do this.


More information about the XeTeX mailing list