On 06/11/2022 10:05, Ihor Radchenko wrote:
Max Nikulin writes:

This is a reminder of an old bug. From my point of view it is serious
enough, but not release critical due to its age.

&<> characters must be escaped as HTML entities when LaTeX snippets and
blocks are exported for MathJax

Form my year-old notes:
- =#+options: tex:verbatim= properly escapes symbols.
- There are functions that performs such replacement in ox-html and
ox-odt, but `org-format-latex` resides in org.el, so some refactoring
and backward compatibility stubs are necessary.

 From my understanding, all we need is to fix `org-format-latex' by
calling `org-html-encode-plain-text'.

Could you please elaborate about refactoring and backward compatibility?

From my point of view, functions from org.el should not call functions from ox-html.el and ox-odt.el directly. So a function to escape &<> and its variant with quote character for attributes should reside either in org.el or in org-macs.el.

As a result, `org-odt--encode-plain-text' should be obsoleted. `org-html-encode-plain-text' should call the new function.

Of course, it should be covered by unit tests.

When implemented, the following footnote should be removed from doc/org-manual.org:

[fn:47] Please note that exported formulas are part of an HTML
document, and that signs such as =<=, =>=, or =&= have special
meanings.  See 
[[https://docs.mathjax.org/en/latest/input/tex/html.html#tex-and-latex-in-html-documents][MathJax
 TeX and LaTeX in HTML documents]].

I have not tested if the following is still an issue for ODT export. There are comments before `org-odt-latex-environment' and `org-odt-latex-fragment'. All math export options should be tried. Perhaps some unit tests exist already.

Myles English. bug in odt export via mathml of equations containing '&'. Fri, 04 Nov 2011 23:19:33 +0000
<https://list.orgmode.org/orgmode/87fwi3wk56....@gmail.com/>

As further improvements in the case of <img> export, adding original TeX markup as *properly escaped* "alt" attribute may be considered. Perhaps MathML converter allows something similar and options to achieve it should be documented.

Confirmed.

Reply via email to