hashmd icon indicating copy to clipboard operation
hashmd copied to clipboard

数学求和公式 可视化问题

Open gfhe opened this issue 3 years ago • 2 comments

在使用https://bytemd.js.org/playground/ 时,发现如下问题(截图):

image

在上图中,数学表达式显示错误。正确的Latex公式解析应该显示为(github解析markdown生成的):

$$R_N(h) = \frac{1}{N} \sum_{i=1}^N l(x_i, y_i))$$

gfhe avatar Jun 22 '22 04:06 gfhe

Math plugin 使用的是 https://katex.org/ ,可能与 MathJax 的渲染逻辑有一些区别

pd4d10 avatar Jun 22 '22 06:06 pd4d10

先引入 css,然后插件配置一下

import mathLocal from '@bytemd/plugin-math/locales/zh_Hans.json'; // 中文包
import 'katex/dist/katex.css'; // 样式

const plugins = [
  math({
    locale: mathLocal,
    katexOptions: { output: 'html' }, // https://github.com/KaTeX/KaTeX/issues/2796
  }),
 ...otherPlugins
];

lesonky avatar Jul 01 '22 07:07 lesonky

This issue is stale because it has been open for 60 days with no activity.

github-actions[bot] avatar Aug 31 '22 02:08 github-actions[bot]

This issue was closed because it has been inactive for 7 days since being marked as stale.

github-actions[bot] avatar Sep 07 '22 02:09 github-actions[bot]

先引入 css,然后插件配置一下

import mathLocal from '@bytemd/plugin-math/locales/zh_Hans.json'; // 中文包
import 'katex/dist/katex.css'; // 样式

const plugins = [
  math({
    locale: mathLocal,
    katexOptions: { output: 'html' }, // https://github.com/KaTeX/KaTeX/issues/2796
  }),
 ...otherPlugins
];

@lesonky 大佬,katexOptions 是怎么导入的呢?能分享下代码吗?

carveybunt avatar Apr 02 '23 04:04 carveybunt