# italic identifiers with Greek letters and Arabic digits with unicode-math

We try to produce an identifier 𝜎1 in math mode, i.e., both symbols should be italics or slanted and the distance between the two symbols should be a usual inter-letter distance in a word. In [pdf]latex you'd simply write $$\mathit{\sigma1}$$. What to do with {xe|lua}latex? The only way we were able to generate both letters slanted or italics is via $$\sigma\mathit{1}$$, but then I presume that the spacing between the two symbols corresponds to that of multiplication:

\documentclass{article}
\pagestyle{empty}
\usepackage{unicode-math}
\begin{document}
$$\sigma 1$$ $$\sigma\mathit{1}$$
\end{document}


yields 𝜎1 followed by 𝜎 1.

• With \sigma\mathit{1} in pdflatex the space in between is wider than with lualatex. Jan 20 at 21:44

Unicode does not have slanted math digits, so you need a text font with Greek.

\documentclass{article}
\pagestyle{empty}
\usepackage{fontspec}
\usepackage{newcomputermodern}
\usepackage{unicode-math}
\begin{document}
$$\textit{σ1} + 1$$
\end{document}

• But the spacing is wider than desired. See the left-hand image in the original question. Jan 20 at 23:02
• @barbarabeeton there are lots of fonts to choose from... Jan 20 at 23:03

You could also manually define your own \text... command and its font(face).

MWE

\documentclass{article}
\usepackage{unicode-math}
\setmathfontface{\textgrit}{Noto Serif italic}
\begin{document}
$$\textgrit{σ1} + 1$$
\end{document}


First a test.

\documentclass{article}
\usepackage{iftex}
\ifluatex
\usepackage{unicode-math}
\fi

\begin{document}

$$\sigma\mathit{1}$$
\showoutput

\end{document}


Compiling with lualatex gives

....\mathon
....\TU/latinmodern-math.otf(1)/m/n/10 𝜎
....\TU/lmr/m/it/10 1
....\mathoff


Compiling with pdflatex gives

....\mathon
....\OML/cmm/m/it/10 ^^[
....\kern0.35878
....\OT1/cmr/m/it/10 1
....\kern1.35556
....\mathoff


As you see, there is no kerning at all between sigma and the digit in LuaLaTeX.

You can't use \mathit{\sigma 1} with unicode-math and it just works by accident with pdflatex because of how mathcodes are set up.

Why are you “seeing” too much space? Because the bounding box of “1” is the same width as the other digits, but 1 is narrower. You may want to choose proportional width for the digits.

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

\setmathfontface{\mathit}{LMRoman10-Italic}[Numbers=Proportional]

\begin{document}

$$\sigma\mathit{1}$$

$$\sigma\mathit{2}$$

\end{document}