是否可以“锁定”或保护文本中显示的数学公式的间距,以便乳胶不会拉伸和挤压公式?
我会不是喜欢对所有公式全局执行此操作,但我有一个公式 ($(-+++)$) 重复出现。是否可以强制 latex 始终以相同的间距显示它?
更新:我现在意识到渲染 $(-+++)$ 时出现的问题不是由于段落中的拉伸/挤压,而是由于 + 和 - 在 latex 公式中的特殊作用。第一个 - 和 + 大概被视为公式中术语之间的分隔符,后两个渲染方式不同,间距较短。cgnieder 给出的解决方案 $({-}{+}{+}{+})$ 解决了这个间距问题,并在所有 +:s 和 -:s 之间提供了相等的间距。如何删除这样的空格之前有人问过:在数学模式中删除“单词”之间的空格。
答案1
可以使用 冻结(子)公式中的间距{...}
。在下面的例子中
\( x+y = z \)
在第一段中使用,并根据需要拉伸(或收缩),而在第二段中
\( {x+y = z} \)
获得固定间距。
\documentclass{article}
\begin{document}
Here is an example formula \( x+y = z \) which we repeat at several
times during the paragraph. Notice that the spacing changes on
different uses \( x+y = z \) depending on how much the line is
stretch. This is useful as it helps with even spacing of the whole
paragraph despite the presence of formulae \( x+y = z \). Stretchable
spacing in the mathematics \( x+y = z \) is often to be preferred.
Using braces \verb!{}! around the forumla \( {x+y = z} \) freezes the
spacing. It also prevents line breaks occuring in the middle of the
formula \( {x+y = z} \). This prevention of line breaks can also be
used in subformals, but we are demonstrating that in the case of \(
{x+y = z} \). I expect to see that the spacing in this paragraph is
not as good as the previous because of the lack of flexibility
associated to the formula \( {x+y = z} \).
\end{document}
你可以在 TeXbook 的第 173 页找到这种行为的描述