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

Is there a way to include an entire Mathjax config? #9

Open
dzackgarza opened this issue May 9, 2021 · 5 comments
Open

Is there a way to include an entire Mathjax config? #9

dzackgarza opened this issue May 9, 2021 · 5 comments

Comments

@dzackgarza
Copy link

This isn't really an issue per se, but I'm wondering if there's an easy way to adapt this plugin to just use an entirely customized Mathjax configuration. For example, I have something of the following form I use for other previews:

image

Then e.g. I include it in my website in the following way (this gets compiled + embedding as a script on each webpage):
image

Any idea if there's a way to point this plugin at a config like this (or something similar), as opposed to just a list of macros?

@xldenis
Copy link
Collaborator

xldenis commented May 9, 2021

As a plugin we can't control when MathJax gets loaded, this is actually a source of raciness in the plugin as is. If this is something that can be done after MathJax gets loaded then it should be possible to add as a feature otherwise I think it will be too unstable for widespread usage...

@xldenis
Copy link
Collaborator

xldenis commented May 9, 2021

I've quickly looked into this but in theory MathJax.startup.getComponents should allow us to reload the configuration? If I can get that to work it would be possible to accept arbitrary configurations.

@dzackgarza
Copy link
Author

I'm not entirely sure how the library version of Mathjax works, but when it's included in web pages through a script tag, there are separate options for either loading the config strictly before Mathjax loads (https://docs.mathjax.org/en/v2.7-latest/configuration.html#using-in-line-configuration-options) or strictly afterward (https://docs.mathjax.org/en/v2.7-latest/configuration.html#configuring-mathjax-after-it-is-loaded).

@xldenis
Copy link
Collaborator

xldenis commented May 10, 2021

We can't count on anything which requires modifying HTML since we may get loaded after configuration has already started. In MathJax 3 there is a possibility to rebuild the internal objects after startup but it seems to only half work. What specific things would you hope to load? Is it really the configuration object itself or is there a specific bit of functionality you want (equation numbering?).

@dzackgarza
Copy link
Author

The most pressing things would be the inline/displaymath delimiters, and maybe some kind of manual control over macros. Just feeding in my list of tex macros works fairly well (in fact I can just symlink my entire macro definition file), but there are certain macros that require different approaches in tex vs Mathjax.

One concrete example is that \coloneqq for a symbol like := is defined in a tex package which isn't available in Mathjax. So it's perfectly fine to leave in a tex macro file , but in Mathjax I usually have to use workarounds like this:
image

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