import { Component , Input , OnInit } from '@angular/core' ; import { KatexOptions } from 'ng-katex' ; @ Component ( { selector : 'app-math' , template : `<ng-katex [equation]="mathExprNorm" [options]="options"></ng-katex>` } ) export class MathComponent implements OnInit { /**
     * Latex expression received from the backend.
     */ @ Input ( ) mathExpr : string ; /**
     * Normalised latex expression without the delimiting dollar signs
     */ mathExprNorm : string ; constructor ( ) { } options : KatexOptions = { displayMode : true , } ; ngOnInit ( ) { this . mathExprNorm = this . mathExpr . replace ( /\$/g , '' ) ; } }