Typesetting music in LaTeX

If you have simple notations (folk tunes and the like), something like ABC might be a good fit. Simple markup-based notation, but prints to LaTeX. Wikipedia has a good example

X:1
T:The Legacy Jig
M:6/8
L:1/8
R:jig
K:G
GFG BAB | gfg gab | GFG BAB | d2A AFD |
GFG BAB | gfg gab | age edB |1 dBA AFD :|2 dBA ABd |:
efe edB | dBA ABd | efe edB | gdB ABd |
efe edB | d2d def | gfe edB |1 dBA ABd :|2 dBA AFD |]

Which produces

ABC example png http://en.wikipedia.org/wiki/File:Legacy_jig.png


How about LilyPond? It uses its own plaintext notation, but uses TeX for output. The engine itself uses a whole slew of measures to analyze the music and produce pretty sheet music, so it's automated to a much greater extent than MusixTex is.


Lilypond has a preprocessor called lilypond-book that lets you mix LaTeX code with Lilypond code in one source file.

Sample usage: tsst.lytex contains this:

\documentclass{article}
\begin{document}
\begin[quote,fragment,staffsize=26]{lilypond}
c' d' e'
\end{lilypond}
\end{document}

It also supports inline notation (instead of a display), and reading from external files.

Compile it with lilypond-book --pdf tsst.lytex, producing pdf images of each system along with a LaTeX file tsst.tex that includes the snippets, which compiles as usual with pdflatex.

Tags:

Latex