![在數學模式和 siunitx 中使用自由數字](https://rvso.com/image/327780/%E5%9C%A8%E6%95%B8%E5%AD%B8%E6%A8%A1%E5%BC%8F%E5%92%8C%20siunitx%20%E4%B8%AD%E4%BD%BF%E7%94%A8%E8%87%AA%E7%94%B1%E6%95%B8%E5%AD%97.png)
我又來這裡尋求你的幫助。我希望文件中的所有數字都相同(在文字或數學模式下)。我現在有
另請注意尺寸差異。無論環境如何,如何讓所有數字都位於 Libertine 中?我的意思是保留 siunitx 行為不變,並在數學模式下僅更改數字(並且僅更改數字)的字體?
如果我嘗試
\DeclareSymbolFont{numbers}{T1}{LinuxLibertineO}{m}{n}
\SetSymbolFont{numbers}{bold}{T1}{LinuxLibertineO}{bx}{n}
\DeclareMathSymbol{0}\mathalpha{numbers}{"30}
\DeclareMathSymbol{1}\mathalpha{numbers}{"31}
\DeclareMathSymbol{2}\mathalpha{numbers}{"32}
\DeclareMathSymbol{3}\mathalpha{numbers}{"33}
\DeclareMathSymbol{4}\mathalpha{numbers}{"34}
\DeclareMathSymbol{5}\mathalpha{numbers}{"35}
\DeclareMathSymbol{6}\mathalpha{numbers}{"36}
\DeclareMathSymbol{7}\mathalpha{numbers}{"37}
\DeclareMathSymbol{8}\mathalpha{numbers}{"38}
\DeclareMathSymbol{9}\mathalpha{numbers}{"39}
LuaLaTex 抱怨說沒有這樣的形狀。
這是最小的例子
% !Mode:: "TeX:UTF-8"
%
\documentclass[a4paper,11pt]{book}
\usepackage{fontspec}
\usepackage{unicode-math}
\setmainfont{Linux Libertine O}
\addfontfeatures{Numbers={Lining,Monospaced}}
\setsansfont{Linux Biolinum O}
\setmonofont{Consolas}
\setmathfont[math-style=ISO,bold-style=ISO]{Cambria Math}
\usepackage{siunitx}
\begin{document}
Now I have
\begin{itemize}
\item Libertine in text mode: 123456789
\item Libertine using siunitx in text mode: \SI{123456789}{\km\per\hour}
\item Cambria in math mode: $123456789$
\item Libertine using siunitx in math mode: $\SI{123456789}{\km\per\hour}$
\end{itemize}
I would like libertine in math mode too $123456789$.
\end{document}
答案1
\documentclass[a4paper,11pt]{book}
\usepackage{unicode-math}
\usepackage{libertine}
\addfontfeatures{Numbers={Lining,Monospaced}}
%\setmonofont{Consolas}% not available for me
\setmathfont[math-style=ISO,bold-style=ISO]{Cambria Math}
\setmathfont[range=0048-0057]{Linux Libertine O}
\usepackage{siunitx}
\begin{document}
[ ... ]