4

Talking about music using lilypond-book and LaTeX.

It's going great. Now I'm trying to use lilypond snippet simply to display the \flat glyph.

I want to show you what 
\begin{lilypond}
\paper {
    left-margin = .1\in
    right-margin = .1\in
}
 \new ChordNames \with {
  \override ChordName #'font-size = #-3
} {bes}
\end{lilypond} and 
\begin{lilypond}
\paper {
    left-margin = .1\in
    right-margin = .1\in
}
 \new ChordNames \with {
  \override ChordName #'font-size = #-3
} {bis}
\end{lilypond}

What it looks like is this:

Picture of text and musical elements inline.

The \paper directive doesn't seem to be doing anything.

There must be an easier way.

  • Why not B$\flat$ and B$\sharp$? – cgnieder Aug 30 '16 at 17:07
  • 1
    Because I needed to do way more work than necessary! Thank you. What are those dollar signs all about? – MikeiLL Aug 30 '16 at 17:11
  • $ switches to math mode and back (this is very basic LaTeX knowledge!). Per default \flat and \sharp can be used only in math mode. You can leave them away and see for yourself what happens. – cgnieder Aug 30 '16 at 17:13
  • 1
    Another more powerful alternative: \usepackage[chords]{leadsheets} and then \chordname{B#} and \chordname{Bb} (this also correctly transforms stuff like \chordname{Eb7(#9)}. – cgnieder Aug 30 '16 at 17:16
  • 1
    Here is a related fun question: tex.stackexchange.com/questions/148355/writing-musical-pitches – Steven B. Segletes Aug 30 '16 at 17:28
2

The leadsheets package is perfect for my needs. The $ shortcut to go into math mode and have those symbols available is very handy: B$\sharp$, but the whole package offers a lot more options. Here's the docs.

\usepackage[full]{leadsheets}
\useleadsheetslibraries{musicsymbols}

\begin{document}

\begin{changemargin}{-1cm}{-1cm} 
\lilypondfile[quote,noindent]{omeimhreem.ly}
\end{changemargin}
\begin{figure}[ht]
\label{fig:Om eim hreem shreem kleem saw sat chit ekam Bramah}
\caption[Om eim hreem shreem kleem saw sat chit ekam Bramah]{The chords look complex at a glance, but it's fairly simple. You can just play B$\flat$ and D with an F note below them for the \writechord{Bb/F} chord, then move the F down one note to E which makes the \writechord{Bbsus/E}. The D minor over F is just moving the E up one and the B$\flat$ one down to A. \par
\begin{lilypond}
snippet = \relative c' {<f bes d>1 <e bes' d> <f a d> }
\score { 
\snippet 
\layout { 
     #(layout-set-staff-size 14)
     }
}
\end{lilypond} }
\end{figure}
\end{document}

Producing

picture of music

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.