將數學模式中的某些字母定義為始終非斜體 - 在 lualatex 中使用 unicode-math

將數學模式中的某些字母定義為始終非斜體 - 在 lualatex 中使用 unicode-math

我曾經有過這個問題前段時間問怎麼設定字母j始終為非斜體j在數學模式下不使用\mathrm.

提供的解決方案是:

\DeclareMathSymbol{j}{\mathalpha}{operators}{`j}

然而,自從我更改為盧拉泰克斯unicode 數學上面的行有

沒有效果:

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

在此輸入影像描述

或者如果我定義 MinionPro 和 MnSymbol 作為我的數學字體,j

完全消失:

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

在此輸入影像描述

我試圖聲明 unicode 字符j分開了,沒有成功。

\setmathfont[range={"006A} ]{Minion Pro}

它使出現j再次,但它仍然是斜體。


如果使用 unicode-math,有什麼新的解決方案可以解決舊問題嗎?

我希望這是提出新問題的適當行動。我不想改變舊問題,因為它會使答案無效。


編輯:

不知道這很重要,我還需要包含amssymb包,它與埃格格的解決方案給出以下結果:

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

在此輸入影像描述

答案1

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

\AtBeginDocument{\Umathcode`j="0"0"6A }

\begin{document}




\begin{equation}
j ~~\text{is}~~ \mathrm{j}
\end{equation}

\end{document}

我沒有 MinionPro。但這是使用 Arial 的擴充版本(你想要 6)

\documentclass{article}

\usepackage{amsmath}
\usepackage{amssymb}            

\usepackage{fontspec}          
\usepackage{unicode-math}
\usepackage{etoolbox}

\setmainfont{Arial}
\setmathfont{MnSymbol}
\setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}]{Arial}
\setmathfont[range=\mathbfup/{num,latin,Latin,greek,Greek}]{Arial}
\setmathfont[range=\mathit/{num,latin,Latin,greek,Greek}]{Arial}
\setmathfont[range=\mathbfit/{num,latin,Latin,greek,Greek}]{Arial}
\setmathfont[range=\mathscr,StylisticSet={1}]{XITS Math}
\setmathrm{Arial}

\AfterEndPreamble{ %
\Umathcode`j="0"6"6A
}


\begin{document}
\showoutput
\begin{equation}
j ~~\text{is}~~ \mathrm{j}
\end{equation}
But actually $j$ is not there at all.

\end{document}

在此輸入影像描述

答案2

使用正確的家庭號碼j

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

\setmainfont{Minion Pro}
\setmathfont{MnSymbol}
\setmathfont[range=\mathup/{num,latin,Latin,greek,Greek}]{Minion Pro} % this is number 4
\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}

\AtBeginDocument{\Umathcode`j="0"4"6A }

\begin{document}

\begin{equation}
j \text{ is } \mathrm{j}\ne\mathbf{j}\ne\mathit{j}
\end{equation}

\end{document}

在此輸入影像描述

相關內容