I once had this question a while ago, asking about how to set the letter j always to be non-italic j in math mode without using \mathrm
.
The provided solution was:
\DeclareMathSymbol{j}{\mathalpha}{operators}{`j}
However, since I changed to lualatex and unicode-math the above line has either
no effect:
\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{unicode-math}
\DeclareMathSymbol{j}{\mathalpha}{operators}{`j}
\begin{document}
\begin{equation}
j ~~\text{is not}~~ \mathrm{j}
\end{equation}
\end{document}
or in case I define e.g. MinionPro and MnSymbol as my math fonts, the j
disappears completely:
\documentclass{article}
\usepackage{amsmath}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{Minion Pro}
\setmathfont{MnSymbol}
\setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}]{Minion Pro}
\setmathfont[range=\mathbfup/{num,latin,Latin,greek,Greek}]{MinionPro-Bold}
\setmathfont[range=\mathit/{num,latin,Latin,greek,Greek}]{MinionPro-It}
\setmathfont[range=\mathbfit/{num,latin,Latin,greek,Greek}]{MinionPro-BoldIt}
\setmathfont[range=\mathscr,StylisticSet={1}]{XITS Math}
\setmathrm{Minion Pro}
\DeclareMathSymbol{j}{\mathalpha}{operators}{`j}
\begin{document}
\begin{equation}
j ~~\text{is not}~~ \mathrm{j}
\end{equation}
But actually $j$ is not there at all.
\end{document}
I tried to declare the unicode character j separately, which didn't worked out.
\setmathfont[range={"006A} ]{Minion Pro}
It made appear the j again, but it was still italic.
Any new solutions for the old problem in case unicode-math is used?
I hope it was the appropriate action to ask a new question. I didn't wanted to alter the old question as it would have made the answer invalid.
Edit:
Not knowing that it would be important, I also need to include the amssymb package, which together with egreg's solution gives the following result:
\documentclass{article}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{fontspec}
\usepackage{unicode-math}
\usepackage{etoolbox}
\setmainfont{Minion Pro}
\setmathfont{MnSymbol}
\setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}]{Minion Pro}
\setmathfont[range=\mathbfup/{num,latin,Latin,greek,Greek}]{MinionPro-Bold}
\setmathfont[range=\mathit/{num,latin,Latin,greek,Greek}]{MinionPro-It}
\setmathfont[range=\mathbfit/{num,latin,Latin,greek,Greek}]{MinionPro-BoldIt}
\setmathfont[range=\mathscr,StylisticSet={1}]{XITS Math}
\setmathrm{Minion Pro}
\AfterEndPreamble{ %
\Umathcode`j="0"4"6A
}
\begin{document}
\begin{equation}
j ~~\text{is not}~~ \mathrm{j}
\end{equation}
But actually $j$ is not there at all.
\end{document}