A short description of the problem
I'd like to create a mathematical operator whose glyph is the Greek lowercase letter sigma, while the unicode-math
package is loaded.
A demonstration of the problem by way of a minimal working example
I saved the following LaTeX code in the file ~/Test.tex
.
\documentclass{article}
\usepackage{amsmath}
%\usepackage{unicode-math}
%\setmathfont{STIX Two Math}
\DeclareMathOperator{\op}{\sigma}
\begin{document}
\begin{align*}
&\op x\\
&\sigma x
\end{align*}
\end{document}
The code creates a mathematical operator called \op
, whose glyph is the Greek lowercase letter sigma. The body of the document uses both the operator as well as the bare letter sigma.
I then executed the following commands in the Terminal.
> cd ~
> lualatex Test
This resulted in the creation of the file ~/Test.pdf
. When opened in a PDF viewer, this file displayed as follows. (I screenshot only the relevant part of the display).
As can be seen, the operator and the bare sigma behave differently: the space between the operator and the following letter is greater than the space between the bare sigma and the following letter. This is the rationale behind my desire to define sigma as a mathematical operator, rather than simply use the bare letter.
If now the two commented lines are uncommented, so as to load the unicode-math
package and set the math font to STIX Two, and the code is recompiled, the resulting PDF file displays as follows.
As can be seen, nothing was printed out where the operator should be.
Questions
- Why didn't the operator print out when the
unicode-math
package was loaded? - How can I define a mathematical operator whose glyph is the Greek lowercase letter sigma, when the
unicode-math
package is loaded, and STIX Two is set as the math font?
Remark
(The following remark is posted a day after the original question was posted, and after several answers have been proposed.)
A couple users mentioned in their answers below that \DeclareMathOperator
looks for the glyph for the character code it is passed as its second argument in the document's text font, and that therefore setting the document's text font to, say, STIX Two Text
, using the command \setmainfont{STIX Two Text}
, should resolve the problem I described in my original question.
However, the following code undermines these claims.
\documentclass{article}
\usepackage{amsmath}
\usepackage{unicode-math}
\setmainfont{STIX Two Text}
\setmathfont{STIX Two Math}
\DeclareMathOperator{\op}{\sigma}
\begin{document}
\begin{align*}
&\op x\\
&\sigma x
\end{align*}
\end{document}
Missing character: There is no 𝜎 (U+1D70E) in font [lmroman10-regular]:+tlig ;!