skip to content
Jiaxin的仓库

Typst to HTML 导出中的数学公式渲染

/ 1 min read

在 Typst 中导出为 HTML 时,如果额外加入一些设置。在导出的时候就会遇到数学公式无法渲染的问题。

根据Typst 论坛的讨论,可以通过引入额外的声明来解决这个问题。 只需要在 Typst 文档的开头加入以下代码:

#let target = dictionary(std).at("target", default: () => "paged")
#show math.equation: it => context {
// only wrap in frame on html export
if target() == "html" {
// wrap frames of inline equations in a box
// so they don't interrupt the paragraph
show: if it.block { it => it } else { box }
html.frame(it)
} else {
it
}
}