[Tex/LaTex] How to typeset music dynamics within normal text

lilypondmusicsymbols

Although it should be possible to create a single musical dynamic symbol (like ff for fortissimo or sfz for sforzato) by creating an in-line lilypond-book fragment, hiding the staff etc. and somehow centering these symbols around an invisible note, I was wondering if there was a simpler way to do the same? Is there a workaround in LaTeX for this which would not require invoking lilypond-book for only putting a simple dynamic symbol?

Best Answer

MusiXTeX uses the normal "bold italic" font for the dynamic marks: {\textbf{\textit{sfz}}, but with a small kern between the letters.

It's so not necessary to load all of MusiXTeX:

\documentclass{article}
\newcommand{\muskern}{\kern-.15ex } % what MusiXTeX does

% if only a couple of dynamic marks are needed, this is easier
\newcommand{\sfz}{\textnormal{\textbf{\textit{s\muskern f\muskern z}}}}

% a more general command
\makeatletter
\newcommand\dynmark[1]{{\normalfont\bfseries\itshape
  \@tfor\next:=#1\do{\put@muskern\next}\/}}
\newcommand{\put@muskern}{\let\put@muskern\muskern}
\makeatother

\begin{document}

X\sfz X

X\dynmark{sfz}X

X\dynmark{ppp}X

\end{document}

enter image description here

Related Question