Jupyter 笔记本 Markdown 输出在具有内联 MathJax 表达式的行上添加了额外的垂直填充

发布于 2025-01-11 12:54:00 字数 1009 浏览 0 评论 0原文

我的 Jupyter Notebook 的 Markdown 单元格中的内联 MathJax 通常(特别是涉及超级/下标时)会导致渲染的行具有与段落分隔符一样多的垂直空间,尽管没有此类输入。

以下是呈现的版本,显示了似乎是多个段落分隔符的内容:

在此处输入图像描述

以及输入,在“It”之前显示单个段落中断(尽管包裹在 SO 上):

The solutions the to polynomial $x^d = 1$ are then the powers of *a*, and there are only *d* unique powers of *a* in $Z/(P))^{\times}$ - synergistically, since a polynomial of degree *d* under a multiplicative group has at most *d* roots (or equivalently, solutions, in this case), then all *d* powers of *a*, or the subgroup *A* represent the *only* possible solutions to the polynomial.

It is possible that an element of the subgroup generated by *a* contains elements with orders less than *d* (but never greater than).

这完全破坏了流程,看起来很丑,并且使预期的段落无效间距。更糟糕的是,它似乎正在创造表达甚至不需要的空间。有没有办法在我的单元格/笔记本中实现一致的垂直线填充?我不记得这总是一个问题。

Inline MathJax in the Markdown cells of my Jupyter Notebook often (especially when super/subscripts are involved) will cause the rendered line to have as much vertical space as a paragraph break despite no such input.

Here is the rendered version showing what appear to be multiple paragraph breaks:

enter image description here

And the input, which shows a single paragraph break (though wrapped on SO) right before "It":

The solutions the to polynomial $x^d = 1$ are then the powers of *a*, and there are only *d* unique powers of *a* in $Z/(P))^{\times}$ - synergistically, since a polynomial of degree *d* under a multiplicative group has at most *d* roots (or equivalently, solutions, in this case), then all *d* powers of *a*, or the subgroup *A* represent the *only* possible solutions to the polynomial.

It is possible that an element of the subgroup generated by *a* contains elements with orders less than *d* (but never greater than).

This completely breaks the flow, looks ugly, and nullifies intended paragraph spacing. Even worse, it seems to be creating space which isn't even required for the expression. Is there a way to achieve a consistent vertical line padding throughout my cell/notebook? I don't remember this always being a problem.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

删除→记忆 2025-01-18 12:54:00

您可以更改位于 ~/.jupyter/customcustom.css 文件的此片段,以删除占据 Markdown 单元格中行高的 MathJax 表达式。对我来说,它位于第 3201 行。

.MathJax_Display,
.MathJax {
 border: 0 !important;
 font-size: 100% !important;
 text-align: center !important;
 margin: 0em !important;
 //line-height: 2.25 !important; // // // // COMMENT OUT THIS LINE // // // //

我确信这可以防止当垂直扩展的 MathJax 表达式内联使用时发生一些非常丑陋的剪辑,但我宁愿在出现这些问题时处理它们,而不是句子中间经常出现不一致和意外的换行符。

You can change this snippet of the custom.css file located at ~/.jupyter/custom to remove MathJax expressions taking over the line height in your Markdown cells. For me this was located at line 3201.

.MathJax_Display,
.MathJax {
 border: 0 !important;
 font-size: 100% !important;
 text-align: center !important;
 margin: 0em !important;
 //line-height: 2.25 !important; // // // // COMMENT OUT THIS LINE // // // //

I'm sure this prevents some very ugly clipping that can happen when vertically expansive MathJax expressions are used inline, but I would rather deal with those issues as they arise than constantly having inconsistent and unintended line breaks mid sentence.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文