[Tex/LaTex] Complex musical chords

musicmusicology

For my thesis in musicology (somebody create that tag!) that is due this monday I need help figuring out how to achive notation of complex musical chords in Latex. I have tried every googable solution for stacking symbols in math mode and i have looked for packages that does this the right way, but alas… Lilypond is of no use either, as the chord notation there is ugly beyond belief (that being said, i love it for typesetting everything else).

Examples of my two attempts are pitiful.

\documentclass{article}

\begin{document}
C\(^{7}\dbinom{\sharp7}{\sharp5}\)

\end{document}

The first one does not format correctly at all, the second one is sort of right, but is HUMONGOUS and ugly.

What i need is what my notation program does, as seen in the bottom example.

I'm using Tufts class and lilyglyphs for musical symbols, compiling in LuaLatex.

Example

Temporary solution

\documentclass{article}
%-----------------------------------------------------------------------------
% Packages
%-----------------------------------------------------------------------------
\usepackage{fontspec}
\usepackage{lilyglyphs}
\usepackage{mathtools}
%-----------------------------------------------------------------------------
% Commands
%-----------------------------------------------------------------------------
\newcommand{\tinysharpx}[1][0.10ex]{\hspace*{#1}\sharp[scale=.7]\hspace*{#1}} % Makes some room around the symbol and scales it down to better fit stacking
\newcommand{\tinyflatx}[1][0.10ex]{\hspace*{#1}\flat[scale=.7]\hspace*{#1}}
\newcommand\bigchord[4]{\(\text{#1}^{#2}\mkern-3mu\relax(\mathop{}\limits\mkern-3mu\relax{}^{#3}_{#4})\)} % makes a four argument operator 
%-----------------------------------------------------------------------------
% Document
%-----------------------------------------------------------------------------
\begin{document}

\bigchord{C}{7}{\tinysharpx 9}{\tinysharpx 5}

\end{document}

Output

Output

Still needs fixing

1) Adjusting the lilypond symbol to become as tall as the number (as in the Sibelius example).

2) Adjusting the distance between the two stacked numbers. Needs to be a little bit tighter.

Best Answer

Does the following come close to what you need?

\documentclass{article}
\usepackage{fontspec}
\usepackage{lilyglyphs}
\usepackage{mathtools}

\begin{document}

C\(^{7}\hspace*{-.5ex}\binom{\sharp[scale=.6]7}{\sharp[scale=.6]5}\)

\end{document}

enter image description here

Of course the actual size of the sharps and the space between the key and the parens may depend on the actual text font.

I think it would be a good idea to create a proper parametrization and think about making proper commands for chord symbols. The question is whether this should be integrated in lilyglyphs or if we should create a new package chordsymbols.

Related Question