# \XeTeXglyph for Math Mode (alternative?)

Is there an alternative for \XeTeXglyph that works in math mode? Or is there a way \XeTeXglyph itself can work in math mode?

I want to access a specific glyph as a math symbol (UF091F specifically) in Minion Math using \XeTeXglyph but each time I try an error comes up saying ! You can't use \XeTeXglyph in math mode.

Using \symbol{######} works fine in LuaLaTeX but I think because the glyph I want is a 6 digit number, in XeTeX it outputs ! Bad character code (######) (where ###### is the symbol number as found using this method. Hence why I'm trying to use \XeTeXglyph, unless there actually is a way of using \symbol for that glyph without that error?

• I'd say \text{\XeTeXglyph...} should work (if you load amsmath). – egreg Jan 10 '15 at 18:49
• @egreg yes but would that give the proper spacing for a math symbol? – airatin Jan 10 '15 at 18:49
• \mathrel{\text{\XeTeXglyph...}} or \mathbin or one of the other primitives. – egreg Jan 10 '15 at 18:49
• You might want to look if your symbol can be found in unimath-symbols. – Henri Menke Jan 10 '15 at 18:51

I use a glyph called by index with a font I have, in this case XITS Math.

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{Asana Math}

\newfontfamily{\test}{XITS Math}

\begin{document}

{\test\XeTeXglyph4491}

$A\mathrel{\text{\test\XeTeXglyph4491}}B$

$A\mathbin{\text{\test\XeTeXglyph4491}}B$

$A\mathpunct{\text{\test\XeTeXglyph4491}}B$

\end{document}


Of course you'll want to make a macro.

On the other hand, either \symbol{985375} or \symbol{"F091F} should work, provided you hide them inside \text. I happen to have a font that has a glyph in that position:

\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmainfont{TeX Gyre Pagella}
\setmathfont{Asana Math}

\newfontfamily{\chn}{HanaMinPlus}

\begin{document}

{\chn\symbol{"F091F}}---{\chn\symbol{985375}}

$A\mathrel{\text{\chn\symbol{"F091F}}}B$

\end{document}


• Thanks, that is the answer to my question technically... Problem is, seems like my glyph table from here doesn't link to the right glyph (it says 333 but when I put that in my doc it outputs the wrong symbol!). So let's say I want to stick to \symbol; when I put it in \text{\symbol{985375}} it outputs the symbol ☒ (guess that's an error; its supposed to be a lambda bar), and when I remove the \text it shows nothing except error message Bad character code (985375) :( – airatin Jan 10 '15 at 19:26
• @airatin -- two forms of "lambda bar" should be in the xits/stix fonts: \lambdabar with a horizontal stroke and \lambdaslash with a slanted stroke. (i haven't checked the font, but since i was responsible for the names, that is what i found in my authoritative reference table. \lambdaslash should be at U+019B but \lambdabar is in the private use area, so there's no telling what conflicts there might be with other font definitions.) – barbara beeton Jan 10 '15 at 19:42
• @barbarabeeton Thank you, however I do want to use Minion Math for the lambda bar symbol since it already is provided in it; I'm trying to avoid using other fonts unless absolutely necessary. – airatin Jan 10 '15 at 19:46
• @airatin -- according to the unicode manual (5.0), "the entire plane 15, with the exception of the noncharacters U+FFFFE and U+FFFFF, is defined to be the supplementary private use area a." access to the private use area, in my (limited-mainly-to-theory) experience can be a touchy matter. if there is any documentation on this with respect to minion math, it would be a good idea to read it carefully. – barbara beeton Jan 10 '15 at 19:57
• @barbarabeeton Using LuaLaTeX I get the correct output with that same symbol number, even though it is Private Use. It would be nice if XeLaTeX would allow the same :( also Typoma (creator of Minion Math) has nothing on their website for LuaTeX/XeTeX, so I could email the owner and see if he has any solutions. But still this same syntax should be allowed in XeTeX the way it is in LuaTeX :( – airatin Jan 10 '15 at 20:22