Skip to main content
Learn how to typeset musical notation, symbols, and scores professionally in LaTeX.

Rendered Previews (prototype)

Below each relevant code block, we show a “Rendered output” image that illustrates the expected result. These SVGs are placeholders for now; after your approval we can hook in a build step to generate them automatically from the LaTeX examples.

Essential Music Packages

\usepackage{musixtex}       % Complete music typesetting
\usepackage{harmony}        % Chord symbols
\usepackage{guitar}         % Guitar chord diagrams
\usepackage{abc}            % ABC notation support
\usepackage{lilyglyphs}     % LilyPond symbols
\usepackage{leadsheets}     % Lead sheets and songs
Rendered output:

Rendered Output

Packages are loaded in the preamble and produce no visible output. They enable music notation commands throughout your document.

Musical Symbols

SymbolLaTeXDescription
\quarternoteQuarter note
\eighthnoteEighth note
\twonotesBeamed eighth notes
\flatFlat
\sharpSharp
\naturalNatural
𝄞\trebleclefTreble clef
𝄢\bassclefBass clef
𝄐\textmusicalnoteGeneric note

Basic Music Notation

Note Values and Rests

% Note values
\whole          % Whole note
\half           % Half note
\quarter        % Quarter note
\eighth         % Eighth note
\sixteenth      % Sixteenth note

% Rests
\wholerest      % Whole rest
\halfrest       % Half rest
\quarterrest    % Quarter rest
\eighthrest     % Eighth rest

% Dotted notes
\quarter.       % Dotted quarter
\half..         % Double dotted half
Rendered output:

Rendered Output

Displays musical note values: whole note (𝅝), half note (𝅗𝅥), quarter note (♩), eighth note (♪), sixteenth note (𝅘𝅥𝅯). Corresponding rests appear as horizontal bars or symbols. Dotted notes show a small dot after the note head extending the duration by half.

Accidentals and Key Signatures

% Accidentals
C\sharp         % C sharp
B\flat          % B flat
F\natural       % F natural
G\doublesharp   % G double sharp
D\doubleflat    % D double flat

% Key signatures
\keysignature{3\sharp}    % A major / F# minor
\keysignature{2\flat}     % Bb major / G minor
\keysignature{0}          % C major / A minor
Rendered output:

Rendered Output

Shows accidental symbols: C♯ (sharp raises pitch), B♭ (flat lowers pitch), F♮ (natural cancels previous accidental), G𝄪 (double sharp), D𝄫 (double flat). Key signatures display appropriate sharps or flats at the beginning of the staff.

Chord Notation

Chord Symbols with harmony

% Basic chords
\Cma            % C major
\Cmi            % C minor
\Cdim           % C diminished
\Caug           % C augmented

% Seventh chords
\CmaSe          % C major 7
\CmiSe          % C minor 7
\Cdom           % C7 (dominant)
\CmiSeFlat      % C minor 7 flat 5

% Extended chords
\Cnine          % C9
\Celeven        % C11
\Cthirteen      % C13

% Slash chords
C/G             % C major over G
Am/F            % A minor over F
Rendered output:

Rendered Output

Displays professionally formatted chord symbols: Cmaj, Cmin, Cdim, Caug for basic triads. Seventh chords appear as Cmaj7, Cmin7, C7, Cm7♭5. Extended chords show C9, C11, C13. Slash chords display as C/G and Am/F with the bass note after the slash.

Guitar Chord Diagrams

Using the guitar Package

% Basic chord diagram
\gtab{C}{3:002010}
\gtab{G}{3:002220}
\gtab{Am}{X02210}
\gtab{F}{1:X33211}

% With finger positions
\gtab*{D}{XX0232:000132}
\gtab*{Em}{022000:012000}

% Barre chords
\gtab{Bm}{2:X13321}
\gtab{F\sharp m}{2:133111}
Rendered output:

Rendered Output

Renders guitar chord diagrams as fretboard grids showing finger positions. Each diagram displays 6 vertical strings and horizontal frets with dots indicating where to press. X marks strings not played, O marks open strings. Barre chords show a bar across multiple strings.

Simple Scores with MusiXTeX

Basic Staff Notation

\begin{music}
\instrumentnumber{1}
\setstaffs1{1}
\generalmeter{\meterfrac44}
\startpiece

% Simple melody
\notes\qu c\en    % Quarter note C
\notes\hu d\en    % Half note D
\notes\qu{ef}\en  % Quarter notes E and F
\notes\wh g\en    % Whole note G

\endpiece
\end{music}
Rendered output:

Rendered Output

Displays a musical staff with treble clef (𝄞) and 4/4 time signature. Notes appear on the five-line staff: C (quarter), D (half), E-F (quarters), G (whole). Note heads are positioned at correct pitch heights with appropriate stems.

Two-Staff System

\begin{music}
\instrumentnumber{1}
\setstaffs1{2}              % Two staves
\setclef1{\treble\bass}     % Treble and bass clefs
\generalmeter{\meterfrac44}
\startpiece

% Right hand
\notes\qu{ceg}\en           % C major chord
\notes\qu{ceg}\en
% Left hand
\Notes\ql{C}\en
\Notes\ql{G}\en

\endpiece
\end{music}
Rendered output:

Rendered Output

Shows a grand staff (piano system) with treble clef (𝄞) on top and bass clef (𝄢) on bottom, connected by a brace. The right hand plays C major chord (C-E-G) on the upper staff while the left hand plays bass notes C and G on the lower staff.

Lead Sheets with leadsheets

Song Structure

\begin{song}{title={My Song}, 
             composer={John Doe}, 
             key={C major}}

\begin{verse}
\chord{C}This is the \chord{Am}first line
\chord{F}Of my \chord{G}song \chord{C}today
\end{verse}

\begin{chorus}
\chord{F}Sing a\chord{C}long
\chord{G}Everyone \chord{C}sing
\end{chorus}

\end{song}
Rendered output:

Rendered Output

Produces a formatted lead sheet with title “My Song” and composer credit. Verse and chorus sections are labeled. Chord symbols (C, Am, F, G) appear above the lyrics at the appropriate syllables, creating a professional songbook layout.

Rhythm Notation

Time Signatures and Tempo

% Time signatures
\timesignature{4}{4}        % 4/4 time
\timesignature{3}{4}        % 3/4 time
\timesignature{6}{8}        % 6/8 time
\timesignature{5}{4}        % 5/4 time

% Tempo markings
\tempo{Allegro}
\tempo{Andante \quarternote = 72}
\tempo{Presto \halfnote = 140}

% Metronome markings
MM \quarternote = 120
MM \halfnote. = 60
Rendered output:

Rendered Output

Displays time signatures as stacked numbers (4/4, 3/4, 6/8, 5/4). Tempo markings show Italian terms like “Allegro” or “Andante” with metronome values. Metronome markings appear as ”♩ = 120” indicating beats per minute.

Musical Expressions

Dynamics and Articulation

% Dynamics
\pp     % Pianissimo
\p      % Piano
\mp     % Mezzo-piano
\mf     % Mezzo-forte
\f      % Forte
\ff     % Fortissimo

% Crescendo and diminuendo
\cresc  % Crescendo
\dim    % Diminuendo
\<      % Hairpin crescendo
\>      % Hairpin diminuendo

% Articulation
\staccato       % Staccato dot
\accent         % Accent mark
\tenuto         % Tenuto line
\fermata        % Fermata
Rendered output:

Rendered Output

Shows dynamic markings in italic: pp (very soft), p (soft), mp (medium soft), mf (medium loud), f (loud), ff (very loud). Crescendo and diminuendo appear as hairpin wedges (< and >). Articulation marks include staccato dots, accent marks (>), tenuto lines, and fermata symbols (𝄐).

ABC Notation Integration

Using ABC Notation

% ABC notation example
\begin{abc}[name=melody]
X:1
T:Simple Melody
M:4/4
L:1/4
K:C
C D E F | G2 G2 | F E D C | C4 ||
\end{abc}

% Inline ABC
\abcinline{C D E F G}
Rendered output:

Rendered Output

Converts ABC notation into standard music notation. The melody “Simple Melody” appears on a staff in C major, 4/4 time. Notes C-D-E-F followed by two half-note Gs, then F-E-D-C, ending with a whole-note C. Bar lines separate measures.

Musical Analysis

Roman Numeral Analysis

% Roman numerals for harmony
\newcommand{\romnum}[1]{\textsc{#1}}

In C major: \romnum{I} - \romnum{IV} - \romnum{V} - \romnum{I}

% With inversions
\romnum{I}\textsuperscript{6} - \romnum{IV}\textsuperscript{6/4} - \romnum{V}\textsuperscript{7}

% Minor keys (lowercase)
In A minor: \romnum{i} - \romnum{iv} - \romnum{V} - \romnum{i}
Rendered output:

Rendered Output

Displays Roman numeral chord analysis in small caps. Major key progression: I - IV - V - I. Inversions shown with figured bass: I6, IV6/4, V7. Minor key uses lowercase: i - iv - V - i. These symbols appear below the staff in harmonic analysis.

Form Analysis

% Sections
\textbf{A:} mm. 1-8
\textbf{B:} mm. 9-16
\textbf{A':} mm. 17-24

% Phrases
\begin{tikzpicture}
\draw[thick] (0,0) -- (4,0);
\draw[thick] (0,0) -- (0,0.2);
\draw[thick] (4,0) -- (4,0.2);
\node at (2,-0.3) {4 measures};
\end{tikzpicture}
Rendered output:

Rendered Output

Shows musical form sections labeled A (mm. 1-8), B (mm. 9-16), A’ (mm. 17-24) in bold text. Phrase diagrams display horizontal lines with vertical endpoints marking phrase boundaries, with “4 measures” labeled beneath each phrase bracket.

Lyrics and Text

Aligning Lyrics to Music

\begin{music}
\instrumentnumber{1}
\setstaffs1{1}
\setlyrics1{1}
\startpiece

\notes\qu{c}\en
\lyrics{This }
\notes\qu{d}\en
\lyrics{is }
\notes\qu{e}\en
\lyrics{my }
\notes\hu{f}\en
\lyrics{song }

\endpiece
\end{music}
Rendered output:

Rendered Output

Displays a melodic line with lyrics aligned below each note. The words “This is my song” appear with each syllable centered under its corresponding note (C, D, E, F). The half note on “song” shows extended duration.

Musical Tables

Interval Reference Table

\begin{table}[h]
\centering
\begin{tabular}{|l|c|c|}
\hline
\textbf{Interval} & \textbf{Semitones} & \textbf{Example} \\
\hline
Unison & 0 & C-C \\
Minor 2nd & 1 & C-D♭ \\
Major 2nd & 2 & C-D \\
Minor 3rd & 3 & C-E♭ \\
Major 3rd & 4 & C-E \\
Perfect 4th & 5 & C-F \\
Tritone & 6 & C-F♯ \\
Perfect 5th & 7 & C-G \\
\hline
\end{tabular}
\caption{Common musical intervals}
\end{table}
Rendered output:

Rendered Output

Produces a formatted table with columns for Interval, Semitones, and Example. Lists musical intervals from Unison (0 semitones, C-C) through Perfect 5th (7 semitones, C-G), including Minor/Major 2nds, 3rds, Perfect 4th, and Tritone. Includes a caption “Common musical intervals.”

Special Music Characters

Unicode Music Symbols

% Requires fontspec and XeLaTeX/LuaLaTeX
\usepackage{fontspec}

% Musical symbols
🎵 🎶 🎼 🎹 🎸 🎺 🎻 🥁

% Note values
𝅝 𝅗𝅥 𝅘𝅥 𝅘𝅥𝅮 𝅘𝅥𝅯 𝅘𝅥𝅰 𝅘𝅥𝅱 𝅘𝅥𝅲

% Clefs
𝄞 𝄢 𝄡 𝄟 𝄠
Rendered output:

Rendered Output

Displays Unicode music symbols including emoji instruments: 🎵 🎶 🎼 🎹 🎸 🎺 🎻 🥁. Musical notation symbols show note values from whole to 128th notes. Clef symbols display: 𝄞 (treble), 𝄢 (bass), 𝄡 (alto), and percussion clefs.

Best Practices

Choose the Right Package

Select packages based on your needs - MusiXTeX for full scores, harmony for chord symbols

Consistent Notation

Use standard music notation conventions throughout

Clear Layout

Ensure adequate spacing between staves and systems

Compile Multiple Times

Music packages often require multiple compilation passes

Troubleshooting

Common issues:
  • MusiXTeX requires special compilation: Run musixtex command
  • Font conflicts: Some music fonts require specific setup
  • Spacing issues: Manual adjustment often needed for complex scores

Further Reading