当我在 LuaLaTeX 中从 Calibri 切换到 Cambria 时, a\middle/
失去了正确的大小。然后我尝试了fontspec
、unicode-math
和的组合mathastext
,但似乎都没有用。我没有尝试 Calibri,因为我不想再使用它了:
\documentclass{scrartcl}
%% ---------------------------------------------------------
%% Variant A: OK, except not Cambria
%\usepackage[T1]{fontenc}
%\usepackage{lmodern}
%\usepackage{amsmath}
%% ---------------------------------------------------------
%% Variant B: not OK, dash to small
\usepackage{fontspec}
\setmainfont{Cambria}[BoldFont = CambriaB]
\setsansfont{Corbel}[Numbers = Lining]
\setmonofont{Consolas}[Scale = 0.93]
\usepackage{unicode-math}
\setmathfont{Cambria Math} % needs unicode-math?
\usepackage{amsmath}
%% ---------------------------------------------------------
%% Variant C: not OK, wrong math font
%\usepackage[no-math]{fontspec}
%\setmainfont{Cambria}[BoldFont = CambriaB]
%\setsansfont{Corbel}[Numbers = Lining]
%\setmonofont{Consolas}[Scale = 0.93]
%\usepackage{amsmath}
%% ---------------------------------------------------------
%% Variant D: dash and parentheses OK, but wrong math font for sum and fraction line
%\usepackage[no-math]{fontspec}
%\setmainfont{Cambria}[BoldFont = CambriaB]
%\setsansfont{Corbel}[Numbers = Lining]
%\setmonofont{Consolas}[Scale = 0.93]
%\usepackage{amsmath}
%\usepackage[italic]{mathastext}
\begin{document}
Some math stuff:
\begin{gather}
E = m c^2\\
\sum_{i = 1}^{n} i = \frac12 n (n + 1)\\
\left.\left(86400\,\text{s}\right)\middle/\!\left(86400\,\frac{\text{s}}{\text{d}}\right)\right. = 1\,\text{d}
\end{gather}
\end{document}
答案1
分数斜线 U+2044 在 Cambria Math 中设置为可扩展,但未unicode-math
将其定义为分隔符,您可以直接访问它:
\documentclass{scrartcl}
%% ---------------------------------------------------------
%% Variant A: OK, except not Cambria
%\usepackage[T1]{fontenc}
%\usepackage{lmodern}
%\usepackage{amsmath}
%% ---------------------------------------------------------
%% Variant B: not OK, dash to small
\usepackage{fontspec}
\setmainfont{Cambria}%[BoldFont = CambriaB]
\setsansfont{Corbel}[Numbers = Lining]
\setmonofont{Consolas}[Scale = 0.93]
\usepackage{unicode-math}
\setmathfont{Cambria Math} % needs unicode-math?
\usepackage{amsmath}
%% ---------------------------------------------------------
%% Variant C: not OK, wrong math font
%\usepackage[no-math]{fontspec}
%\setmainfont{Cambria}[BoldFont = CambriaB]
%\setsansfont{Corbel}[Numbers = Lining]
%\setmonofont{Consolas}[Scale = 0.93]
%\usepackage{amsmath}
%% ---------------------------------------------------------
%% Variant D: dash and parentheses OK, but wrong math font for sum and fraction line
%\usepackage[no-math]{fontspec}
%\setmainfont{Cambria}[BoldFont = CambriaB]
%\setsansfont{Corbel}[Numbers = Lining]
%\setmonofont{Consolas}[Scale = 0.93]
%\usepackage{amsmath}
%\usepackage[italic]{mathastext}
\begin{document}
Some math stuff:
\begin{gather}
E = m c^2\\
\sum_{i = 1}^{n} i = \frac12 n (n + 1)\\
\left.\left(86400\,\text{s}\right)\middle/\!\left(86400\,\frac{\text{s}}{\text{d}}\right)\right. = 1\,\text{d}\\
\left.\left(86400\,\text{s}\right)\middle\fracslash\!\left(86400\,\frac{\text{s}}{\text{d}}\right)\right. = 1\,\text{d}\\
\left.\left(86400\,\text{s}\right)\middle\divslash\!\left(86400\,\frac{\text{s}}{\text{d}}\right)\right. = 1\,\text{d}\\
\left.\left(86400\,\text{s}\right)\middle\Udelimiter 0 0 "2044\!\left(86400\,\frac{\text{s}}{\text{d}}\right)\right. = 1\,\text{d}
\end{gather}
\end{document}