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

Can it work with AsciiMath? #35

Closed
iacchus opened this issue Aug 4, 2022 · 7 comments
Closed

Can it work with AsciiMath? #35

iacchus opened this issue Aug 4, 2022 · 7 comments
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@iacchus
Copy link

iacchus commented Aug 4, 2022

Sources:

https://docs.mathjax.org/en/latest/input/asciimath.html

http://asciimath.org/

@the-turk
Copy link
Owner

the-turk commented Aug 4, 2022

No, KaTeX does not support AsciiMath input but we can use this library which converts AsciiMath to TeX.

@the-turk the-turk added enhancement New feature or request good first issue Good for newcomers labels Aug 4, 2022
@the-turk the-turk self-assigned this Aug 4, 2022
@the-turk the-turk added this to the 1.0.6 milestone Aug 4, 2022
the-turk pushed a commit that referenced this issue Aug 4, 2022
@the-turk
Copy link
Owner

the-turk commented Aug 4, 2022

Done! You can now allow this syntax from the extension's settings.

Don't forget to clear your cache (php flarum cache:clear) after changing its state.

@the-turk the-turk closed this as completed Aug 4, 2022
@iacchus
Copy link
Author

iacchus commented Aug 4, 2022

Awesome! :) Thank you very much.

@iacchus
Copy link
Author

iacchus commented Aug 5, 2022

Bug reports for it are ok?

I've seen that AsciiMath and KaTeX don't work together, or one works, or the other one.

@the-turk
Copy link
Owner

the-turk commented Aug 5, 2022

Bug reports for it are ok?

of course!

I've seen that AsciiMath and KaTeX don't work together, or one works, or the other one.

can you provide a formula for me to take a look at it?


Oh I see what you mean now, you can't do proper TeX when you have AsciiMath enabled - but this is expected. Perhaps we need some custom delimiters to parse AsciiMath-only? I see the official delimiter for this syntax is backtick but we can't use that for obvious reasons.

I think I'll add a new setting for AsciiMath delimiters so you can set this to anything you want and I'll add a new checkbox right under the text editor buttons - labaled as "AsciiMath only". So when you click it, it'll switch the TeX delimiters into AsciiMath delimiters.

TLDR; there will be standalone delimiters for AsciiMath, and a new checkbox under the text editor buttons labeled as "AsciiMode-only".

@the-turk the-turk reopened this Aug 5, 2022
@the-turk the-turk removed this from the 1.0.6 milestone Aug 5, 2022
@the-turk
Copy link
Owner

the-turk commented Aug 5, 2022

check out 1.0.7 - and again, don't forget to clear your cache 😉

See it in action here: https://i.imgur.com/PEG1psE.mp4

...equations that I've used in that video:

AsciiMath:
sum_(i=1)^n i^3=((n(n+1))/2)^2

LaTeX:
\sum_{i=1}^{n} i^3=\left(\frac{n(n+1)}{2}\right)^2

@the-turk the-turk closed this as completed Aug 5, 2022
@iacchus
Copy link
Author

iacchus commented Aug 6, 2022

Awesome! it is very cool

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants