4

In some OpenType fonts e.g. XITS Math, there are some non-unicode glyphs. For example, the "display integral" glyph has the same code point (U+222B) as the normal integral. Although the big int can be used with \displaystyle, but how to use it directly (like \symbol{...})?

Both XeLaTeX and LuaLaTeX solutions are welcome.

Update:

Using XITS Math as an example. At the end of unicode block, there are a lot of glyph variants with name as unixxxx.yyy. xxxx here is the code point, while yyy is the variants name. For example, uni222B.display is the big integral with unicode value -1 and glyph index 3584 (0xE00). Obviously, using it's unicode value as \symbol{-1} will not give the correct symbol.

Definitely, with commands like \displaystyle, one can easily get access to the big integral symbol. However, how can I use the other symbols, like u1D49C.cal (script A) and uni221D.rtlm (right to left form propotional)?

Although there are speific tricks to use there symbol, to access all these symbols uniformly is also very useful (e.g. creating a font table).

  • Would it be ok to write a macro to invoke mathmode, displaystyle and the integral? Such as \newcommand{\myintegral}{$\displaystyle\char"222B$}? – Marijn Mar 14 '18 at 17:05
8

This is the xetex version luaotfload can do similar

enter image description here

\documentclass{article}


\font\xm="XITS Math/OT:script=math;language=DFLT;" at 20pt


\begin{document}

\xm 
^^^^222b 
\XeTeXglyph\XeTeXglyphindex "uni222B" 
\XeTeXglyph\XeTeXglyphindex "uni222B.up" 
\XeTeXglyph\XeTeXglyphindex "uni222B.small" 
\XeTeXglyph\XeTeXglyphindex "uni222B.display" 
\XeTeXglyph 3584


\end{document}

You can see the variant glyph names by looking in the font's MATH table with fontforge or a similar tool.

4

Under either XeLaTeX or LuaLaTeX, all you need to do is write \char"222B. The size of the integral symbol will depend on whether it occurs in text mode, text-style math mode, or display-style math mode.

enter image description here

%% Compile with either XeLaTeX or LuaLaTeX
\documentclass{article}
\usepackage{unicode-math}
\setmainfont{XITS}
\setmathfont{XITS Math}

\begin{document}
\char"222B{} $\char"222B$ $\displaystyle \char"222B$
\end{document}
  • 1
    What I want is a directly way to use the glyph, i.e. do not use \displaystyle and even math environment. By the way, there are other symbols like italic double-struck letters that can not be used with \displaystyle. – stone-zeng Mar 14 '18 at 16:50
3

A LuaTeX version:

\documentclass{article}

\font\xm="XITS Math/OT:script=math;language=DFLT;" at 20pt

\newcommand\LuaTeXglyphindex{\directlua{
  tex.sprint(0, font.getfont(font.current()).resources.unicodes[token.scan_string()])
}}
\begin{document}

\xm 
\char"222B 
\char\LuaTeXglyphindex uni222B.small
\char\LuaTeXglyphindex uni222B.display
\char\LuaTeXglyphindex uni222B.up
\char\LuaTeXglyphindex uni222B.up.display
\char\LuaTeXglyphindex uni222B.rtlm
\char\LuaTeXglyphindex uni222B.rtlm.display

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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