Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Referencing formula numbers in articles #34

Closed
falgon opened this issue Aug 12, 2020 · 5 comments
Closed

Referencing formula numbers in articles #34

falgon opened this issue Aug 12, 2020 · 5 comments
Assignees
Labels
wontfix This will not be worked on

Comments

@falgon
Copy link
Owner

falgon commented Aug 12, 2020

The expression number is inserted directly in the article, but it should be expressed by \label, \ref, \eqref, etc.
However, KaTeX (0.12.0) does not currently support them, so this is not feasible. If this is implemented, we plan to introduce it sequentially. (This was possible because the old blog used mathjax).

@falgon falgon added the wontfix This will not be worked on label Aug 12, 2020
@falgon falgon self-assigned this Aug 12, 2020
@falgon
Copy link
Owner Author

falgon commented Aug 12, 2020

simply and ugly workaround....

\tag{\htmlId{formula}{foo}}
\href{#formula}{foo}

@zhangpeng96
Copy link

zhangpeng96 commented May 19, 2021

Thanks to your solution. I use katex's marco function and wrap it up with elegant code.
KaTeX's configuration:

trust: (context) => ['\\htmlId', '\\href'].includes(context.command),
macros: {
  "\\eqref": "\\href{###1}{(\\text{#1})}",
  "\\ref": "\\href{###1}{\\text{#1}}",
  "\\label": "\\htmlId{#1}{}"
}

Then you can use \eqref & \ref & \label command same to latex or mathjax.

more details: https://column.mowchan.me/post/2021/katex-ref-label-support.html

@LXY631
Copy link

LXY631 commented Jun 4, 2021

@zhangpeng96 你好,不知有时间可以写一个 vs code 插件 markdowm+math(不是 markdown math)的配置文件吗,资料看了半天没有搞好,谢谢了。
软件预设的.json 文件模板如下:
"mdmath.macros": {

}

@zhangpeng96
Copy link

@zhangpeng96 你好,不知有时间可以写一个 vs code 插件 markdowm+math(不是 markdown math)的配置文件吗,资料看了半天没有搞好,谢谢了。
软件预设的.json 文件模板如下:
"mdmath.macros": {

}

markdowm是什么?是markdown打错了吗?关于katex的配置可以看官方的文档:https://github.com/KaTeX/KaTeX/blob/master/docs/options.md

vscode插件编写我不了解,没办法帮你

@hyliang96
Copy link

hyliang96 commented Jan 26, 2024

@zhangpeng96 你好,不知有时间可以写一个 vs code 插件 markdowm+math(不是 markdown math)的配置文件吗,资料看了半天没有搞好,谢谢了。 软件预设的.json 文件模板如下: "mdmath.macros": {

}

安装vscode插件: [Markdown+Math],并在vscode配置文件里添加如下设置,即可渲染\label、\ref、\eqref

"mdmath.katexoptions": {
    "trust": "(context) => ['\\htmlId', '\\href'].includes(context.command)"
},
"mdmath.macros": {
    "\\eqref": "\\href{###1}{(\\text{#1})}",
    "\\ref": "\\href{###1}{\\text{#1}}",
    "\\label": "\\htmlId{#1}{}"
},

本方法参考这个帖子

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

4 participants