Edit asciimathml

22 views
Skip to first unread message

gro...@gmail.com

unread,
Jul 4, 2017, 11:38:43 AM7/4/17
to MathJax Users
Hello,
Thanks for your api which is a good tool.
I use the preview with ascii mode. Sqrt2 displays $ \ sqrt 2 $ but I would like sqrt (2) to display $ \sqrt 2 $. I can handle the string with a regexpression but how to make clean changes. How to take account of changes to the ASCIImathML.js script. It does not look present on mathjax gitub ?
Thank you for your help.

Peter Krautzberger

unread,
Jul 5, 2017, 1:18:58 PM7/5/17
to mathja...@googlegroups.com
Hi,

You might want to post a minimal live example that exhibits the problem.

Regards,
Peter.

--
You received this message because you are subscribed to the Google Groups "MathJax Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mathjax-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julien

unread,
Jul 7, 2017, 5:19:15 AM7/7/17
to MathJax Users
Hi,
I modified the createPreview function to do the job but it isn't clean. How to make changes properly?
Thank

CreatePreview: function () { Preview.timeout = null; if (this.mjPending) return; var text = document.getElementById("MathInput").value; var reg =/(sqrt)(\w)/; var test=reg.test(text); if(test){alert("Pense aux parenthèses !"); var text = text.replace(reg, "sqrt($2");document.getElementById("MathInput").value =text;} text = "`"+text+"`"; if (text === this.oldtext) return; if (this.mjRunning) { this.mjPending = true; MathJax.Hub.Queue(["CreatePreview",this]); } else { this.buffer.innerHTML = this.oldtext = text; this.mjRunning = true; MathJax.Hub.Queue( ["Typeset",MathJax.Hub,this.buffer], ["PreviewDone",this] ); } },

jahvascr...@gmail.com

unread,
Jul 20, 2017, 12:01:30 PM7/20/17
to MathJax Users
Bonjour Julien,

I do not see your problem when typesetting asciimath. "[[ \sqrt 2 ]]" is shown as "\sqrt 2" in gray for a short time (and is replaced by the rendered math), and "[[ sqrt(2) ]]" is shown as "sqrt(2)" in gray in the same way.

https://jsfiddle.net/yfj2k2sb/1/

Can you try to update this jsfiddle to show your problem?

Je ne vois pas ton problème, "[[ \sqrt 2 ]]" s'affiche comme "\sqrt 2" en gris pendant un temps très court (puis est remplacé par le rendu final), et "[[ sqrt(2) ]]" s'affiche comme "sqrt(2)" en gris de la même manière.

Est-ce que tu peux essayer de modifier le jsfiddle pour qu'on puisse voir ton problème?

Cheers,
Georges Dupéron
Reply all
Reply to author
Forward
0 new messages