我想分别全局定义per-mode
数学siunitx
环境和 displaymath 环境。这可能吗?
以下是 MWE:
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\sisetup{per-mode=symbol}
\begin{document}
This is an inline equation: $a = \SI{10}{\meter\per\second\squared}$, to show inline behaviour.
And this is the same equation in displaymath environment:
\begin{equation*}
a = \SI{10}{\meter\per\second\squared}
\end{equation*}
\end{document}
得出的结果为:
我想做的事情是这样的:
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\sisetup{per-mode-math=symbol,
per-mode-displaymath=fraction}
\begin{document}
This is an inline equation: $a = \SI{10}{\meter\per\second\squared}$, to show inline behaviour.
And this is the same equation in displaymath environment:
\begin{equation*}
a = \SI{10}{\meter\per\second\squared}
\end{equation*}
\end{document}
然后应该产生以下输出:
答案1
\sisetup{per-mode=symbol-or-fraction}
正如 Joseph Wright 指出的那样:这里的解决方案是按照手册中所述使用siunitx
:
最后,函数的行为可能
\per
取决于当前的数学样式。将 per-mode 设置为 symbol-or-fraction 将使用符号设置进行内联数学运算,并在数学运算中使用分数设置\displaystyle
。
因此对于 MWE 来说:
\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}
\sisetup{per-mode=symbol-or-fraction}
\begin{document}
This is an inline equation: $a = \SI{10}{\meter\per\second\squared}$, to show inline behaviour.
And this is the same equation in displaymath environment:
\begin{equation*}
a = \SI{10}{\meter\per\second\squared}
\end{equation*}
\end{document}
其工作符合预期: