Using Musical Symbols in Text Documents

Are you authoring text documents about music? Maybe you’re a musicologist, teacher, or composer? Are you preparing such documents for publication and have always missed the ability to easily include musical symbols in your texts?

Then I have some very good news for you: With the new package lilyglyphs it is now possible to include any of LilyPond’s music notation symbols as “characters” in text documents. Accidentals, Clefs, Time signatures, and Articulations are readily available, but in fact you can use arbitrarily complex notational constructs.

Excerpt from a sample document typeset with lilyglyphs

What sets this package apart is that you’re not restricted to a small set of predefined symbols but can actually use anything LilyPond is capable of, and as we all know this is quite a lot…
Another nice thing is that the symbols scale perfectly with the surrounding text size so they can be inserted into texts really easily.

Sounds too good to be true? Well, there’s one catch to this: it is a LaTeX package, so in order to benefit from my development you may have to consider a change in mind-set and start using plain text based tools. I know it’s nasty to tell you this only after having whetted your appetite ;-).
But even if you have seen only a fraction of what I’ve written on “Scores of Beauty” you should know that I think having to use a text based tool is actually a big advantage. I was always fond of the tightly integrated workflows offered by plaintext based tools, and lilyglyphs takes this concept a big step forward.

Where to go from here?

Download the PDF Manual

Get the package through:

  • CTAN: http://mirror.ctan.org/macros/luatex/latex/lilyglyphs
  • TeX distributions. You have to see if your distro already contains it, in TeXLive you can get it with tlmgr install lilyglyphs.
  • the repository on Github.
    This is actually the recommended way if you know how to use Git, because this will allow you to get the latest updates as soon as they are applied, and it is the easiest way to extend the package with new commands

But first of all I suggest having a look at the full-size version of the example document.

13 thoughts on “Using Musical Symbols in Text Documents

  1. Frank

    This is fantastic. I wrote my thesis in LaTeX, using lilypond-book for the music examples. How do you run the tlmgr install lilyglyphs command? I tried typing it into the Linux terminal, but got a message that said:

    No command 'tlmgr' found, did you mean:
    Command 'vlmgr' from package 'qdbm-util' (universe)
    Command 'rlmgr' from package 'qdbm-util' (universe)

    Thank-you for your help, and especially for creating an awesome package!

    Reply
    1. Urs Liska

      Thank you for your kind words 🙂
      Actually I’m already planning further development in this direction. My musicexamples package isn’t really exciting yet, but it will become very useful once I manage to let luatex’s built-in Lua handle LilyPond code. Think of it like lilypond-book without the need to preprocess to an intermediate file. Plus integrated example manangement (captions, references, \listofmusicexamples)

      The next bigger project will be a package to typeset critical reports, with the ultimate goal of writing the entries in a LilyPond score and having them automagically be included in the LaTeX file.

      But to your question: tlmgr is a tool from TeXLive. So if you have TexLive installed your output indicates a problem with your installation. If you haven’t TeXLive you can’t go that way, and I suggest to either download from CTAN or download/clone from GitHub.
      Or if you have another LaTeX distribution you might check if it already has included lilyglyphs (see the documentation of the distro on how to do that).

      Good luck!

      Reply
  2. Pingback: Extending lilyglyphs (Part 1) | Scores of Beauty

  3. Federico Bruni

    Hey guys, can you provide a minimal example for the lazy people like me?

    I’ve never used Luatex and I can’t figure out how to run it. I’ve downloaded lilyglyphs from git inside ~/texmf/tex/latex/. I have a simple example but I don’t know how to compile it. I used to use Latexila but it’s configured for pdftex only. ‘man luatex’ is not helping…

    thanks

    Reply
    1. Urs Liska

      OK, the absolute mini-example:
      Write a file lilyglyphs-example.tex:

      \documentclass{article}
      \usepackage{fontspec}
      \usepackage{lilyglyphs}
      \begin{document}
      \flatflat
      \end{document}

      Then run either lualatex lilyglyphs-example.tex or xelatex lilyglyphs-example.tex

      If that doesn’t work something’s wrong with the installation.

      One more thing you have to do is to make the Emmentaler fonts available:

      cd ~/texmf
      mkdir opentype
      cd opentype
      ln -s ~/texmf/tex/latex/lilyglyphs/fonts emmentaler
      mkdir dummy

      (or modify to your personal settings)
      The last command is necessary because otherwise luatex wouldn’t follow the symlink (strange issue IMO).

      Reply
  4. Federico Bruni

    xelatex worked immediately.
    I had to install texlive-luatex because lualatex needs luaotfload.sty

    The Emmentaler font is available (I can see it as embedded in the PDF), but I didn’t add the symlink,as you suggested. (I’m on Debian sid)

    Fret diagrams are supported? I’d like to use lilyglyphs to write a simple leadsheet.
    Unfortunately Chordii, by design, prints the chord diagrams at the bottom of the paper and there’s no way to change it. I’d like to put them on top.
    At any rate, I’d be glad to use a “lilypondy” solution for lead sheet

    Reply
    1. Urs Liska

      lualatex needs luatex in the first place 😉

      Maybe you had already installed Emmentaler someday earlier?
      Or they might have come to you through TeXLive.

      Regarding fret diagrams: If you know how to create them in LilyPond you can make them available as commands for lilyglyphs. Then you can typeset them anywhere you can typeset characters: in the continuous text, as standalone paragraphs or – maybe the right choice for you – as table cells.

      I would love to have guitar fret diagrams added to lilyglyphs. So if you’re interested I could walk you through it (that way ‘beta-testing’ the documentation). In that case please contact me privately.

      Reply
  5. Federico Bruni

    I wrote: “At any rate, I’d be glad to use a “lilypondy” solution for lead sheet”.
    I have to specify: I don’t want to enter the voice melody to attach the text to. This is what prevents me to use LilyPond for lead sheets. I think I’ve seen several topics on this subject on the lilypond-user. Final recommendation was usually: use Chordii. Which is great, except for this annoying thing: chords can’t be printed at the top of the file.

    Reply
  6. Federico Bruni

    Maybe lilyglyphs is not the right tool for lead sheets.

    I’ve just found a powerful latex package to create simple leadsheets: Songs. It has also a nice documentation. Any other suggestion is welcome.

    Reply
  7. Pingback: Oskar Fried: Complete Songs | Scores of Beauty

  8. Pingback: Power of TeX - music scores | There and back again

  9. Likethis

    [Comment ID #270559 Will Be Quoted Here]Thanks. When I began to learn the LaTeX two years ago, I found there were few web resources of LaTeX for berginens. So this blog appear. If you want to contact me, see the email address in

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *