使用 fontspec 更改 newtxmath 数学字母的字体

使用 fontspec 更改 newtxmath 数学字母的字体

我的论文设置是使用fontspec但保留数学,newtxmath因为我更喜欢这个包的符号的外观,而不是 OpenType 数学字体。现在我的问题是数学模式下的 Times 大写字母比文本模式下的 TNR 大写字母更粗,这在排版页面上太明显了。小写字母和数字也不同,但我不太介意。

是否可以使用 TNR 字体加载fontspec字母和数字在数学模式中?我还想保留字母形式G因为newtxmath它们看起来比TNR斜体更好。

\documentclass[12pt,a4paper]{article}

\usepackage[varg]{newtxmath}

% fix to have numerals not in CM
\DeclareSymbolFont{operators}{OT1}{ntxtlf}{m}{n}
\SetSymbolFont{operators}{bold}{OT1}{ntxtlf}{b}{n}

\usepackage[no-math]{fontspec}

\setmainfont{Times New Roman}

\newcommand\alphabet{abcdefghijklmnopqrstuvwxyz}
\newcommand\numbers{0123456789}

\begin{document}
\noindent\textit{\alphabet\\\MakeUppercase{\alphabet}}\\\numbers

\noindent\(\alphabet\\\MakeUppercase{\alphabet}\\\numbers\)
\end{document}

截屏

该示例使用了来自此答案的修复:https://tex.stackexchange.com/a/394137/75284避免使用计算机现代数学数字。

答案1

您可以更改字体。但是我会避免使用小写字母 — 间距差异太大,例如 f。

\documentclass[12pt,a4paper]{article}

\usepackage[varg]{newtxmath}

% fix to have numerals not in CM
\DeclareSymbolFont{operators}{OT1}{ntxtlf}{m}{n}
\SetSymbolFont{operators}{bold}{OT1}{ntxtlf}{b}{n}

\usepackage[no-math]{fontspec}

\setmainfont{Times New Roman}[NFSSFamily=times]

\DeclareSymbolFont{uppercaseletters}{TU}{times}{m}{it}

\DeclareMathSymbol{A}{\mathalpha}{uppercaseletters}{`A}
\DeclareMathSymbol{B}{\mathalpha}{uppercaseletters}{`B}
\DeclareMathSymbol{C}{\mathalpha}{uppercaseletters}{`C}
\DeclareMathSymbol{D}{\mathalpha}{uppercaseletters}{`D}
\DeclareMathSymbol{E}{\mathalpha}{uppercaseletters}{`E}
\DeclareMathSymbol{F}{\mathalpha}{uppercaseletters}{`F}
\DeclareMathSymbol{G}{\mathalpha}{uppercaseletters}{`G}
\DeclareMathSymbol{H}{\mathalpha}{uppercaseletters}{`H}
\DeclareMathSymbol{I}{\mathalpha}{uppercaseletters}{`I}
\DeclareMathSymbol{J}{\mathalpha}{uppercaseletters}{`J}
\DeclareMathSymbol{K}{\mathalpha}{uppercaseletters}{`K}
\DeclareMathSymbol{L}{\mathalpha}{uppercaseletters}{`L}
\DeclareMathSymbol{M}{\mathalpha}{uppercaseletters}{`M}
\DeclareMathSymbol{N}{\mathalpha}{uppercaseletters}{`N}
\DeclareMathSymbol{O}{\mathalpha}{uppercaseletters}{`O}
\DeclareMathSymbol{P}{\mathalpha}{uppercaseletters}{`P}
\DeclareMathSymbol{Q}{\mathalpha}{uppercaseletters}{`Q}
\DeclareMathSymbol{R}{\mathalpha}{uppercaseletters}{`R}
\DeclareMathSymbol{S}{\mathalpha}{uppercaseletters}{`S}
\DeclareMathSymbol{T}{\mathalpha}{uppercaseletters}{`T}
\DeclareMathSymbol{U}{\mathalpha}{uppercaseletters}{`U}
\DeclareMathSymbol{V}{\mathalpha}{uppercaseletters}{`V}
\DeclareMathSymbol{W}{\mathalpha}{uppercaseletters}{`W}
\DeclareMathSymbol{X}{\mathalpha}{uppercaseletters}{`X}
\DeclareMathSymbol{Y}{\mathalpha}{uppercaseletters}{`Y}
\DeclareMathSymbol{Z}{\mathalpha}{uppercaseletters}{`Z}

\newcommand\alphabet{abcdefghijklmnopqrstuvwxyz}
\newcommand\numbers{0123456789}

\begin{document}
\noindent\textit{\alphabet\\\MakeUppercase{\alphabet}}\\\numbers

$fi(x)=1$

\noindent\(\alphabet\\\MakeUppercase{\alphabet}\\\numbers\)
\end{document} 

截屏

答案2

除非你的文档要接受字体怪人的检查,否则他/她可能会因为发现文档中使用了 Times 而不是 Times New Roman 而发狂,否则你可以大大简化文档设置——只需加载该包,几乎可以保证文本和数学模式下的字形粗细相同newtxtext。此外,文本和数学模式下的数字都将以 Times 格式显示。

截屏

如前面的截图所示,字体非爱好者可能注意到的 Times 和 Times New Roman 之间唯一有意义的区别在于符号的外观%(直立和斜体形状)和z字形(仅限斜体模式:Times 为花饰字体,Times New Roman 为非花饰字体)。

% !TEX TS-program = lualatex
\documentclass[12pt,a4paper]{article}
\usepackage[no-math]{fontspec}
\usepackage{newtxtext}
\usepackage[varg]{newtxmath}

\newcommand\alphabet{abcdefghijklmnopqrstuvwxyz}
\newcommand\numbers{0123456789}

\begin{document}
\obeylines % just for this example
{\itshape
\alphabet
\MakeUppercase{\alphabet}}
\numbers
$\alphabet$
$\MakeUppercase{\alphabet}$
$\numbers$

\medskip
Times: \%
Times Italic: \textit{z\%} 
\setmainfont{Times New Roman}
Times New Roman: \%
Times New Roman Italic: \textit{z\%}
\end{document}

相关内容