Closed fweth closed 4 months ago
Welcome @fweth! 👋 have you tried the macros option? https://github.com/remarkjs/remark-math/blob/e99b9d088709d743adf6a43551fd416d7e0014ed/packages/rehype-katex/test.js#L131-L149
Abbreviations should be stored in a global context, not scoped to individual math blocks.
That feels unexpected. From the readme:
to be able to embed rich diagrams of math to scientific documentation
Embedded documents, are just that, independent documents inside of a host document.
It sounds like you want interleaving of different languages, perhaps something like https://mdxjs.com/ or https://jupyter.org/
Thanks, this sounds great!
Still, KaTeX/MathJax editors like VSCode (with preview), iA Writer, HackMD, etc. support global math contexts. KaTeX docs also say
Macros defined by \gdef, \xdef, \global\def, \global\edef, \global\let, and \global\futurelet will persist between math expressions. (Exception: macro persistence may be disabled. There are legitimate security reasons for that.)
Hi! This was closed. Team: If this was fixed, please add phase/solved
. Otherwise, please add one of the no/*
labels.
Initial checklist
Problem
I like to use KaTex macros, especially where I put all my custom commands in a single math block at the top of the file. This is supported by many KaTeX based editors, including VSCode with it's built in preview. However, I couldn't get this to work with remark:
Here the scope of the definition is its own math block, so it can't be used outside of the block. Would be awesome if there is a way to get this working!
Solution
Abbreviations should be stored in a global context, not scoped to individual math blocks.
Alternatives
I can't think of an alternative solution.