@@ -209,10 +209,11 @@ export interface CommonMtable<
209209 /**
210210 * Do linebreaking on the cells of a column
211211 *
212- * @param {number } i The number of the column to break
213- * @param {number } W The width to break to
212+ * @param {number } i The number of the column to break
213+ * @param {number } W The width to break to
214+ * @param {string } type The column width type (fit, auto, dimen, percentage)
214215 */
215- breakColumn ( i : number , W : number ) : void ;
216+ breakColumn ( i : number , W : number , type : string ) : void ;
216217
217218 /**
218219 * Determine the row heights and depths, the column widths,
@@ -637,10 +638,11 @@ export function CommonMtableMixin<
637638 * @override
638639 */
639640 public stretchColumns ( ) {
641+ const swidths = this . getColumnAttributes ( 'columnwidth' , 0 ) ;
640642 for ( let i = 0 ; i < this . numCols ; i ++ ) {
641643 const width = ( typeof this . cWidths [ i ] === 'number' ? this . cWidths [ i ] as number : null ) ;
642644 this . stretchColumn ( i , width ) ;
643- width !== null && this . breakColumn ( i , width ) ;
645+ width !== null && this . breakColumn ( i , width , swidths [ i ] ) ;
644646 }
645647 }
646648
@@ -698,7 +700,7 @@ export function CommonMtableMixin<
698700 /**
699701 * @override
700702 */
701- public breakColumn ( i : number , W : number ) {
703+ public breakColumn ( i : number , W : number , type : string ) {
702704 if ( this . jax . math . root . attributes . get ( 'overflow' ) !== 'linebreak' || ! this . jax . math . display ) return ;
703705 const { D} = this . getTableData ( ) ;
704706 let j = 0 ;
@@ -718,7 +720,7 @@ export function CommonMtableMixin<
718720 //
719721 // Make sure cWidth reflects the size of the broken columns
720722 //
721- if ( w > ( this . cWidths [ i ] as number ) ) {
723+ if ( type === 'fit' || type === 'auto' || isPercent ( type ) || w > ( this . cWidths [ i ] as number ) ) {
722724 this . cWidths [ i ] = w ;
723725 }
724726 }
0 commit comments