import { Style } from '../public/core' ; import { Atom , ToLatexOptions } from '../core/atom-class' ; import { Box } from '../core/box' ; import { Context } from '../core/context' ; import { charToLatex } from '../core-definitions/definitions-utils' ; export class TextAtom extends Atom { constructor ( command , value , style ) { super ( 'text' , { command , mode : 'text' , displayContainsHighlight : true } ) ; this . value = value ; this . verbatimLatex = value ; this . applyStyle ( style ) ; } render ( context ) { const result = this . createBox ( context ) ; if ( this . caret ) result . caret = this . caret ; return result ; } serialize ( _options ) { return this . verbatimLatex ?? charToLatex ( 'text' , this . value . codePointAt ( 0 ) ) ; } }