\numlist
我使用和\numrange
(及其\SI
变体)撰写了论文siunitx
包。在某些情况下,我在数学模式下使用了这些宏,例如,与我现在才看到的$\phi = \numlist{0.5;0.6;0.7}$
手册中非常明确的建议相反siunitx
。使用默认设置,这会导致列表最终分隔符以数学文本(即斜体)打印。所以我认为,没问题,我只需将分隔符包装在宏中\text{}
即可mathtools
,问题解决了。不幸的是,这会阻止在列表或范围内发生换行,无论列表或范围是否出现在数学模式下。
所以我的问题是,我可以通过更改设置来允许在需要的地方换行吗siunitx
?或者我是否必须仔细阅读我的论文并从数学模式中删除每个\...range
和\...list
命令,这样我就可以删除s\text{}
周围的list-separator
?
演示:
\documentclass[draft]{article}
\usepackage{siunitx}
\usepackage[showframe]{geometry}
\geometry{width=0.5in}
\setlength{\parindent}{0pt}
\begin{document}
\SIrange{750}{1000}{\kelvin} % Breaks
\SIlist{0.5;0.6;0.7}{\percent} % Breaks
$\phi = \numlist{0.5;0.6;0.7}$ % Doesn't break and italics
\sisetup{%
range-phrase = {\text{ to }},
list-separator = {\text{, }},
list-final-separator = {\text{, and }},
list-pair-separator = {\text{ and }},
}%
\SIrange{750}{1000}{\kelvin} % Doesn't break
\SIlist{0.5;0.6;0.7}{\percent} % Doesn't break
$\phi = \numlist{0.5;0.6;0.7}$ % Doesn't break
\end{document}
答案1
您链接的消息确实相关。
\documentclass[draft]{article}
\usepackage{siunitx}
\setlength{\parindent}{0pt}
\begin{document}
\sisetup{%
range-phrase = {\ \linebreak[0]\text{to}\ \nolinebreak},
list-separator = {\text{, }},
list-final-separator = {,\ \linebreak[0]\text{and }},
list-pair-separator = {\ \text{and}\ },
list-separator = {,\ \linebreak[0]}
}%
\parbox{0pt}{
\SIrange{750}{1000}{\kelvin} % Doesn't break
\SIlist{0.5;0.6;0.7}{\percent} % Doesn't break
$\phi = \numlist{0.5;0.6;0.7}$ % Doesn't break
}
\end{document}
这样引入的空间将参与线的拉伸或收缩。