Render MathML for tripledash and ..arrows cmds from texfified mhchem

* already these are as mhchem macros in mappings, tbd adapt

Bug: T340024
Change-Id: Ic604720c71de720b6959159cfd78d6b55fdf399d
This commit is contained in:
Stegmujo 2023-07-25 12:51:52 +00:00 committed by Moritz Schubotz (physikerwelt)
parent ead9760e1f
commit 3c196ba389
No known key found for this signature in database
GPG key ID: F803DB146DDF36C3
4 changed files with 20 additions and 2 deletions

View file

@ -755,7 +755,7 @@ class BaseMappings {
],
"tripledash" => [
'macro',
'\\vphantom{-}\\raise2mu{\\kern2mu\\tiny\\text{-}\\kern1mu\\text{-}\\kern1mu\\text{-}\\kern2mu}'
'\\vphantom{-}\\raise{2mu}\\\kern{2mu}\\tiny\\text{-}\\kern{1mu}\\text{-}\\kern{1mu}\\text{-}\\kern{2mu}}'
],
"xleftrightarrow" => [ 'xArrow', 0x2194, 6, 6 ],
"xrightleftharpoons" => [ 'xArrow', 0x21CC, 5, 7 ],

View file

@ -46,6 +46,9 @@ class BaseMethods {
$resFct = BaseMappings::getSpecialByKey( $input );
if ( $resFct == null ) {
$resFct = BaseMappings::getCancelByKey( $input );
if ( $resFct == null ) {
$resFct = BaseMappings::getMhChemByKey( $input );
}
}
}
}

View file

@ -42,6 +42,7 @@ use MediaWiki\Extension\Math\TexVC\Nodes\Fun2sq;
use MediaWiki\Extension\Math\TexVC\Nodes\Literal;
use MediaWiki\Extension\Math\TexVC\Nodes\TexArray;
use MediaWiki\Extension\Math\TexVC\Nodes\TexNode;
use MediaWiki\Extension\Math\TexVC\TexVC;
/**
* Parsing functions for specific recognized mappings.
@ -358,7 +359,8 @@ class BaseParsing {
// Prevent parsing in unmapped cases
return null;
}
if ( $name == "mskip" || $name == "mkern" ) {
// Added kern j4t
if ( $name == "mskip" || $name == "mkern" || "kern" ) {
$args = [ "width" => $em ];
} else {
return null;
@ -483,6 +485,15 @@ class BaseParsing {
$mo = new MMLmo();
return $mstyle->encapsulateRaw( $mspace->getEmpty() ) . $mo->encapsulateRaw( "⟺" ) .
$mstyle->encapsulateRaw( $mspace->getEmpty() );
case "tripledash":
print( "abc" );
$texvc = new TexVC();
$warnings = [];
$macro = "\\vphantom{-}\\raise{2mu}";
$checkRes = $texvc->check( $macro, [ "usemhchem" => true, "usemhchemtexified" => true ],
$warnings, true );
print( "res" );
}
// Removed all token based parsing, since macro resolution for the supported macros can be hardcoded in php

View file

@ -1215,6 +1215,10 @@
"\\ker": {
"latex_function_names": true
},
"\\kern": {
"fun_ar1": true,
"mhchemtexified_required": true
},
"\\koppa": {
"nullary_macro_in_mbox": true,
"teubner_required": true