最近有沒有可靠的方法來更改數學字體字形?

最近有沒有可靠的方法來更改數學字體字形?

有一種名為“Inter”的無襯線字體,我將其用作文件中的主要字體。我想在數學模式下使用它的字形。

我搜尋了一些方法,但它們之間存在一些不一致,這讓我很困擾,所以我不幸地改為襯線字體(STIX Two Math),但我仍然想要 Inter 字元。

任何人都了解在數學模式下很好地獲得這些字形的形式知識嗎?

對我來說,無襯線數學字體如此之少這一事實似乎很奇怪,而且我不確定這是否與傳統的影響或其他一些反覆出現的人類傾向/偏好有關。

最小工作範例:

\documentclass{scrartcl}

\usepackage[sfdefault]{inter}
\usepackage[math-style=upright]{unicode-math}
\setmathfont{STIX Two Math}

\begin{document}
\noindent Example of math text ahead:\\
  \Large $\gamma = \frac{1}{\sqrt{1 - \frac{v^2}{c^2}}}$
\end{document}

謝謝。

答案1

有多種 Sans Serif OpenType 數學字體可用,例如 Inter text with Fira Math

在此輸入影像描述

\usepackage[sfdefault]{inter}
\usepackage[math-style=upright]{unicode-math}
\setmathfont{Fira Math}

\begin{document}
\noindent Example of math text ahead:\\
  \Large $\gamma = \frac{1}{\sqrt{1 - \frac{v^2}{c^2}}}$
\end{document}

您也可以使用unicode-math Range鍵來替換某些範圍的字符,儘管它們會繼承文字間距,但沒有數學字體通常更寬的側邊距

這是 Inter 用於數學字母的情況(儘管 unicode-math 確實抱怨 Inter 並沒有真正設置為數學字體,但它確實滿足了要求)

在此輸入影像描述

\usepackage[sfdefault]{inter}
\usepackage[math-style=upright]{unicode-math}
\setmathfont{Fira Math}
\setmathfont[range=up]{inter}

\begin{document}
\noindent Example of math text ahead:\\
  \Large $\gamma = \frac{1}{\sqrt{1 - \frac{v^2}{c^2}}}$
\end{document}

帶有警告,例如

Package fontspec Warning: OpenType feature 'Style=MathScript' (ssty) not
(fontspec)                available for font 'inter' with script
(fontspec)                'CustomDefault' and language 'Default'.

因為 Inter 並不是真正的數學字體,儘管這裡並不重要,因為主要的數學排版參數取自 FiraMath

相關內容