20

Does anyone know if there is any package that provides the quartertone sharps and flats symbols? (I've already checked the Comprehensive LaTeX Symbol List and couldn't find them.)

The symbols can be seen, for example, in the following picture taken from Wikipedia:

Quartertone

(If I were actually writing musical excerpts, then I'd just use Lilypond with LaTeX, but that seems a bit silly if I just want to get a few symbols into the body text.)

3
  • 2
    I should add that the issue is probably more about the demisharp and sharp+1/2. There's probably a way to fake the demiflat and flat+1/2 using \reflectbox. Apr 27, 2011 at 9:41
  • 2
    Maybe you can use XeTeX/LuaTeX with some ttf or otf font with those symbols.
    – Caramdir
    Apr 28, 2011 at 17:05
  • @Willie: Oops, my gross fail... Oct 17, 2011 at 21:58

4 Answers 4

13

While the fonts and the respective packages are being built, as pragmatic as it can be, one can get away with the following inline TikZ drawings

\documentclass{article}
\usepackage{tikz}
\newcommand{\dflat}{\tikz[baseline=-1.2mm] \node {\reflectbox{$\flat$}};}

\newcommand{\sflat}{\tikz[baseline=-1.2mm] \node {\reflectbox{$\flat$}$\flat$};}

\newcommand{\dsharp}{\hskip3pt \tikz[baseline=-1.2mm] {%
\clip (-2pt,-6pt) rectangle (-.2pt,6pt); \node at (0,0) {$\sharp$};}\hskip3pt
}

\newcommand{\ssharp}{\tikz[baseline=-1.2mm] {%
\node[inner sep=0mm] at (0,0) {$\sharp$};\node at (1.7pt,0.55pt) {$\sharp$};}
}

\begin{document}
\parbox{5cm}{
This is some random text to use the symbols \dflat, \sflat,\dsharp and \ssharp inline.
It can be improved by assigning some input parameters and adjusting the kerning as
C~{\hskip-7pt\dflat}, A~{\hskip-6pt\dsharp} or D~{\hskip-6pt\ssharp}
}
\end{document}

enter image description here

I will not attempt to make stupid comments since I know almost nothing about typography and kerning but this can be automated at will. Also I am not sure if these commands I have defined are robust. Please consider this as a proof of concept.


Addition by Jake:

By using \tikz [baseline] \node [anchor=base, inner sep=0pt], the nodes will automatically be positioned on the text line like a character would, so the vertical position doesn't have to be adjusted manually.

When defining TikZ commands to be used in text lines, it is usually a good idea to specify lengths in terms of ex and em, since these depend on the surrounding font size. That way, the symbols will scale with the text.

\documentclass{article}
\usepackage{tikz}
\newcommand{\dflat}{\tikz [baseline] \node [anchor=base, inner sep=0pt] {\reflectbox{$\flat$}};}

\newcommand{\sflat}{\tikz [baseline] \node [anchor=base, inner sep=0pt] {\reflectbox{$\flat$}$\flat$};}

\newcommand{\dsharp}{\tikz [baseline] {%
    \clip (-0.2em,-1ex) rectangle (-0.01em,2ex);
    \node[anchor=base, inner sep=0pt] {$\sharp$};}
}

\newcommand{\ssharp}{\tikz[baseline] {%
    \node[anchor=base,inner sep=0pt,name=leftsharp] at (0,0) {$\sharp$};
    \node  at (leftsharp.east) [xshift=-0.25em, yshift=0.1ex, inner sep=0pt,anchor=west] {$\sharp$};}
}

\begin{document}
\parbox{5cm}{
This is some random text to use the symbols \dflat, \sflat, \dsharp and \ssharp inline.
It can be improved by assigning some input parameters and adjusting the kerning as
C\dflat, A\dsharp or D\ssharp
}

\parbox{5cm}{\Large
The symbols scale with the text:
C\dflat, A\dsharp or D\ssharp
}
\end{document}
4
  • 1
    Thanks! Just tried it out. I may have to do a little bit of adjustments, but it looks like it would work in a pinch. Oct 17, 2011 at 15:57
  • @percusse: Nice approach! And if you use \tikz [baseline] \node [anchor=base, inner sep=0pt] you don't have to manually adjust the vertical position and the kerning. Also, if you define the lengths in terms of em and ex, the symbols will scale with the text. Also note that the clip path used for the \dsharp influences the bounding box, so you get unneeded vertical space under the character. I've made a couple of adjustments, do you mind if I add them to your answer?
    – Jake
    Oct 17, 2011 at 22:49
  • @Jake it is actually my pleasure to read your answers. Of course I don't mind. Please feel free to improve. It is also possible for me to remove this answer, if you have something substantial about this.
    – percusse
    Oct 17, 2011 at 22:54
  • @percusse: Done! They're really only very minor adjustments.
    – Jake
    Oct 17, 2011 at 23:13
11

Here are some symbols I found in an OpenType font called "Helsinki Special" which comes with a Sibelius browser plugin.

Example in Plain XeTeX:

\font\hel="Helsinki Special"
\def\thingone{{\hel\char"F042}}
\def\thingtwo{{\hel\char"F022}}
\def\thingthree{{\hel\char"F0F7}}
ab \thingone\hskip.5pt\thingtwo\ \thingthree\ cd
\bye

enter image description here

6
  • 1
    That's a decent lead. Searching for Helsinki Special brought up this page, which also lists some other fonts with those symbols: Maestro, Maestro percussion, Jazz perc, Tamburo for example. May 8, 2011 at 3:26
  • A bit of a followup question: how do you find the correct \hel\char"F042 string to use in the font? (In particular I am leaning somewhat to using the OpenType Feta fonts from the lilypond project.) May 8, 2011 at 3:48
  • @Willie: I'm on OSX, so I just checked them from the character palette window.
    – morbusg
    May 8, 2011 at 7:06
  • @WillieWong: On Windows, use the Character Map. It shows the string in the bottom left corner, like in upload.wikimedia.org/wikipedia/en/e/ef/Character_Map_Vista.png. If morbusg's answer helped you, please consider accepting it. Otherwise, specify what's missing.
    – doncherry
    Oct 16, 2011 at 16:15
  • @doncherry: that doesn't look right. U+0021 is the unicode number for the exclamation mark. The unicode symbols with the description as the quartertone sharp/flat symbols are U+1D132 and 1D133, but they are not the ones I referred to in my post (the symbols are not completely standardised in the musical community, and the ones I want are more common for Ottoman music). Oct 16, 2011 at 23:04
2

My music background is practically non-existent, but it looks like MusiXTeX should handle it. From section 2.4.1 of the documentation:

\qu{p} : quarter note with stem up.

\ql{p} : quarter note with stem down.

\qa{p} : quarter note with automatic stem direction.

There may be more overhead in getting MusiXTeX going than you'd like, though.

5
  • 3
    I think these symbols are meant: en.wikipedia.org/wiki/…
    – Caramdir
    Apr 27, 2011 at 3:33
  • 3
    You are talking about the time for notes. In the UK, we'd call what you've suggested 'crotchets' :-) What Willie is looking for is tone symbols, which are going to be accidentals as they can't be part of the key signature.
    – Joseph Wright
    Apr 27, 2011 at 6:23
  • @Caramdir: thanks. I hadn't thought there would be a confusion. Added your link to the question text to clarify. Apr 27, 2011 at 9:37
  • Section 2.8 lists accidentals, but I'm far beyond my expertise at this point. Apr 27, 2011 at 11:35
  • As far as I can tell, MusiXTeX does not support quartertones (its accidental support is limited to the western semitones). Also, it is more designed to typeset staff music, whereas I just want the symbol inline in textbody. Apr 27, 2011 at 12:58
2

I'll have to investigate the following more before I can say whether it gives a solution on non-XeTeX or LuaTeX systems (for those this answer above probably should do the trick. Too bad I do not usually use a flavour of TeX that enjoys working with otf files).

I just found via the Lilypond mailing list that Philippe Massart is working on a LaTeX package which allows the use of the music symbols in Lilypond's Feta font directly in LaTeX. Since Feta does include the symbols I am looking for, this may in fact solve my problem.

I'll update and report back after I find some time to test Massart's package.

2
  • I have tried to get something at least close to the original. Please compile the following with TikZ package and if the result is satisfactory you can use it inline or improve further. This is some text to use the symbols \tikz[baseline=-1.2mm] {\node[inner sep=0mm] at (0,0) {$\sharp$};\node at (1.7pt,0.55pt) {$\sharp$};}and \tikz[baseline=-1.2mm] \node {\reflectbox{$\flat$}}; and \tikz[baseline=-1.2mm] \node {\reflectbox{$\flat$}$\flat$};and\tikz[baseline=-1.2mm] {\clip (-3pt,-6pt) rectangle (-.2pt,6pt); \node at (0,0) {$\sharp$};}.
    – percusse
    Oct 17, 2011 at 1:48
  • @percusse: I'd vote you up if you would post that as an answer, instead of as a comment! Oct 17, 2011 at 15:12

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.