unigg
unigg

Reputation: 464

How can Jsxgraph embed Katex instead of Mathjs

Jsxgraph uses Mathjs to render Math expressions for text object. What can I do to embed Katex in Jsxgraph?

Upvotes: 1

Views: 139

Answers (1)

Alfred Wassermann
Alfred Wassermann

Reputation: 2338

The use of KaTeX is suppported in the last few nightly builds and will be supported officially in the next release 1.2.4+. To enable it, the KaTeX library has to be included. Here is a small example:

JXG.Options.text.useKatex = true;

var board = JXG.JSXGraph.initBoard('jxgbox', {boundingbox: [-1, 10, 11, -2], axis: true});
var a = board.create('slider',[[-0.7,1.5],[5,1.5],[0,0.5,1]], {
            suffixlabel:'t_1=', 
            unitLabel: ' \\text{ ms}', 
            snapWidth:0.01}),

    func = board.create('functiongraph',[
            function(x){
            return a.Value() * x * x; 
        }], {strokeColor: "red"}),
    txt1 = board.create('text', [5, 1, function(){ 
        return 'a(t_1)= { 1 \\over ' + a.Value().toFixed(3) + '}';
    }], {fontSize: 15, fixed:true, strokeColor:'red', anchorY: 'top'});

Upvotes: 2

Related Questions