# How do I use a math symbol from the private use area with unicode-math?

There are many math symbols which are not, unfortunately, in Unicode. One such symbol is the sequent relational operator that looks something like this ">-" and is found in the literature. I have a custom font, where this symbol is in the private use area. Using both LuaLaTeX and XeLaTeX, I can load the font and display it in text mode. The symbol is only defined in a normal weight, non-italic form. However, I cannot successfully define it as a math operator. This is the result of compiling the file...

Here is a minimal, commented .tex file that compiles to .pdf with both LuaLaTeX and XeLaTeX, but gives the wrong result for the math operator.

% Build .pdf using lualatex or xelatex

\documentclass{amsart}

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

\newfontface \MyFont {MyFont.ttf}

% Define Sequent operator in math mode.

\DeclareSymbolFont{MyFont}{U}{cmr}{m}{n}

\DeclareMathSymbol{\mathSequent}{\mathrel}{MyFont}{"E8A8}

% Define Sequent operator in text mode.

\newcommand \textSequent {{\MyFont{\char"E8A8}}}

\begin{document}
\begin{flushleft}

This is what the sequent operator looks like in text mode: \textSequent.\\
This is what the sequent operator looks like in math mode: $\mathSequent$.

\end{flushleft}
\end{document}


## migrated from tex.meta.stackexchange.comJul 6 '18 at 7:49

This question came from our discussion, support, and feature requests site for users of TeX, LaTeX, ConTeXt, and related typesetting systems.

• Maybe you find a solution here: tex.stackexchange.com/a/417871/105976 – sporc Jul 6 '18 at 7:57
• Regretfully, no. That was actually my question some time ago (I have been very busy and am just getting back to this), and that answer is already incorporated into this question. It is why the symbol works in text mode. I can always wrap the symbol in text mode when in math mode - but that doesn't allow TeX to do its proper spacing for operators. – Michael Lee Finney Jul 6 '18 at 10:40
• just because a symbol isn't in unicode doesn't mean it can't be added. what is required is documentation: one or more examples in published form, preferably from a "known" publisher. the examples should show usage, preferably with a definition, along with the citation so that the reference can be located by the committee. for a few more months, i will be in a position to submit new items to unicode with a good chance they will be accepted. (i conveyed the stix submission to the unicode technical committee, most of which were added in unicode 4.0, and i still have the connection.) – barbara beeton Jul 6 '18 at 12:25
• The first use of it that I am aware of is in "Stephen Blamey. [1986] "Partial Logic." Handbook of Philosophical Logic, Volume III, Ed. Dov M. Gabbay and F. Guenthner, Kluwer Academic Publishers, 1986, ISBN 0-7923-3098-6." It is was probably as mashup of ">" and "-" then. Since then it looks more like mine. I can provide a font with just that symbol. There are other papers using the symbol, but I can't find them quickly. – Michael Lee Finney Jul 6 '18 at 14:07
• I forgot to mention that it is first used and defined on pages 58-59. – Michael Lee Finney Jul 6 '18 at 14:17

I almost had it right. Instead of "cmr", it was necessary to declare the family and then use it. Instead of U, TU was required. \DeclareMathSymbol works if a) the declared family was used and b) the character was FF or less. Because of the latter problem with \DeclareMathSymbol it was necessary to instead use \Umathchardef. The modified code is shown below, with the replaced lines commented out. There is an extra commented out line for \DeclareMathSymbol showing how it should be used for those cases where it works.

The updated version has been tested with both LuaLaTeX and XeLaTeX. Where I have used MyFontB and MyFontC I wanted to make it clear where the same value has to be used. MyFontB represents an arbitrary font family name. MyFontC represents an arbitrary symbol font name. Notice that the fontface name is never used, except when defining the symbol in text mode. The family name can be the same as the fontface name, but still has to be defined.

I also found that the type of math symbol (mathbin, mathrel, etc.) doesn't make any practical difference, unless I remove the sidebearings (white space to the left and right of the glyph, used for minimum spacing in text) in the font itself. Then, the type of math symbol works as expected. Apparently when the font is loaded, the sidebearings are not stripped out. That would be ok if those symbols are never directly used in text. Since they could be wrapped in math mode, that shouldn't be a problem. I can create a custom variant of the font with zero width sidebearings. There may be some arcane way to have TeX remove the sidebearings, but I haven't found it.

% Build .pdf using lualatex or xelatex

\documentclass{amsart}

\usepackage{fontspec}

\usepackage{unicode-math}

%  \newfontface \MyFont {MyFont.ttf}

\newfontface \MyFont {MyFont.ttf}[NFSSFamily=MyFontB]

% Define Sequent operator in math mode.

%  \DeclareSymbolFont{MyFont}{U}{cmr}{m}{n}

\DeclareSymbolFont{MyFontC}{TU}{MyFontB}{m}{n}

%  \DeclareMathSymbol{\mathSequent}{\mathrel}{MyFont}{"E8A8}
%  \DeclareMathSymbol{\mathSequent}{\mathrel}{MyFontC}{"E8A8}
\Umathchardef\mathSequent="3 \symMyFontC "E8A8

% Define Sequent operator in text mode.

\newcommand \textSequent {{\MyFont{\char"E8A8}}}

\begin{document}
\begin{flushleft}
This is what the sequent operator looks like in text mode: \textSequent.\\
This is what the sequent operator looks like in math mode: $\mathSequent$.
\end{flushleft}
\end{document}


While not directly an answer in terms of using the font (which was previously answered, in two different ways). For this specific symbol, I have found two ways to create it directly in LaTex. The first is almost indistinguishable from the original (with slight differences depending on the math font). The second is fairly close, but is clearly different. Both would be close enough to use in practice, with the first being preferable.

This uses the scalerel package.

{\vstretch{0.90}{\hstretch{0.50}{{\mkern5mu}{>}{\mkern-3mu}{-}{\mkern5mu}}}}


This uses the graphicx package.

{\mkern3mu{\rotatebox[origin=c]{270}{\raisebox{-1pt}{\Yup}}}\mkern3mu}


In unicode-math 0.81, \setmathfont[range="E8A8] unfortunately fails when the requested character is in the Private Use Area. Here is a workaround.

\documentclass[varwidth, preview]{standalone}

\usepackage{amsmath}
\usepackage{unicode-math}

% \setmainfont goes here.
\defaultfontfeatures{Scale=MatchUppercase}
% \setsansfont, \setmonofont, etc. go here.

\newfontface\mathsymbolfont{MyFont.ttf}
\DeclareRobustCommand\textsequent{{\mathsymbolfont\symbol{"E8A8}}\relax}
\DeclareRobustCommand\sequent{\mathrel{\text{\textsequent}}}

\begin{document}
In text mode, the sequent symbol is \textsequent.

In math mode, $$A \sequent B$$.

Compare $$A \succ B$$.
\end{document}


The symbol is, according to the Comprehensive LaTeX Symbols List, also in two packages on CTAN, of which stmaryrd got an update early this century and is still usable:

\documentclass[varwidth, preview]{standalone}

\usepackage{amssymb} % Used by stmaryrd
\usepackage{stmaryrd} % For \Yright
\usepackage{unicode-math} % Or font packages of choice.
\DeclareRobustCommand\sequent{\mathrel{\Yright}}

\begin{document}
In math mode, $$A \sequent B$$.

Contrast $$A \succ B$$.
\end{document}


### ETA:

There is a similar symbol in Unicode, available in unicode-math as \righttail, although you might need to load it from another font.

\documentclass[varwidth, preview]{standalone}

\usepackage{stmaryrd} % \Yright
\usepackage{unicode-math}

\setmathfont{Latin Modern Math}
\setmathfont[Scale=MatchUppercase, range={\righttail}]{STIX Two Math}

\newcommand\sequent{\mathrel\righttail}

\begin{document}
Compare $$A \sequent B$$ to $$A \mathrel\Yright B$$.
\end{document}


• This works for 7E, but not for E8A8 - apparently it also has the 8-bit limitation. Also, the Succeeds and Succeeds Under Relation have an entirely different purpose and is not an acceptable substitute. They also would just look wrong for someone expecting a sequent symbol. – Michael Lee Finney Jul 10 '18 at 19:34
• There's no 8-bit limitation in unicode-math. I don't have a copy of the font to test it, though. You're putting the actual name of your font inside the braces? What are you getting? – Davislor Jul 10 '18 at 19:43
• I used the following commands \setmathfont{Cambria Math}[slash-delimiter=frac] \setmathfont[range="E8A8]{MyFont.ttf} \DeclareRobustCommand \sequent {\mathrel{\char"E8A8}} It gave me nothing at all. I replaced E8A8 with 7E and it worked. – Michael Lee Finney Jul 10 '18 at 19:49
• I switched from MyFont.ttf to Calibri. It worked for 221B, but not for anything I tried above 7FFF. Those were not math symbols, so I will look for another font with math symbols above 7FFF. – Michael Lee Finney Jul 10 '18 at 20:18
• Thanks. Not really close enough. However, in case my font is not available, I have settled on STIX2 as my main and math fonts. From there I have built almost all of my important symbols using LaTeX which gives nearly identical results. I am matching glyph shape, size, position and sidebearings with only minor variations. Most of that will also work with Cambria as well - probably all with tweaks. I have noted that many STIX glyphs give me a divide by 0 when I use \xxx, but if I use {Umathchar "0 \symMathFont "HHHH} it does not. Weird. – Michael Lee Finney Jul 29 '18 at 6:14