@@ -187,8 +187,6 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
187
187
CALIGN = state . CALIGN , RALIGN = state . RALIGN ,
188
188
RCALIGN = state . RCALIGN ;
189
189
CSPACE [ state . J ] *= 2 ; RSPACE [ ROWS . length - 1 ] *= 2 ; // since halved below
190
- var LH = CHTML . FONTDATA . lineH * values . useHeight ,
191
- LD = CHTML . FONTDATA . lineD * values . useHeight ;
192
190
var T = "0" , B , R , L , border , cbox , align ;
193
191
if ( values . fspace ) T = CHTML . Em ( state . FSPACE [ 1 ] ) ;
194
192
for ( var i = 0 , m = ROWS . length ; i < m ; i ++ ) {
@@ -245,11 +243,12 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
245
243
) ;
246
244
}
247
245
//
248
- // Pad cells that are too short
246
+ // Adjust height and depth of cells
249
247
//
250
248
cell = row [ j ] . firstChild . style ;
251
- if ( cbox . h < LH ) cell . marginTop = CHTML . Em ( LH - cbox . h ) ;
252
- if ( cbox . d < LD ) cell . marginBottom = CHTML . Em ( LD - cbox . d ) ;
249
+ var H = Math . max ( 1 , cbox . h ) ;
250
+ if ( H !== state . H [ i ] ) cell . marginTop = CHTML . Em ( state . H [ i ] - H ) ;
251
+ if ( cbox . d < state . D [ i ] ) cell . marginBottom = CHTML . Em ( state . D [ i ] - cbox . d ) ;
253
252
}
254
253
T = B ;
255
254
}
@@ -494,7 +493,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
494
493
if ( LABELS [ i ] && this . data [ i ] . data [ 0 ] ) {
495
494
labels . appendChild ( LABELS [ i ] ) ;
496
495
var lbox = this . data [ i ] . data [ 0 ] . CHTML ;
497
- T += h - lbox . h ;
496
+ T += h - Math . max ( 1 , lbox . h ) ;
498
497
if ( T ) LABELS [ i ] . style . marginTop = CHTML . Em ( T ) ;
499
498
T = d - lbox . d ;
500
499
} else {
@@ -563,6 +562,7 @@ MathJax.Hub.Register.StartupHook("CommonHTML Jax Ready",function () {
563
562
MML . mtd . Augment ( {
564
563
toCommonHTML : function ( node , options ) {
565
564
node = this . CHTMLdefaultNode ( node , options ) ;
565
+ CHTML . addElement ( node . firstChild , "mjx-strut" ) ; // forces height to 1em (we adjust later)
566
566
//
567
567
// Determine if this is stretchy or not
568
568
//
0 commit comments