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

how to auto-number and quote math formula? #116

Open
dualer opened this issue Jul 15, 2021 · 6 comments
Open

how to auto-number and quote math formula? #116

dualer opened this issue Jul 15, 2021 · 6 comments

Comments

@dualer
Copy link

dualer commented Jul 15, 2021

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

  1. First step
  2. Second step
  3. Third step

Code example

Some markdown code ...

... with issues.

Related links

Environment

     Operating system: ___
       VSCode version: ___
Markdown+Math version: ___
@carneeki
Copy link

carneeki commented Jul 25, 2021

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.

@dualer
Copy link
Author

dualer commented Jul 26, 2021

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.

@carneeki
Copy link

image

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

@dualer
Copy link
Author

dualer commented Jul 27, 2021

@carneeki When I disable the related function of markdown math, it works. Thanks for your detailed explanation.

@winterant
Copy link

So, how to quote math formula?

@JoeyTeng
Copy link

JoeyTeng commented Oct 30, 2022

@winterant

Reference: KaTeX/KaTeX#2003 (comment)

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}{}"
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants