mathjax / MathJax

Beautiful and accessible math in all browsers
http://www.mathjax.org/
Apache License 2.0
10.23k stars 1.16k forks source link

Copy to clipboard suggestion #2324

Open philippetrov opened 4 years ago

philippetrov commented 4 years ago

Right now when I use "Copy to clipboard" for MathML or Tex code, it also copy the formatting of the text in the box in addition to the text itself. So when I directly paste it in Word for example, it will not parse to Mathtype formula but instead it will paste it as formatted text (it even includes a left blockquote bar):

https://i.ibb.co/d5Jtdx3/1.png

Therefore to paste formula in Word I have to use "Paste special > Unformatted text" instead of the regular paste.

I think it will be much better if "Copy to clipboard" in MathJax will do it as Plain Text instead.

dpvc commented 4 years ago

Access to the clipboard from javascript is surprisingly difficult, and varies from browser to browser. There are some standards for how to do it, but not all browsers implement them, and few give control over the format of the data stored in the clipboard. MathJax uses a mechanism that works across browsers, and the effect is the same as if you copied the text from a textarea element. I would expect that that would be treated as plain text, but that may vary from browser to browser as well (I have not done exhaustive testing of that). In any case, MathJax doesn't get to say how it is interpreted.

We can investigate other techniques, as they become more commonly available, but we may not be able to force the clipboard to store the math as plain text.