mathlive icon indicating copy to clipboard operation
mathlive copied to clipboard

Not able to implement bold and italic

Open mayank-garg-cp opened this issue 4 years ago • 2 comments

Hi Arnog,

I am facing issue in making fonts bold and italic .

this.editor.executeCommand(["switchMode","text"]) this.editor.executeCommand(["applyStyle",{"shape":"it"}]); this.editor.executeCommand(["applyStyle",{"series":"b"}]);

I also tried this <button class='keycap'data-command='["applyStyle",{"series":"bx"}]' onClick={(e)=>this.handleStyle(e)}>Bold

however color and size are working but other style properties are not working. Also is there any way to set bold property for every new typed character

mayank-garg-cp avatar Jun 01 '21 08:06 mayank-garg-cp

I need to look into this some more, but I believe the issue is that you’re trying to apply bold and italic math styles while in text mode. Perhaps not very intuitive but “math bold” and “math italic” are not just stylistic variation, they actually correspond to different Unicode characters (which is also why not all characters can have bold/ italic applied to them, e.g. the “=“ sign).

Are you really trying to apply this in text mode and not in math mode? Could you explain a bit more about what you are trying to do?

You should also be able to specify the initial / default style of the mathfield using the “style” option.

arnog avatar Jun 01 '21 10:06 arnog

I created buttons like Bold and italic Just like any other editor i want to make text bold and italic by selecting or in case of non selection sets the style to be applied to future input.

I tried with both math and text mode , but bold and italic are not working even in case of normal text like "ABC" . Its not about any specific sign.

Can you simply share the command for making the text bold and italic in any mode

mayank-garg-cp avatar Jun 01 '21 11:06 mayank-garg-cp

The command is applyStyle

arnog avatar Dec 08 '23 22:12 arnog