|
wxMaxima
|
Turns maths written in LaTeX or in MathML into a Maxima command (GH #932, GH #760). More...
#include <wx/string.h>Go to the source code of this file.
Data Structures | |
| struct | wxm::MathImportResult |
| The outcome of converting a formula to a Maxima command. More... | |
Functions | |
| MathImportResult | wxm::LaTeXToMaxima (const wxString &latex) |
| Converts LaTeX maths, with or without $...$, (...) or [...] around it. | |
| MathImportResult | wxm::MathMLToMaxima (const wxString &mathml) |
| Converts a MathML <math> element (presentation markup, or an annotation) | |
| bool | wxm::LooksLikeMathML (const wxString &text) |
| True if the text is a MathML document rather than anything else. | |
| MathImportResult | wxm::MathToMaxima (const wxString &text) |
| Converts either: MathML if LooksLikeMathML(), LaTeX otherwise. | |
Turns maths written in LaTeX or in MathML into a Maxima command (GH #932, GH #760).
Neither LaTeX nor presentation MathML says what a formula means, only how it looks: a fraction bar, a raised exponent, a d in front of an x. So the conversion happens in two stages, and both input languages share the second one:
The guesses are conservative: anything that has no unambiguous reading (a plus-minus sign, an accent, text) fails with a message saying what it was, instead of producing a command that silently means something else. The result is shown to the user in a code cell before anything is evaluated anyway.
MathML that carries an <annotation encoding="application/x-maxima"> (wxMaxima's own "Copy as MathML" adds one) needs no guessing at all: that annotation is the command, and is used as it is.
Everything here is GUI-free and needs no Maxima, so it is unit-tested directly (test_MathImport).