8

I've got a lot of questions about preparing a book layout, but as I'm slowly going through the various books and other documents out there, I think most of the questions are being answered. However, the answer to the question How can I put musical clefs in the middle of text? doesn't work for my use-case, which is that I want to use a musical treble clef (𝄞) as a section separator. I first tried with XeTeX and the direct unicode input (as shown):

\documentclass[msmallroyalvopaper,12pt,openany]{memoir}
\usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{Baskerville}
\begin{document}
\part*{1980}
\chapter*{Chapter One}
\section*{𝄞}
\end{document}

This didn't work despite the Mac OS X Baskerville font having the treble clef in its Unicode range (I know as I have a Pages document that does this); all that shows up is the unknown character box (􏰀). So, I try the solution in the linked question:

\documentclass[msmallroyalvopaper,12pt,openany]{memoir}
\usepackage{fontspec,xltxtra,xunicode,musixtex}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont{Baskerville}
\begin{document}
\part*{1980}
\chapter*{Chapter One}
\section*{\begin{music}\trebleclef\end{music}}
\end{document}

and this refuses to compile (I'm using TeXShop and forcing XeTeX), resulting in this message:

? musixtex/musixtex.tex:531: Class
memoir Error: Font command \rm is not supported.

See the memoir class documentation for explanation.

I have an SVG of a treble clef that I can use (I needed it for an earlier ebook book), but I'd rather just use normal font commands because I don't really want to have to worry about scaling this independently of the font size.

Does anyone know of a memoir-compatible solution for this? Or should I stop learning memoir-class and learn how to do what I need in ConTeXt or KOMA or is there something else that I should be doing?

2 Answers 2

6

The Baskerville font does not contain the clef symbol according to the Apple character viewer. However, the Apple Symbols font does contain the character, so you can do the following:

% !TEX TS-program = XeLaTeX

\documentclass[msmallroyalvopaper,12pt,openany]{memoir}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Baskerville}
\newfontfamily\symbolfont{Apple Symbols}
\DeclareTextFontCommand{\textsymbol}{\symbolfont}


\begin{document}
\part*{1980}
\chapter*{Chapter One}
\section*{\textsymbol{𝄞}}
\end{document}

The reason the musixtex solution doesn't work is that it is using very old font commands (\bf, \rm, \it, etc.). Memoir prevents you from using these by default, but you can override it by passing the oldfontcommands option to the class.

1
  • Thanks. That does exactly what I wanted. I'm trying to match something I have in Pages and it seems to be "lying" to me in that there's an "invisible" font switch when I have the treble clef. One other question: in the document that I'm trying to emulate, I have the treble clef as a larger character (24pt as opposed to the main body 12pt); I should be able to do something like \section*{\huge\textsymbol{𝄞}}, right? Commented Apr 7, 2012 at 18:15
4

A different solution, where you can choose the size of the clef without resorting to explicit font size commands:

!TEX TS-program = XeLaTeX

\documentclass[msmallroyalvopaper,12pt,openany]{memoir}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setmainfont{Baskerville}
\newfontfamily\cleffont[Scale=2]{Apple Symbols}

\usepackage{newunicodechar}
\newunicodechar{𝄞}{{\cleffont 𝄞}}

\begin{document}
\part*{1980}
\chapter*{Chapter One}
\section*{𝄞 is the G clef}

𝄞 is the G clef
\end{document}
3
  • Thanks. This is also an interesting solution, but probably not what I want in the end. As I was playing with the code, I noticed that the [Scale=2] and the \fontsize{2\dimexpr\f@size} both double the size of the clef. I suspect I would only want one of them. What I will probably implement is a new command that I would use instead of \section*{} that scales to 2x the body font rather than the default section size (which appears to be about 1.2x the body font). Commented Apr 7, 2012 at 22:37
  • Sorry: I was experimenting and forgot to remove one.
    – egreg
    Commented Apr 7, 2012 at 23:29
  • I wanted to note that I needed up using a solution very similar to this one in the end for my document—as shown here: tex.stackexchange.com/questions/52946/… Commented Apr 25, 2012 at 4:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .