在數學模式和 siunitx 中使用自由數字

在數學模式和 siunitx 中使用自由數字

我又來這裡尋求你的幫助。我希望文件中的所有數字都相同(在文字或數學模式下)。我現在有

在此輸入影像描述

另請注意尺寸差異。無論環境如何,如何讓所有數字都位於 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}
[ ... ]

在此輸入影像描述

相關內容