4

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.

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

3 Answers 3

5

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

enter image description here

\documentclass{article}
\pagestyle{empty}
\usepackage{fontspec}
\usepackage{newcomputermodern}
\usepackage{unicode-math}
\begin{document}
 \(\textit{Οƒ1} + 1\)
\end{document}
2
  • But the spacing is wider than desired. See the left-hand image in the original question. Commented Jan 20, 2023 at 23:02
  • @barbarabeeton there are lots of fonts to choose from... Commented Jan 20, 2023 at 23:03
5

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

textgrit

MWE

\documentclass{article}
\usepackage{unicode-math}
\setmathfontface{\textgrit}{Noto Serif italic}
\begin{document}
 \(\textgrit{Οƒ1} + 1\)
\end{document}
4

First a test.

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

\begin{document}

\(\sigma\mathit{1}\)
\showoutput

\end{document}

Compiling with lualatex gives

enter image description here

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

Compiling with pdflatex gives

enter image description here

....\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}

enter image description here

You must log in to answer this question.