This is an archive of the discontinued LLVM Phabricator instance.

Fix invalid math formulas in quantization doc
ClosedPublic

Authored by Lewuathe on Apr 25 2021, 5:35 AM.

Details

Summary

A single backslash is not properly escaped in the web documentation. We can make sure to escape for rendering subscripts.

Additionally, it also fixed the mal-formed equations in "Affine to fixed point" and "Fixed point to affine" sections. With this fix, the page is rendered as follows.

Diff Detail

Event Timeline

Lewuathe created this revision.Apr 25 2021, 5:35 AM
Lewuathe requested review of this revision.Apr 25 2021, 5:35 AM
Lewuathe edited the summary of this revision. (Show Details)Apr 25 2021, 5:39 AM
Lewuathe added a reviewer: mehdi_amini.
Lewuathe edited the summary of this revision. (Show Details)

This makes it quite heavy to write, it there something we could change on the website generator side to avoid changing it here?

Lewuathe added a comment.EditedApr 25 2021, 11:44 PM

@mehdi_amini We may be able to avoid rewriting the double dollar mark ($$) by changing the inlineMath config in mlir-www. But I think that contradicts the convention of LaTex in general.

For escaping the backslash, we may be able to use processEscapes config for MathJax. That can reduce the amount of change.

Formatting issue (e.g. L.152-156) can only be resolved by putting begin/end{align*} as far as I know.

For escaping the backslash, we may be able to use processEscapes config for MathJax. That can reduce the amount of change.

Yeah that's the one I was mostly thinking of with my previous comment, wanna send a PR for the MathJax config?

mehdi_amini accepted this revision.Apr 30 2021, 1:15 PM

(otherwise LGTM)

This revision is now accepted and ready to land.Apr 30 2021, 1:15 PM

I tried to use processEscapes option of MathJax. But it did not work as expected. It only handles the literal dollar sign and has no impact to escape the underscore in the math equation, unfortunately.
Looking into the whole configuration, there seems to be no other options we may be able to use for this case.

https://docs.mathjax.org/en/v2.7-latest/options/preprocessors/tex2jax.html

Alright, thanks for trying, feel free to land it as-is then!

Lewuathe added a comment.EditedMay 30 2021, 10:36 PM

@mehdi_amini Thank you for reviewing! I do not have a right to merge this change into the repository. Could you do that on behalf of me?

This revision was automatically updated to reflect the committed changes.