不鼓励在数学之前/之后换行

不鼓励在数学之前/之后换行

我想阻止在内联数学显示之前和之后换行,例如

now let $f$ be the function that connects

类似于

now let~$f$~be the function that connects 

对我来说,行为是否完全相同并不重要——事实上,我只想阻止在这些位置换行,而不一定完全禁止它们。我有一份很长的文档,里面有很多内联数学(事实上,这是我的硕士论文),我希望看到类似的东西

                      ... now let f
be the function that connects ...

                        ... now let
f be the function that connects ...

更少的次数,而不需要编辑每一个单独的事件(这将是几百次手动编辑)。

答案1

在此处输入图片描述

在数学运算之后插入惩罚并不难,看看之后的突破是如何$h$被抑制的。

\documentclass{article}

\begin{document}

one two three $f$ four five six
one two three $f$ four five six
one two three $h$ four five six
one two three $f$ four five six
one two three $f$ four five six
one two $g$ three $f$ four five six
one two three $f$ four five six
one two three $f$ four five six
one two three $f$ four five six


\def\hmmm{\nolinebreak[3]}
\everymath{\aftergroup\hmmm}

one two three $f$ four five six
one two three $f$ four five six
one two three $h$ four five six
one two three $f$ four five six
one two three $f$ four five six
one two $g$ three $f$ four five six
one two three $f$ four five six
one two three $f$ four five six
one two three $f$ four five six



\end{document}

当使用语法时,抑制数学之前的中断可能会很脆弱,$您能想到的大多数事情都会破坏某些东西......

相关内容