MathEditor icon indicating copy to clipboard operation
MathEditor copied to clipboard

How do you get the raw Latex from the MTEditableMathLabel?

Open RobinXL opened this issue 7 years ago • 5 comments

How do you get the raw Latex from the MTEditableMathLabel if it is possible. I didnt find any label.text member

RobinXL avatar May 31 '17 01:05 RobinXL

You can access the text like this:

label.mathList.stringValue

erikchen93 avatar May 31 '17 18:05 erikchen93

@erikchen93 That is not correct. stringValue is not LaTeX. The correct LaTeX version is

[MTMathListBuilder mathListToString:label.mathList]

Also unofficially (private API): [label label].latex

kostub avatar May 31 '17 19:05 kostub

Marking as enhancement to add public API to get latex.

kostub avatar May 31 '17 19:05 kostub

Thanks for help! [MTMathListBuilder mathListToString:label.mathList] works perfectly :)

RobinXL avatar May 31 '17 21:05 RobinXL

I am testing this project using swift 3. Here is the code for getting LaTex form from the keyboard input: let a = MTMathListBuilder.mathList(toString: math_label.mathList) print(a) //output latex

I am also wondering how can I predefine the input string and use MTEditableMathLabel to display it?

something like this in IOSmath: let text = "some latex and normal texts" Math_label.latex = text

RobinXL avatar May 31 '17 21:05 RobinXL