# How to insert a musical symbol in Tikz with lilyglyphs?

I want to insert a musical symbol (fermata) in a Tikz picture, using lilyglyphs package. This is my code :

\documentclass[symmetric,justified,marginals=raggedouter]{tufte-book}
\usepackage{lilyglyphs}

\begin{document}

\begin{figure*}[h]
\begin{tikzpicture}
\node[anchor=west,font=\tiny](a)at(10.8cm,2.6cm){\lilyGlyph{fermata}\strut};
\end{tikzpicture}
\end{figure*}

\end{document}


Unfortunatly, the symbol don't appear and it is write "[Scale=1.0]emmentaler~16.otffermata". What is missing on my code ? For other reasons, I use to the musicography package in my document... Perhaps it is possible to insert this symbol with this package ?

• I just get ! Undefined control sequence. l.9 ...est,font=\tiny](a)at(10.8cm,2.6cm){\lilyGlypg {fermata}\strut};. – user194703 Apr 29 at 20:37
• You have a typo: it should be \lilyGlyph -- note the h at the end. Presumably you also need to compile this with XeLaTeX. – Andrew Apr 29 at 20:41
• However, if I remove the typo, the error disappears: it has to be \lilyGlyph, not \lilyGlypg. In general, if you ignore error messages in LaTeX you cannot expect to get a reasonable output. – user194703 Apr 29 at 20:42
• Sorry, I fixed the typo error, but it still doesn't work (and I add the new error message ...) – Phil8544 Apr 29 at 21:45

This works for me with XeLaTeX without any error:

\documentclass[symmetric,justified,marginals=raggedouter]{tufte-book}
\usepackage{lilyglyphs}

%alternative for the package lilyglyphs
\usepackage{fontspec}
\newfontfamily\emmentaler{emmentaler-11.otf}[Scale=MatchLowercase] %other fonts: emmentaler-11.otf emmentaler-13.otf emmentaler-14.otf emmentaler-16.otf emmentaler-18.otf emmentaler-20.otf emmentaler-23.otf emmentaler-26.otf
\newcommand\directFermata{{\emmentaler{}\symbol{"E132}}}

\begin{document}

\begin{figure*}[h]
\begin{tikzpicture}
\node[anchor=west,font=\tiny] (a) at (10.8cm,2.6cm) {\lilyGlyph{scripts.ufermata}};
\node[anchor=west,font=\tiny] (a) at (10.5cm,2.6cm) {\fermata\strut};
\node[anchor=west,font=\tiny] (a) at (10.0cm,2.6cm) {\directFermata\strut};
\end{tikzpicture}
\end{figure*}

\end{document}


But it does not work on pdfLaTeX since the command you use requires https://ctan.org/pkg/fontspec. This is also written in the second paragraph of the lilyglyphs' manual's section "1 Introduction" and in the first paragraph of the section "Quick Start".

You could also draw your own fermata with Tikz. It is one of the simpler music symbols. Or you could import it as pdf file, see https://tex.stackexchange.com/a/441624/128553. Both ways make you independent from https://ctan.org/pkg/fontspec in your main document.

• Up to now, I can't use LuaLateX and XeLateX as it seems that there is too much errors in my document... I will try to solve them and change my compilation mode. Thanks ! – Phil8544 Apr 30 at 17:45
• @Phil8544 Good luck! – CampanIgnis Apr 30 at 23:48
• I managed to compile my Tufte-Book document with XeLateX, and the method proposed by CampanIgnis works! – Phil8544 May 8 at 17:15