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

Inline Asciimath #83

Open
saivan opened this issue Dec 19, 2017 · 2 comments
Open

Inline Asciimath #83

saivan opened this issue Dec 19, 2017 · 2 comments

Comments

@saivan
Copy link

saivan commented Dec 19, 2017

Mathjax-node has support for asciimath, but it seems that asciimath isn't able to be used to produce inline equations, you can read about the issue here, they asked to raise the issue upstream, so I am asking:

Is there a mechanism to support an inline display mode with asciimath?

@drlippman
Copy link
Contributor

There has never been in AsciiMath a per-equation way to enable/disable displaystyle.

As noted in that thread, AsciiMathML has a configuration option for whether the whole page should be rendered using displaystyle or not, and MathJax does expose that variable so it can be set via the MathJax config object. Right now the variable is only read once on Init. Perhaps what's needed is some externally exposed function in the AsciiMath jax to change the value of displaystyle, so your code could adjust the setting before asking for the expression to be rendered.

Or, in the Translate function in the AsciiMath input jax, it could look for a mode=____ in the script type, like the TeX input jax does on line 2232, then temporary set ASCIIMATH.config.displaystyle based on that. Then in MathJax-node you could add a new "TYPES" that would add that mode into the script, like it does for display TeX. For backwards compatibility, it'd be best to keep display mode the default.

Those changes would be MathJax and MathJax-Node changes, though. If there's something you think needs to happen in AM itself, let me know.

@drlippman
Copy link
Contributor

Just to flush out my thoughts above (totally untested, of course):

In MathJax-node you'd add a new TYPES like "inline-AsciiMath": "asciimath; mode=inline"

Then in the MathJax AM input jax, you'd add a line a like:
var forceinline = (script.type.replace(/\n/g," ").match(/(;|\s|\n)mode\s*=\s*inline(;|\s|\n|$)/) != null);

then before the parseMath call,
if (forceinline) { olddisplaystyle = ASCIIMATH.config.displaystyle; ASCIIMATH.config.displaystyle = false;}

and after the parseMath call,
if (forceinline) {ASCIIMATH.config.displaystyle = olddisplaystyle;}

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