@HassanAkbar , I am concerned that if we remove the bold and italics in equations during translation, the maintainers of the standard will not be able to put them back in if they want to.
It is also the case that some current equations will work when translated to AsciiMath and MathML, and some will not; I think we would be adding value to ISO-10303 if we track them.
It also needs to be said that Metanorma follows the MathML default of italics for variables, and additional settings will be needed to default to plain instead of italics for variables, as seems to be implied in the current formulas. This is feasible as a setting, but it will not happen out of the box.
I propose the following course of action, @HassanAkbar ; @ronaldtse has already approved it (at least in principle):
Log all equations encountered containing boldface and italics, during translation of Express to Asciidoc, in a file that maintainers can access, with the following content:
The raw Express formula, with boldface and italics tags
The document it is in
The nearest Express anchor, so we can find the equation in the converted text
The Asciimath conversion of the Express formula, including bold and italics
(Possibly) The Asciimath conversion of the Express formula, without bold and italics, which is what is actually going into the Asciidoc
The status of whether that Asciimath formula including bold and italics is valid according to Plurimath: if it is not, that indicates that it needs to be fixed.
def math_validate(expr)
Plurimath::Math.parse(expr, "asciimath").to_mathml
rescue StandardError => e
math_validate_error(math, m, e)
end
So we take the asciimath, parse it into Plurimath's internal representation, and then generate MathML (as Metanorma eventually will). If something blows up in either stage, we want to know about it, because it points to a problem in the formula.
@HassanAkbar , I am concerned that if we remove the bold and italics in equations during translation, the maintainers of the standard will not be able to put them back in if they want to.
It is also the case that some current equations will work when translated to AsciiMath and MathML, and some will not; I think we would be adding value to ISO-10303 if we track them.
It also needs to be said that Metanorma follows the MathML default of italics for variables, and additional settings will be needed to default to plain instead of italics for variables, as seems to be implied in the current formulas. This is feasible as a setting, but it will not happen out of the box.
I propose the following course of action, @HassanAkbar ; @ronaldtse has already approved it (at least in principle):
To do that validation, you will do what I am already doing in https://github.com/metanorma/metanorma-standoc/blob/f25f7d10f2c42c0772207a9104e02aa90a17648c/lib/metanorma/standoc/validate.rb#L34 ; I've changed the code to match what you will be doing.
So we take the asciimath, parse it into Plurimath's internal representation, and then generate MathML (as Metanorma eventually will). If something blows up in either stage, we want to know about it, because it points to a problem in the formula.
Originally posted by @opoudjis in https://github.com/metanorma/stepmod-utils/issues/191#issuecomment-1817464353