Closed mcp292 closed 3 years ago
The AsciiMath gem can now produce LaTeX output. That means this extension could use the API provided by that gem to convert the expression to LaTeX, then pass that result to mathematical to get an image out of it.
Aha! I see this has already been done (by PR #85).
However, it's not quite right. The extension is not honoring the value of the stem
attribute. If the stem
attribute is set on the document, then the stem block or inline macro should be processed as AsciiMath. This is not currently happening.
Here's an example:
:stem:
stem:[sqrt(2)]
This logic is incorrect:
case document.attr 'stem'
when 'latexmath'
support_stem_prefix = true
stem_rx = LatexmathInlineMacroRx
when 'asciimath'
support_stem_prefix = true
stem_rx = AsciiMathInlineMacroRx
else
support_stem_prefix = false
stem_rx = StemInlineMacroRx
end
Setting the stem
attribute to an empty value is the same as setting it to asciimath
. When the stem
attribute is set, the stem inline macro should always be processed. Whether it should be processed as AsciiMath or LaTex depends on the value of the stem
attribute. It should only be processed as LaTeX if the value of the stem
attribute is latexmath
.
It's possible to workaround this problem by using the asciimath inline macro in place of the stem inline macro. (e.g., asciimath:[sqrt(2)]
). However, I'd like to see this fixed so that the behavior is compliant with other converters.
The problem with the processing of the stem inline macro has been reported separately as #89. Therefore, I'm going to close this issue since we know now that AsciiMath is supported.
Currently there is no support for
asciimath
for PDF, onlylatexmath
.