首页 > 解决方案 > 内联 mathjax 公式后不需要的单词中断

问题描述

我正在使用 Mathjax 在 Jekyll 站点中嵌入公式,使用 Kramdown 作为我的渲染器。

它工作得很好,除了总是在内联公式之后插入一个隐式换行符,这意味着换行可以在公式和标点符号之间插入换行符。这导致了这样的事情:

Where this fell down was that my representation was very limited as to what
numbers it can represent. The _smallest_ number possible was the integer `1`,
which represented $$\frac{1}{64} \approx 0.016$$; the _largest_ number was
the integer `127` (the top bit is used for the sign), which represented $$1
\frac{63}{64} \approx 1.98$$.

...被渲染为:

在此处输入图像描述

这看起来很糟糕。

有什么办法可以防止这种情况发生吗?

标签: markdownmathjax

解决方案


在 MathJax 和任何降价处理器(我知道)中都没有解决这个问题的内置方法。

解决此问题的两种方法:

  1. 移动等式内的标点符号
  2. 在您的工具链中的某处添加一个后处理启发式方法,该方法将由非空格包围的方程式包装在样式包括的元素中white-space: nowrap;;这将确保内部不会出现中断。

推荐阅读