Can I create music sheets with LaTeX?

I have created some examples you might be interested in: martin-thoma.com/how-to-write-music-with-latex - if somebody knows some more complex ones or a page like TeXample, please let me know!

Commented Aug 1, 2012 at 8:47 Commented Jan 20, 2022 at 11:52

6 Answers 6

I'd instead use LilyPond, which, though not based on TeX at all, has similar goals of human-readable plain-text source files and beautiful, customizable output.

answered Aug 3, 2010 at 3:21 Sophie Alpert Sophie Alpert 15.8k 9 9 gold badges 38 38 silver badges 37 37 bronze badges Actually, Lilypond was originally based on TeX, at least partly, but now it's not the case any more. Commented Aug 3, 2010 at 7:32

@Arthur: that's news to me. (Seriously. The last time I used Lilypond was close to 6 years ago, and back then it was based on TeX. I wonder what made them switch.)

Commented Aug 3, 2010 at 10:07

Now it's mostly written in C++ with a Scheme interface to control many aspects of the typesetting process. There also are bits and pieces in Python.

Commented Aug 3, 2010 at 16:11

There's also MusiXTeX or old site https://icking-music-archive.org/software/indexmt6-2012-12.html for the actual typesetting (CTAN). A bit of searching turned up this page about exporting from LilyPond to MusiXTeX.

56.8k 17 17 gold badges 87 87 silver badges 197 197 bronze badges answered Aug 3, 2010 at 7:31 Andrew Stacey Andrew Stacey 156k 45 45 gold badges 394 394 silver badges 758 758 bronze badges Hi! The link to "this page" looks obsolete. Commented Dec 8, 2015 at 16:25

In addition to MusiXTeX, there's also GregorioTeX for gregorian chant. It's apparently very well suited to typesetting this particular type of scores, and is actively maintained.

answered Aug 3, 2010 at 7:38 Arthur Reutenauer Arthur Reutenauer 2,950 20 20 silver badges 17 17 bronze badges

Lilypond provides a tool called lilypond-book for creating LaTeX documents with embedded music pieces inside. The embedding works via images, and baselines are not considered. So if you want to display a clef in the middle of a line, it will only be nicely aligned vertically with the rest of the line after you have tweaked its vertical position using additional LaTeX code.

If you don't want to create a document, but rather music sheets on their own, Lilypond wins hands down in user friendliness. I am considered quite unanimously as a TeX wizard and would no longer think of using the TeX-based approaches for typesetting music.

With regard to its implementation: I think Lilypond has always been C++, has gained some Scheme innards rather early, but used TeX as its typesetting backend internally for quite a long time. However, its current mode of operation is to write PostScript files directly as main output (PDF generation works internally by using Ghostscript on those). As a result, utf-8 characters work rather transparently if the font has them. TeX's track record in that area, in comparison, is less than fabulous although in the last years, a few TeX engines (XeTeX, LuaTeX) that can work with larger character sets than 8bit have been developed.