# Display mathematical expression in label

I’m using images to display Mathematical expressions.
Is it possible for a string to be converted into proper mathematical expression and then added to label?

for example convert this quadratic formula : [-b ± √(b² - 4ac)]/2a

@property(cc.Label)
label: cc.Label = null;

@property
text: string = '[-b ± √(b² - 4ac)]/2a';

start() {
this.label.string = this.text;
}


should be displayed as

I’m using cocos creator version v2.3.

I can ask engineering. I dont seem to recall anything we had built in to handle this.

Okay.
And if there is an alternative way of doing it with other plugin please do tell.

We dont built in to handle this, you can use mathjax as plugin to do this. Here is link :MathJax · GitHub

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.