2

Can someone tell me what I am doing wrong or simply tell me how I can use the coptic letter "Me" in math mode?


I want to use a coptic letter in a mathematical expression in my TeX document. From my very limited understanding of how all these things work I read that "XeTeX and LuaTeX support Unicode".
Not entirely sure what that actually means I came across the (XeTeX and LuaTex) commands \char"xxxx, \symbol{xxxx} and ^^^^xxxx only to find out that I have no idea how to actually use them. I tried out this little code example:

\documentclass{article}
\usepackage{fontspec}
\usepackage{unicode-math}

\begin{document}
Trying to display the symbols ©, ❤ and the coptic letter "Me": \\
\char"00a9, \char"2764, \char"2C98  \\
\par
And now again in math mode: \\
$\char"00a9, \char"2764, \char"2C98 $
\end{document}

Which yielded the following output: output1


Similarly, with the second command I get:

Trying to display the symbols ©, ❤ and the coptic letter "Me": \\
\symbol{00a9}, \symbol{2764}, \symbol{2C98} \\
\par
And now again in math mode: \\
$\symbol{00a9}, \symbol{2764}, \symbol{2C98}$ 

output2

and for the last one I even get an error message:

Trying to display the symbols ©, ❤ and the coptic letter "Me": \\
^^^^00a9, ^^^^2764, ^^^^2C98 \\
\par
And now again in math mode: \\
$^^^^00a9, ^^^^2764, ^^^^2C98$

yields

! ^^^^ needs four hex digits. ^^^^ 00a9, ^^^^2764, ^

2 Answers2

4

You need a font that has the character. On my machine Firefox used Segoe UI Symbol to display this, so I used the same in lualatex:

enter image description here

\documentclass{article}
\usepackage{fontspec}
\usepackage{amsmath}
\usepackage{unicode-math}
\newfontfamily\zzzz{Segoe UI Symbol}

\begin{document}
Trying to display the symbols ©, ❤ and the coptic letter "Me" {\zzzz(Ⲙ)}: 


And now again in math mode: \\
$ \text{\zzzz Ⲙ}  $

\end{document}
David Carlisle
  • 757,742
3

Note that \char"00a9 will try to print the character in slot 0 and then “a9”, because TeX hexadecimal numeric notation requires uppercase letters. To the contrary, the ^^^^ notation requires lowercase letters.

So either \char"00A9 or ^^^^00a9. They can't be mixed. There's a big difference among the two: the former is an instruction to print the glyph in position "00A9 of the current font, the latter is the character U+00A9.

Now, if the current font, be it in text mode or math mode (what's the current font in math mode depends on many factors) doesn't contain a glyph at a certain position, no fallback is used in XeLaTeX or LuaLaTeX and so you end up with no glyph (or a placeholder).

In order to obtain a glyph in a different font, you have to declare what font to use.

At this point, if you want to use the Coptic letter Me in math, you can even declare it as a math symbol.

\documentclass{article}
\usepackage{unicode-math}

% use a font which has the glyph
\newfontfamily{\copticfont}{FreeSerif}[
  NFSSFamily=coptic,
]

\DeclareSymbolFont{coptic}{TU}{coptic}{m}{n}
% need to use a low level declaration
\Umathchardef\Me="0 \symcoptic "2C98

\begin{document}

$\Me+\Me$

\end{document}

You can even be bold and use the symbol itself in math:

\documentclass{article}
\usepackage{unicode-math}

% use a font which has the glyph
\newfontfamily{\copticfont}{FreeSerif}[
  NFSSFamily=coptic,
]

\DeclareSymbolFont{coptic}{TU}{coptic}{m}{n}
% need to use a low level declaration
\Umathchardef\Me="0 \symcoptic "2C98
\Umathcode`Ⲙ="0 \symcoptic "2C98

\begin{document}

$\Me+\Me$

$Ⲙ+Ⲙ$

\end{document}

enter image description here

egreg
  • 1,121,712