mdmath
mdmath copied to clipboard
how to auto-number and quote math formula?
Summary
I have a very basic question: how can we auto-number and quote math formulas through this extension? I find katex is supported to auto-number math formulas, but mdmath seems to don't support it. As for quoting math formulas, I cannot find how to do this, the following code don't work:
$$
\pi \tag{1}\label{1}
$$
eq.$\eqref{1}$
...
Expected behavior
...
Actual behavior
...
Steps to reproduce
- First step
- Second step
- Third step
Code example
Some markdown code ...
... with issues.
Related links
Environment
Operating system: ___
VSCode version: ___
Markdown+Math version: ___
I use align environments to get eq numbering.
$$
\begin{align}
f'(x) &= \lim_{h \to 0} \frac{f(x+h)-f(x)}{h}
\end{align}
$$
Edit: I just tried using a label, but it renders with an error. It could be I haven't got amsmath to use it.
I use align environments to get eq numbering.
$$ \begin{align} f'(x) &= \lim_{h \to 0} \frac{f(x+h)-f(x)}{h} \end{align} $$
Are you sure? It doesn't work for me.
Here's (some of) the extensions and versions I have installed
- VSCode version v1.58.2
- mdmath version v2.7.4
- markdownlint v0.42.1
@carneeki When I disable the related function of markdown math
, it works. Thanks for your detailed explanation.
So, how to quote math formula?
@winterant
Reference: https://github.com/KaTeX/KaTeX/issues/2003#issuecomment-843991794
I added the following settings into my VSCode settings.json, and it seems rendering fine in the preview.
"mdmath.katexoptions": {
"trust": "(context) => ['\\htmlId', '\\href'].includes(context.command)"
},
"mdmath.macros": {
"\\eqref": "\\href{###1}{(\\text{#1})}",
"\\ref": "\\href{###1}{\\text{#1}}",
"\\label": "\\htmlId{#1}{}"
},