![更改siunitx輸出的字體大小](https://rvso.com/image/475715/%E6%9B%B4%E6%94%B9siunitx%E8%BC%B8%E5%87%BA%E7%9A%84%E5%AD%97%E9%AB%94%E5%A4%A7%E5%B0%8F.png)
當使用 siunitx 套件編寫帶有單位的數字時\SI{1064}{\um}
,數字和單位明顯小於文本,但 mu 似乎是正確的大小。我使用 Verdana 作為主要文字字體和數學的預設 LaTeX 字體。 MiKTeX 並用 LuaLaTeX 編譯。
微量元素
\documentclass[10pt,a4paper]{article}
\usepackage{siunitx}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setsansfont{Verdana} % Setting sans font
\renewcommand*{\familydefault}{\sfdefault} % Making sans serif font the default
\linespread{1.16} % Increasing the linespacing
\usepackage{unicode-math}
\begin{document}
This is some text \SI{1064}{\um} m $m$
\end{document}
我嘗試使用\defaultfontfeatures{Scale=MatchLowercase}
\documentclass[10pt,a4paper]{article} \usepackage{siunitx}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures=TeX}
\setsansfont{Verdana} % Setting sans font
\renewcommand*{\familydefault}{\sfdefault} % Making sans serif font the default
\linespread{1.16} % Increasing the linespacing
\usepackage{unicode-math}
\defaultfontfeatures{Scale=MatchLowercase}
\begin{document}
This is some text with scaling \SI{1064}{\um} m $m$
\end{document}}
數學模式中寫的數字和 m 變大了,但單位中的 m 沒有變大。我已經嘗試過了\sisetup{detect-all}
,但這只會將所有寫入的內容更改\SI
為 Verdana,這不是我想要的。有沒有辦法增加單位中的字體大小?
答案1
您的問題是數學模式字體與正文字體的大小不同。例如,我透過縮放來解決這個問題
\documentclass[10pt,a4paper]{article}
\usepackage{siunitx}
\usepackage{fontspec}
\defaultfontfeatures{Ligatures = TeX, Scale = MatchLowercase}
\setsansfont{Verdana} % Setting sans font
\renewcommand*{\familydefault}{\sfdefault} % Making sans serif font the default
\usepackage{unicode-math}
\begin{document}
This is some text \qty{1064}{\um}.
\end{document}
答案2
答案3
我最初將 @JosephWright 的答案標記為解決方案,但這似乎縮小了主要字體(Verdana)以匹配數學字體大小。
因此,使用他的答案以及@Mico關於如何更改主要數學字體的評論,我找到了一個似乎有效的解決方案:
\documentclass[10pt,a4paper]{article}
\usepackage{siunitx}
\usepackage{unicode-math}
\defaultfontfeatures{Ligatures=TeX}
\setsansfont{Verdana} % Setting sans font
\renewcommand*{\familydefault}{\sfdefault} % Making sans serif font the default
\setmathfont{Cambria Math}[Scale=MatchUppercase] % Setting the maths font and scaling to match Verdana size
\setmathrm{Cambria Math}[Scale=MatchUppercase] % Setting the upright maths font used by siunitx
\newfontfamily{\mufont}{Cambria Math} % Selecting the mu from the Cambria Math font...
\DeclareSIPrefix\micro{\ensuremath{\mufont μ}}{-6} % ...and the selecting it for use with siunitx and make it represent 10^-6
\begin{document}
This is some text \dots\ \qty{1064}{\um}.
\end{document}
我需要將直立數學字體設定為 Cambria Math 和比例\setmathrm{Cambria Math}[Scale=MatchUppercase]