数学模式 siunitx 行太长

数学模式 siunitx 行太长

如何让数字适合文本宽度,而无需在每个数字前手动指定换行符?

问题

\documentclass[a4paper]{article}

\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{siunitx}

\begin{document}

We compare our results against the recommended values of $F = \SI{96485.33289(59)}{\coulomb\per\mol}$ and $e = \SI{1.6021766208(98)e-19}{\coulomb}$. Delectus velit omnis eum. Sint porro dolorem distinctio quae soluta quibusdam. Aut eligendi temporibus soluta molestiae. Iste hic commodi quia sint impedit porro. Corporis nemo ipsa qui voluptates omnis autem autem est. Maiores minima iure occaecati iusto. Pariatur quia aliquid et enim illo aliquam culpa explicabo.

\end{document}

答案1

你写了,

我宁愿让 LaTeX 弄清楚,如果数字要超出行尾,它应该在数字之前中断。

\sloppy在这种情况下,只需在行数过多的段落开头发出指令即可。(要稍后恢复正常,请发出指令\fussy。)或者将有问题的段落包含在sloppypar环境中。

在此处输入图片描述

\documentclass[a4paper]{article}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}
\usepackage{amsmath,siunitx,xcolor}

\begin{document}

\textcolor{red}{\texttt{\string\sloppy}}
\begin{sloppypar}
We compare our results against the recommended values of 
$F = \SI{96485.33289(59)}{\coulomb\per\mol}$ and $e = 
\SI{1.6021766208(98)e-19}{\coulomb}$. Delectus velit omnis 
eum. Sint porro dolorem distinctio quae soluta quibusdam. 
Aut eligendi temporibus soluta molestiae. Iste hic commodi 
quia sint impedit porro. 
\end{sloppypar}

\bigskip
\textcolor{red}{\texttt{\string\fussy}}
\par
We compare our results against the recommended values of 
$F = \SI{96485.33289(59)}{\coulomb\per\mol}$ and $e = 
\SI{1.6021766208(98)e-19}{\coulomb}$. Delectus velit omnis 
eum. Sint porro dolorem distinctio quae soluta quibusdam. 
Aut eligendi temporibus soluta molestiae. Iste hic commodi 
quia sint impedit porro. 

\end{document}

相关内容