@@ -173,7 +173,19 @@ export class CHTMLmsubsup extends CHTMLscriptbase {
173173 const t = 3 * tex . rule_thickness ;
174174 const subscriptshift = this . length2em ( this . node . attributes . get ( 'subscriptshift' ) , tex . sub2 ) ;
175175 const drop = ( this . isCharBase ( ) ? 0 : basebox . d + tex . sub_drop * subbox . rscale ) ;
176+ //
177+ // u and v are the veritcal shifts of the scripts, initially set to minimum values and then adjusted
178+ //
176179 let [ u , v ] = [ this . getU ( basebox , supbox ) , Math . max ( drop , subscriptshift ) ] ;
180+ //
181+ // q is the space currently between the super- and subscripts.
182+ // If it is less than 3 rule thicknesses,
183+ // increase the subscript offset to make the space 3 rule thicknesses
184+ // If the bottom of the superscript is below 4/5 of the x-height
185+ // raise both the super- and subscripts by the difference
186+ // (make the bottom of the superscript be at 4/5 the x-height, and the
187+ // subscript 3 rule thickness below that).
188+ //
177189 let q = ( u - supbox . d * supbox . rscale ) - ( subbox . h * subbox . rscale - v ) ;
178190 if ( q < t ) {
179191 v += t - q ;
@@ -183,6 +195,10 @@ export class CHTMLmsubsup extends CHTMLscriptbase {
183195 v -= p ;
184196 }
185197 }
198+ //
199+ // Make sure the shifts are at least the minimum amounts and
200+ // return the shifts and the space between the scripts
201+ //
186202 u = Math . max ( this . length2em ( this . node . attributes . get ( 'superscriptshift' ) , u ) , u ) ;
187203 v = Math . max ( this . length2em ( this . node . attributes . get ( 'subscriptshift' ) , v ) , v ) ;
188204 q = ( u - supbox . d * supbox . rscale ) - ( subbox . h * subbox . rscale - v ) ;
0 commit comments