在 xelatex 中使用帶有 unicode-math 的文字字體作為標點符號

在 xelatex 中使用帶有 unicode-math 的文字字體作為標點符號

假設我在序言中有以下聲明

\usepackage[utf8]{inputenc}
\usepackage{unicode-math}

\setmathfont{My Best Math Font}
\setmainfont{My Best Font}

然後是文檔中的一些文字:

$X, Y$ vs. $X$, $Y$

數學和非數學環境中的逗號會有所不同。

有沒有辦法讓數學環境用來My Best Font標點符號?

謝謝!

答案1

您可以使用範圍選項來交換字元。

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

\setmathfont{Fira Math}
\setmainfont{TeX Gyre Termes}
\begin{document}

$X, Y $ X, Y

%should go in the preamble, in the body only for the example 
\setmathfont[range={44}]{TeX Gyre Termes}
\setmathfont[range=\int]{Fira Math}

$X, Y $ X, Y

\end{document}

在此輸入影像描述

相關內容