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

Convert MathSpan to MathML using e.g. camoy/amath or gjtorikian/mtex2MML #15

Open
aslakr opened this issue Mar 19, 2016 · 1 comment
Open

Comments

@aslakr
Copy link

aslakr commented Mar 19, 2016

For html (and odf and epub) it would be nice to be able to produce MathML as mentioned in fletcher/peg-multimarkdown#39

I.e. as an option, instead of wrapping TeX math for MathJax in

MultiMarkdown-5/src/html.c

Lines 334 to 352 in f2a0b9c

case MATHSPAN:
temp = strdup(n->str);
if (temp[0] == '$') {
temp[strlen(temp)-1] = '\0';
if (temp[1] == '$') {
temp[strlen(temp)-1] = '\0';
g_string_append_printf(out, "<span class=\"math\">\\[%s\\]</span>",&temp[2]);
} else {
g_string_append_printf(out, "<span class=\"math\">\\(%s\\)</span>",&temp[1]);
}
} else if (temp[strlen(temp) - 1] == ']') {
temp[strlen(temp) - 3] = '\0';
g_string_append_printf(out, "<span class=\"math\">%s\\]</span>",temp);
} else {
temp[strlen(temp) - 3] = '\0';
g_string_append_printf(out, "<span class=\"math\">%s\\)</span>",temp);
}
free(temp);
break;
convert this to MathML.

In the original issue blahtex is mentioned, but doesn’t seem very active.

One very simple alternative might be to use amath, a peg-based AsciiMath to MathML converter. It’s only AsciiMath, so it might not be a good alternative for text that are based on TeX-like syntax, but the amath c/peg-code seem rather readable.

mtex2MML, which is a active fork of itex2MML, might be another alternative. It tries to be compatible with MathJax.

@fletcher
Copy link
Owner

I'm open to including a TeX -> MathML converter if there is something reasonable to use. I'll take a look at the suggestions you made, but I have some other priorities that I need to finish up first (e.g. getting Composer v3 finished up. ;)

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