Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.)

share|improve this question
1  
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. –  Willie Wong Apr 27 '11 at 9:41
2  
Maybe you can use XeTeX/LuaTeX with some ttf or otf font with those symbols. –  Caramdir Apr 28 '11 at 17:05
    
@Willie: Oops, my gross fail... –  Brent.Longborough Oct 17 '11 at 21:58
add comment

4 Answers 4

up vote 11 down vote accepted

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}
share|improve this answer
    
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. –  Willie Wong Oct 17 '11 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 '11 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 '11 at 22:54
    
@percusse: Done! They're really only very minor adjustments. –  Jake Oct 17 '11 at 23:13
add comment

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

share|improve this answer
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. –  Willie Wong May 8 '11 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.) –  Willie Wong May 8 '11 at 3:48
    
@Willie: I'm on OSX, so I just checked them from the character palette window. –  morbusg May 8 '11 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 '11 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). –  Willie Wong Oct 16 '11 at 23:04
show 1 more comment

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.

share|improve this answer
    
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 '11 at 1:48
    
@percusse: I'd vote you up if you would post that as an answer, instead of as a comment! –  Willie Wong Oct 17 '11 at 15:12
add comment

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.

share|improve this answer
3  
I think these symbols are meant: en.wikipedia.org/wiki/… –  Caramdir Apr 27 '11 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 '11 at 6:23
    
@Caramdir: thanks. I hadn't thought there would be a confusion. Added your link to the question text to clarify. –  Willie Wong Apr 27 '11 at 9:37
    
Section 2.8 lists accidentals, but I'm far beyond my expertise at this point. –  Mike Renfro Apr 27 '11 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. –  Willie Wong Apr 27 '11 at 12:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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