10 数学公式的演算,如何使用自己引用的数字字体?

发布于 2023-02-26 09:28:37

我要使用蓝色的数字字体。但在这个字体库里面没有根号等数学符号。
可以让根号等使用系统默认的,但计算式里的数字如何用蓝色数字的式样呢?

\documentclass{standalone}
\usepackage{tikz,amsmath}
\usepackage{xcolor}
\usepackage{xeCJK}
\newfontfamily\prof[Path=MyFonts/]{ArchitectsDaughter.ttf}
\begin{document}
\begin{tikzpicture}
\node[blue,font=\fontsize{20}{0}\selectfont] at (0,5) {\prof{0.02+0.015=0.035} };
\node[red,font=\fontsize{20}{0}\selectfont] at (0,4) {$\prof{0.02+0.015=0.035}$};
\node[red,font=\fontsize{20}{0}\selectfont] at (0,3) {\prof{$\sqrt{0.0004}+0.015=0.035$}};    
\end{tikzpicture}
\end{document}

cal.jpg
ArchitectsDaughter.ttf
math_cal.pdf

查看更多

关注者
0
被浏览
655
1 个回答
雾月
雾月 2023-02-26
这家伙很懒,什么也没写!

有三种方式:

  • 使用 unicode-math 设置数学字体,range 键可以设置仅使用字体的某些字符;会改变全局的数学字体
  • 使用 unicode-math\setmathfontface,然后像使用 \mathrm 一样使用,不能改符号的字体
  • 使用 \DeclareMathRadical 之类的来改个别符号
\documentclass{standalone}
\usepackage{tikz,amsmath}
\usepackage{xcolor}
\usepackage{xeCJK}
\usepackage{unicode-math}
\newfontfamily\prof[Path=MyFonts/]{ArchitectsDaughter.ttf}
%% 第一种
\setmathfont{Latin Modern Math}
\setmathfont{ArchitectsDaughter.ttf}[range={up/{num},`+,`=},Path=MyFonts/]

%% 第二种
\setmathfontface\mathprof{ArchitectsDaughter.ttf}[Path=MyFonts/]

\begin{document}
\begin{tikzpicture}
\node[blue,font=\fontsize{20}{0}\selectfont] at (0,5) {\prof 0.02+0.015=0.035 };
%% 第一种
\node[red,font=\fontsize{20}{0}\selectfont] at (0,4) {$0.02+0.015=0.035$};
\node[red,font=\fontsize{20}{0}\selectfont] at (0,3) {$\sqrt{0.0004}+0.015=0.035$};

%% 第二种
\node[red,font=\fontsize{20}{0}\selectfont] at (0,2) {$\sqrt{\mathprof{0.0004}}\mathprof{{}+0.015=0.035}$};
\end{tikzpicture}
\end{document}

撰写答案

请登录后再发布答案,点击登录

发布
问题

分享
好友

手机
浏览

扫码手机浏览