@@ -25,7 +25,7 @@ import {PropertyList} from '../../Tree/Node.js';
2525import { AbstractMmlTokenNode , MmlNode , AttributeList , TEXCLASS } from '../MmlNode.js' ;
2626import { MmlMrow } from './mrow.js' ;
2727import { MmlMover , MmlMunder , MmlMunderover } from './munderover.js' ;
28- import { OperatorList , OPTABLE , RangeDef , RANGES } from '../OperatorDictionary.js' ;
28+ import { OperatorList , OPTABLE , RangeDef , RANGES , MMLSPACING } from '../OperatorDictionary.js' ;
2929
3030/*****************************************************************/
3131/*
@@ -60,9 +60,10 @@ export class MmlMo extends AbstractMmlTokenNode {
6060 } ;
6161
6262 /*
63- * Unicode ranges and their default TeX classes
63+ * Unicode ranges and their default TeX classes and MathML spacing
6464 */
65- public static RANGES : RangeDef [ ] = RANGES ;
65+ public static RANGES = RANGES ;
66+ public static MMLSPACING = MMLSPACING ;
6667
6768 /*
6869 * The Operator Dictionary.
@@ -164,8 +165,7 @@ export class MmlMo extends AbstractMmlTokenNode {
164165 * @override
165166 */
166167 public hasSpacingAttributes ( ) {
167- return ! ! this . attributes . getExplicit ( 'form' ) ||
168- this . attributes . isSet ( 'lspace' ) ||
168+ return this . attributes . isSet ( 'lspace' ) ||
169169 this . attributes . isSet ( 'rspace' ) ;
170170 }
171171
@@ -177,10 +177,6 @@ export class MmlMo extends AbstractMmlTokenNode {
177177 public setTeXclass ( prev : MmlNode ) : MmlNode {
178178 let { form, lspace, rspace, fence} = this . attributes . getList ( 'form' , 'lspace' , 'rspace' , 'fence' ) as
179179 { form : string , lspace : string , rspace : string , fence : string } ;
180- if ( this . hasSpacingAttributes ( ) ) {
181- this . texClass = TEXCLASS . NONE ;
182- return this ;
183- }
184180 if ( fence && this . texClass === TEXCLASS . REL ) {
185181 if ( form === 'prefix' ) {
186182 this . texClass = TEXCLASS . OPEN ;
@@ -276,8 +272,9 @@ export class MmlMo extends AbstractMmlTokenNode {
276272 let range = this . getRange ( mo ) ;
277273 if ( range ) {
278274 this . texClass = range [ 2 ] ;
279- this . lspace = ( def [ 0 ] + 1 ) / 18 ;
280- this . rspace = ( def [ 1 ] + 1 ) / 18 ;
275+ const spacing = ( this . constructor as typeof MmlMo ) . MMLSPACING [ range [ 2 ] ] ;
276+ this . lspace = ( spacing [ 0 ] + 1 ) / 18 ;
277+ this . rspace = ( spacing [ 1 ] + 1 ) / 18 ;
281278 }
282279 }
283280 }
0 commit comments