LilyPond

LilyPond 表示法雕刻機可以通過 lilypond-book 命令與 LaTeX 一起使用。首先讓我們建立一個 LaTeX 文件(副檔名為 .lytex),將我們的音樂嵌入:

\documentclass[letterpaper,12pt]{article}

\begin{document}

\begin{center}
    {\fontsize{24pt}{24pt}\textbf{Twa Corbies}}\\
\end{center}

\begin{flushright}
    \textsc{Your Name}
\end{flushright}

% We don't need to require anything for this because lilypond-book will process it.
\lilypondfile{TwaCorbies.ly}
\end{document}

然後我們建立我們的 LilyPond 檔案(.ly),包括 lilypond-book-preamble.ly 檔案(LilyPond 將知道如何查詢):

\version "2.16.2"

\include "lilypond-book-preamble.ly"

voice = <<
    \relative c' {
        \tempo "con affetto"
        \clef bass
        \key e \minor
        \time 3/4

        a a b | c a a | g a2 |
        a4 a b | c2 ~ c8 a8 | a8 g a2 |
        \bar "|."
    }
    \addlyrics{
        As I was wal -- king all a -- lane
        I heard twa cor -- bies make a mane.
    }
>>

\score {
    <<
        \new Staff = "voice" {
            \voice
        }
    >>
    \layout { }
    \midi {
        \context {
            \Score
            tempoWholesPerMinute = #(ly:make-moment 90 4)
        }
    }
}

為了構建,我們然後執行 lilypond-book 命令:

lilypond-book --include=mymusicsourcedirectory/ --pdf TwaCorbies.lytex

這將輸出包含 LilyPond 雕刻音樂的 PDF:

StackOverflow 文件