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

Please persist macros with KaTeX globalGroup #117

Open
chrisyeh96 opened this issue Jul 29, 2021 · 2 comments
Open

Please persist macros with KaTeX globalGroup #117

chrisyeh96 opened this issue Jul 29, 2021 · 2 comments

Comments

@chrisyeh96
Copy link

Summary

Macros such as $\newcommand{\ra}{\rightarrow}$ are not persisting between math blocks.

Steps to reproduce

  1. Install the latest version of VSCode (1.58).

  2. Disable VSCode's built-in markdown math renderer: uncheck the Markdown > Math setting checkbox.

  3. Create a new markdown file in VSCode.

  4. Write the following:

    $\newcommand{\ra}{\rightarrow}$
    
    $\ra$

I would like for this to work, but it currently does not. However, I believe that by using KaTeX's globalGroup option, it should be able to work.

Environment

- OS: Windows 10 21H1 64-bit
- mdmath v2.7.4
- VSCode 1.58 (with the native `Markdown > Math` setting disabled)
@ickc
Copy link

ickc commented Aug 6, 2021

This is already doable. In settings.json:

    "mdmath.katexoptions": {
        "globalGroup": true,
    },

@MichaelJFishman
Copy link

MichaelJFishman commented Feb 23, 2022

I added

    "mdmath.katexoptions": {
        "globalGroup": true,
    },
    "markdown.math.enabled": false,

to my settings.json and reloaded vscode, but markdown still does not display the rightarrow correctly:

$\newcommand{\ra}{\rightarrow}$

$\ra$

Edit: If I also add "markdown.extension.math.enabled": false to settings.json, then the $\ra$ displays correctly. However

  1. If I re-render the preview the $\newcommand{\ra}{\rightarrow}$ displays in red as invalid latex, I believe because the command still exists from the previous rendering
  2. I still get an error when using these commands in a python notebook: ParseError: KaTeX parse error: Undefined control sequence: \ra at position 1: \ra.

This may be related to this katex issue.

Environment

- OS: Ubuntu 20.04.4 LTS
- mdmath v2.7.4
- VSCode 1.64.2 (with the native `Markdown > Math` setting disabled)

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

3 participants