updated starmath writer #289
Conversation
|
all tests seem to be passing now -- some changes required to overcome an issue with API changes in the typst-symbols package, which was blocking the build for this PR. I patched for that, but if you have a better/different solution for that issue, please use that instead. |
|
You should be able to simply merge/rebase the commit to texmath that handles the typst-symbols changes. |
Do these work currently in LibreOffice with pandoc's current MathML output? |
|
@jgm i think the rebase is done now... hopefully the build is clean... |
|
As for the linux/stack build failure...be sure to include .github/workflows/ci.yml in your rebase; I have removed the stack build from master... |
| mapStyledUnicode :: (Char -> Maybe Char) -> T.Text -> Maybe T.Text | ||
| mapStyledUnicode f t = T.pack <$> mapM f (T.unpack t) | ||
|
|
||
| scriptChar :: Char -> Maybe Char |
There was a problem hiding this comment.
Instead of hard-coding these tables scriptChar etc., can't you just use toUnicodeChar from Text.TeXMath.Unicode.ToUnicode ?
There was a problem hiding this comment.
thanks for this -- i'll have a look.
| run: | | ||
| cabal v2-update | ||
| cabal v2-build --dependencies-only --enable-tests --disable-optimization -fexecutable all | ||
| cabal v2-build --dependencies-only --enable-tests --disable-optimization -fexecutable -f-server all |
There was a problem hiding this comment.
sorry, i think this was an artifact of the rebasing. wasn't intentional. i'll sort it out.
There was a problem hiding this comment.
ok i think this is correct now? the "-f-server" command is there and being run in GHA.
|
a note -- to get better visual agreement of inline vs display equations, i added some new logic, and new visual review code also. i'll circle back next to you review comments. |
… etc., can't you just use toUnicodeChar from Text.TeXMath.Unicode.ToUnicode ?"
|
I think a tex writer error was found in the test suite here, I logged it as #290 rather than seeking to patch here. |
|
OK i think we're good to go now. Here's the visual test document, in case you want to review it: starmath-review.pdf |
|
Thanks for providing the review document. But it seems to me that the review we really need would compare: (a) LibreOffice using the starmath generated by this library with (b) LibreOffice using the mathml generated by this library [as in current pandoc]. If this comparison is favorable to starmath, it would be reason to switch. |
|
Hi -- I think the code produced by this new writer is clearly better than the earlier code, because it renders as idiomatic starmath. When using the mathml syntax, the conversion to starmath occurs within LO, only on the occasion of opening and attempting to edit the equation. at this point, the poor-quality LO converter generates unreadable and unmaintable starmath code. this was the motivation for the new writer in fact, more than the visual equivalence of the latex and the mathml. I think that's important to note. however, you're right, we should run a visual check also against the previous conversion pathway. i'll have a go. |
|
Ok so i found errors in the following from the MathML pathway. The converter produces equations that LO cannot render without errors (upside down red question marks). The produced report is here: differentiable_manifold other points of difference:
I'll commit the revised code so that you can reproduce this document yourself if desired. |
|
the script also produces .odt output, see attached. here are some comparisons of what the resulting starmath code looks like for the end user: (first is starmath, second is via mathml): boxedwe force a deliberate render error above, because \boxed has no equivalent in starmath subsup(mathml version has render errors) 002_common_accents(again, rendering errors, and non-idiomatic starmath) So Texmath is generating MathML that is at worst wrong or at best not compatible with the LO mathml-to-starmath converter, and hence not really useful. Some of this issue can be addressed with bug-fixes in LO -- I'll take that up separately at some point, hopefully! |
|
(stray keystroke caused closing the issue -- I immediately re-opened, sorry) |







a new PR based on the jdpipe-master plus changes to address comments from #285
to generate the visual comparison doc/pdf files (eg starmath-review.pdf) use the following:
./tools/make-starmath-review.py --output-dir /tmp/starmath-review && xdg-open /tmp/starmath-review/starmath-review.odtthis change uses the 'native' representation as the base for tests, and includes all tex-to-native tests from the existing test suite in addition to the new ones earlier provided just for starmath.
there are a number of limitations in starmath exposed. the main issue is around \mathcal and \mathbb and \mathfrak which don't exist 'easily' in LO. my solution was to request the user to select 'Latin Modern Math' as their custom 'serif' font in LO Math, and then provide these chars as unicode in the equation. converted equations include a comment telling users to do that.