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

Add support for mathml output, closes #110, #118 #117

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

infinity0
Copy link

Enable by setting mathematical-format = mathml, mathematical-inline = true

@infinity0
Copy link
Author

infinity0 commented Oct 28, 2022

The second commit is optional; I mentioned some details in #110. It would also be easy to tweak this PR to instead use plurimath over latexmath. That is, we have 3 options:

@infinity0 infinity0 changed the title Add support for latexmath, closes #110 Add support for mathml output, closes #110 Oct 28, 2022
@infinity0
Copy link
Author

One downside of docutil's latex2mathml is that "supports only a subset of LaTeX math syntax". For example, it doesn't support {align}. (To its credit, latexmath does appear to support this.)

After some experimentation, my impression is that pandoc(1) supports converting the most wide-ranging set of LaTeX math features to MathML. I've therefore added a 3rd commit to switch to using pandoc(1). So we have a total of 4 options to choose from; I've updated the above comment to reflect that.

@infinity0 infinity0 changed the title Add support for mathml output, closes #110 Add support for mathml output, closes #110, #118 Oct 28, 2022
@infinity0
Copy link
Author

MathML is due to be released and enabled by default in Chrome 109, so nudging again on this.

@infinity0
Copy link
Author

More info:

Note, MathML already works on Firefox and Opera.

@mateibarbu19
Copy link

Hello, I tried using your patch, but could not get it to work with AsciiDoctor PDF. Ended up with inline HTML in PDF.

<div class="stemblock"> <span class="math display">$$\lim_{n \to
\infty}\frac{n}{\sqrt[n]{n!}} = {\large e}$$</span> </div>

Could you please provide a example?

@infinity0
Copy link
Author

infinity0 commented Jun 29, 2023

I've not tested PDF. I'm just using asciidoctor -a stem -r asciidoctor-mathematical -a mathematical-format=mathml -a mathematical-inline=true.

Example source here: https://github.com/infinity0/mkwww/blob/master/example/src/test%20with%20spaces.adoc (raw)
Example output here: https://infinity0.github.io/mkwww/test%20with%20spaces.html

@infinity0
Copy link
Author

This PR is about MathML support. How do you expect MathML support to work inside a PDF, @mateibarbu19 ?

@mateibarbu19
Copy link

This PR is about MathML support. How do you expect MathML support to work inside a PDF, @mateibarbu19 ?

Hey, thanks for your helpful example! I was thinking that there may be a way of rendering it with an external call (e.g., to Chromium to then print it), and then including those graphics inside the PDF should be no problem.

I see now that my assumption was foolish, and I understand now how to use your fork for an HTML output.

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants