如何在 Xetex 中将 URW-Arial 字体用于文本和数学?

如何在 Xetex 中将 URW-Arial 字体用于文本和数学?

这与我的另一个问题有关如何在 pdflatex 中使用 URW-Arial 字体来显示文本和数学在 stack exchange 中。我想使用 Arial 字体来显示数学和文本。Ulrike Fischer 指出引用了答案https://tex.stackexchange.com/a/309120/2388使用 URW-Arial 不是一个好主意。我之前曾尝试使用 xelatex 来实现。这是一个最小工作示例。

\documentclass[12pt]{article}
\usepackage[notext]{stix}
\usepackage[fleqn]{amsmath}
\usepackage{mathspec}
\setmainfont{Arial}
\setallmainfonts(Latin){Arial}
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\begin{document}\raggedright
The curve is increasing between \(0\) and \(\frac{1}{4}\) and the 
minimum value is attained at \(x=0\).  The sum of the areas of these
blue rectangles is less than the area under the curve.

We define the \textbf{upper sum} \(U(P,f\,)\) by 
\begin{equation}
U(P,f)=\sum_{i=1}^n M_i\Delta_i\label{def-uppersum} \end{equation} and the \textbf{lower sum} \(L(P,f)\) by\index{Lower Sum}
\begin{equation}
L(P,f)=\sum_{i=1}^n m_i\Delta_i\label{def-lowersum} \end{equation}

Evaluate
\[
\int_0^2 \frac{1}{1+t^2}\,dt.
\]
\end{document}

但是,这还有其他问题。以下是输出的屏幕截图。 在此处输入图片描述

在分数 1/4 中,4 太靠近下一行。在 L(P,f) 和 U(P,f) 中,f 接触到右括号。在积分中,上标 2 太靠近 t。这些问题可以解决吗?

答案1

您可以尝试类似这样的方法。但请注意,文本字体不是数学字体:它们缺少良好数学所需的大量字体尺寸和字形。因此,将它们用于数学始终只是一种变通方法。还请注意,unicode-math 的范围选项有点问题。

\documentclass[12pt]{article}

\usepackage[fleqn]{amsmath}
\usepackage{unicode-math,xfrac}
\setmainfont{Arial}
\setmathfont{STIX2Math.otf}
\setmathfont{Arial Italic}[range={it,bfit}]
\setmathfont{Arial}[range=up/{num}]
\setmathfont[range=\int]{STIX2Math.otf}
\newcommand{\R}{\ensuremath{\mathbb{R}}}
\begin{document}\raggedright
The curve is increasing between \(0\) and \(\sfrac{1}{4}\) and the
minimum value is attained at \(x=0\).  The sum of the areas of these
blue rectangles is less than the area under the curve.

We define the \textbf{upper sum} \(U(P,f\,)\) by
\begin{equation}
U(P,f)=\sum_{i=1}^n M_i\Delta_i\label{def-uppersum} \end{equation} and the \textbf{lower sum} \(L(P,f)\) by\index{Lower Sum}
\begin{equation}
L(P,f)=\sum_{i=1}^n m_i\Delta_i\label{def-lowersum} \end{equation}

Evaluate
\[
\int_0^2 \frac{1}{1+t^2}\,dt.
\]
\end{document}

在此处输入图片描述

相关内容