iink SDK Web

Answered

How to get result as text when use math

i am using iink.js for web and i know that for ios there is function like "resultAsText" that for example for superscript will return string like "2^[3]"
So, is there the same solution for web?



Best Answer

Hi Vadim,


Thank you for contacting us.


I am not sure to understand te iOS method you are referring to. The math export formats are available here


If you are using iinkjs with Math content and Websocket mode, once the recognition result is ready, it is exported by the server, so you can retrieve by monitoring the 'exported' event.

(for further details, please refer to https://developer.myscript.com/docs/interactive-ink/1.4/web/iinkjs/editing/#monitoring-changes-in-the-model)


You can choose the export format by setting the mimeTypes of the math iink configuration.

Please, refer to the Math Websocket example, that you can test here

The corresponding source code is available here


In this example, the exported formats are configured as both LaTeX and JIIX (see line 118 of the source code)

I guess that the LaTeX format is the one that you would like to use.


In the page, the exported LaTeX result is then displayed with the katex renderer, but if you comment line 75 in order not to render the LaTeX, and uncomment line 76, you will display the "raw" LaTeX result.


So in your case, you would display something like 3^{2} for instance.


Best regards,


Gwenaëlle


1 Comment

Answer

Hi Vadim,


Thank you for contacting us.


I am not sure to understand te iOS method you are referring to. The math export formats are available here


If you are using iinkjs with Math content and Websocket mode, once the recognition result is ready, it is exported by the server, so you can retrieve by monitoring the 'exported' event.

(for further details, please refer to https://developer.myscript.com/docs/interactive-ink/1.4/web/iinkjs/editing/#monitoring-changes-in-the-model)


You can choose the export format by setting the mimeTypes of the math iink configuration.

Please, refer to the Math Websocket example, that you can test here

The corresponding source code is available here


In this example, the exported formats are configured as both LaTeX and JIIX (see line 118 of the source code)

I guess that the LaTeX format is the one that you would like to use.


In the page, the exported LaTeX result is then displayed with the katex renderer, but if you comment line 75 in order not to render the LaTeX, and uncomment line 76, you will display the "raw" LaTeX result.


So in your case, you would display something like 3^{2} for instance.


Best regards,


Gwenaëlle