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

Request for supporting label \ref \eqref #289

Open
hyliang96 opened this issue Jan 22, 2024 · 0 comments
Open

Request for supporting label \ref \eqref #289

hyliang96 opened this issue Jan 22, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@hyliang96
Copy link

hyliang96 commented Jan 22, 2024

Vscode-office (v3.1.8) doesn't support label \ref \eqref, while Typora and LaTeX supports.

image

Maybe this is due to KaTeX (a dependency of vscode-office) doesn't support it, whis was discussed in KaTeX/KaTeX#2003 .

Here I provide an idea to implement this feature in vscode-office.

There is a workaround proposed in KaTeX/KaTeX#2003 (comment), which doesn't require KaTeX to support \label \ref \eqref.

When KaTeX option is set as:

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

then \label \ref \eqref will be supported.

This idea can be applied to vscode plugin Markdown+Math, by adding the following settings (from goessner/mdmath#116 (comment)) into vscode config file,

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

and the following screen shot is the effect.

image

Counld author make vscode-office compatible with Markdown+Math, or provide similar config options vscode-office.katexoptions and vscode-office.macros, so as to let vscode-office support label \ref \eqref? Thanks.

By the way, as shown in the screen shot above, this workaround has a disadvantage: $\ref{eq-a}$ $\eqref{eq-a}$ will be rendered as 'eq-a' rather than '1' -- the numbering of equation. I wonder how to fix this bug, or is there another way to support label \ref \eqref?

@hyliang96 hyliang96 added the enhancement New feature or request label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant