-
Notifications
You must be signed in to change notification settings - Fork 332
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
Support \gdef (macros) in KaTeX #426
Comments
All supported functions can be found at
https://katex.org/docs/supported.html, you may need to report it to KaTeX.
…On Tue, Apr 23, 2019, 4:02 PM elbaro ***@***.***> wrote:
What is the problem?
\gdef defines a global macro. This plugin seems not supporting \gdef.
How can I reproduce it?
$$
\gdef\plim{\operatorname{plim}}
\plim asdf
$$
$$
\plim asdf
$$
The second macro does not render.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#426>, or mute the
thread
<https://github.com/notifications/unsubscribe-auth/AF4YPBFHEWAY2IDP2VO6U7TPR27ALANCNFSM4HHVQVGA>
.
|
I think it is a problem in the plugin. Katex supports <!DOCTYPE html>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-dbVIfZGuN1Yq7/1Ocstc1lUEm+AT+/rCkibIcC/OmWo5f0EA48Vf8CytHzGrSwbQ" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-2BKqo+exmr9su6dir+qCw08N2ZKRucY4PrGQPPWU1A7FtlCGjmEGFqXCv5nyM5Ij" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
<body>
$$
\gdef\plim{\operatorname{plim}}
\plim asdf
$$
$$
\plim asdf
$$
</body> This may be because the plugin does not call a rendering function with |
You are right. We haven't used the |
It would be also nice to be able to store all the user-defined macros in an external file and load them in Katex. It is possible with the ‘macro’ option. |
I am looking at how to add the Anyway, it may be worth it to change this dependency by another one (see previous link). |
My bad, I can use the |
The author said he would update it (last commented 2 days ago, in the issue you mentioned). (Actually, |
Thanks to @PierreMarchand20, we now have this feature in the dev build (new option See |
That is weird, we only added an option when calling |
@yzhang-gh According to the docs , you can see the error of KaTeX by setting the vscode-markdown/src/extension.ts Line 26 in d485552
For example, this: |
Okay, I have fixed it, this is really a small problem. The We should use |
That is weird no ? oO I used it this way because I thought that if we added other settings about katex, we needed to use the |
Looking at the definition:
it should return an object no ? |
@PierreMarchand20 Yes, that is really interesting. workspace.getConfiguration('markdown.extension.katex').get<object>('macros') as unknown as string == '{}'
// true So, although the return type is an object, it is actually is a string. |
Actually, I think the issue comes when the parameter |
Yes, and now I have fixed it in the PR #443 |
But then, I think we can leave the |
I have been inspired by another VSCode plugin |
You are right, I am going to fix the default value of |
But it seems that the default value I put is the same as in the package you mentioned |
Ah no I see ^^here's why it was a string I guess |
I actually looked at this repo when I did my pull request, but I did not understand why it needed all this to get the macros. |
Haha, anyway we have fixed it, thanks for your help @PierreMarchand20 ! Have a nice day ❤️ |
Well thank you for fixing my mistake ! Second time I try to do something in typescript ^^ But you did fix a typo at first in your pull request that could be interesting to fix !!! |
Yep, I have fixed it again~ |
Interesting
Currently, the delimiters are handled by
I actually have seen the same mistake recently (also from a PR, lol).
🤣 |
I am so sorry, just realized what mistake I made, thanks for pointing it out! |
Nonono, I also didn't notice that. Thanks for all the contributions 👍 |
it does not work for me with the last update. I am trying to understand why, but in the meantime, here's my setting :
|
fixed in #473, the option for giving macros to katex is |
I'm still having this issue in v2.4.0. It seems that #473 isn't included in the release, i've checked In addition, the check |
The fix has not been shipped yet. You can try out our dev build. As for the check |
What is the problem?
Katex provides \gdef, which defines a global macro. This plugin seems not supporting \gdef.
How can I reproduce it?
The second macro does not render.
The text was updated successfully, but these errors were encountered: