MathJaxSwift icon indicating copy to clipboard operation
MathJaxSwift copied to clipboard

ConversionOptions not respected when converting to SVG

Open nhojb opened this issue 1 year ago • 0 comments

I'm using MathJaxSwift to convert LaTex to SVG and then render in a macOS app.

I have one problem where the display property of ConversionOptions does not appear to be respected for inline equations. This is the output I get when setting display to false. It's the same if I don't set display or set to true:

Screenshot 2024-06-28 at 10 51 24

I'd expect inline rendering more like this (from mathjax.org):

Screenshot 2024-06-28 at 10 52 05

I've double-checked the SVG output is rendering correctly, so it seems like the tex2svg() function is not respecting the ConversionOptions for some reason.

Notes: I'm initializing MathJax like this:

  mathJax = try MathJax(preferredOutputFormat: .svg)

And calling tex2svg like this:

  let svg = try mathJax.tex2svg(tex, conversionOptions: ConversionOptions(display: false))

The input I'm using in the above examples is below. My app parses the equations and removes the $ delimiters before passing to tex2svg().

The power rule states that the integral of $x^n$ is $\frac{1}{n+1}x^{n+1} + C$, where $n$ is any real number (except -1).

nhojb avatar Jun 28 '24 10:06 nhojb