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

CustomMacros and math display mode? #156

Open
gosanon opened this issue Sep 17, 2024 · 2 comments
Open

CustomMacros and math display mode? #156

gosanon opened this issue Sep 17, 2024 · 2 comments
Assignees

Comments

@gosanon
Copy link

gosanon commented Sep 17, 2024

I created a macro which should transform one string to another. If I try to render such string: "\mymacro$\mymacro$", it works in first part but second part renders as a red "\mymacro" text instead of what it should have been transformed to. I read generator/htmlgenerator source code and came to a conclusion that it won't render because math pieces of the document are rendered via katex and my macros are not sent there. Is it true? If so, what would you recommend to create math mode macros? If not, why won't the macro render in math mode? Also, I believe #126 was a question about that.

@gosanon
Copy link
Author

gosanon commented Sep 22, 2024

I just noticed \newcommand works in math mode as expected. I'll write a wrapper to create "math" macros using it. But I still don't quite understand if CustomMacros should work in math display mode by design

@michael-brade
Copy link
Owner

Ah, yes, now I understand #126 :) Your analysis is correct, the latex.js macros are not (yet) available in KaTeX. I just had a look at the KaTeX API: it is possible to pass a macros object to KaTeX. Maybe it is possible to create a compatible object from LaTeX.js automatically... I have to investigate.

@michael-brade michael-brade self-assigned this Dec 29, 2024
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

2 participants