Closed jeisner closed 3 years ago
If you right click on the rendered equation there should be an option to let you copy to clip board?
I agree that perhaps a "select -> ctrl+c" solution would be even better.
@jeisner I'm closing this for now since it seems like "right click -> copy" would work. Please feel free to reopen if you have any suggestions!
Hmm, when I right-click on a rendered post, I get a menu that has a single item, "Copy Ctrl+C", but ti s grayed out. So this solution isn't working for me.
[Update: It was grayed out because no text was selected.]
On Sun, Jun 6, 2021 at 8:25 PM Cambridge Yang @.***> wrote:
@jeisner https://github.com/jeisner I'm closing this for now since it seems like "right click -> copy" would work. Please feel free to reopen if you have any suggestions!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/thisiscam/math-with-slack/issues/22#issuecomment-855492137, or unsubscribe https://github.com/notifications/unsubscribe-auth/AASIYLIZT44FGB22YYUPWADTRQGXJANCNFSM42X6YWHQ .
@jeisner that is very curious. Which operating system are you on?
This is what I see on my Mac:
Oh, I see -- you have to right-click on the formula itself (as you'd said in an earlier post) and then you get a MathJax menu. I was clicking elsewhere on the post. (I'm on Linux, btw.)
That does work for me for getting the text for a single long formula. On the other hand, it doesn't help for copying a paragraph that is mostly text but keeps mentioning $x$ and $y$ and $y^2$.
Perhaps you'd be willing to leave this open, tagged as a feature request for the "select -> Ctrl+C" solution, if you think that request might be technically feasible?
@jeisner I understand your request now.
TBH, this seems more like something Slack should fix. Currently right click a message on slack does give one a "copy" option, but that option does nothing! This is bad UX IMO.
If Slack will ever fix this problem, the raw formulas would have been copied automatically with the message too!
On the other hand, it appears that selecting spans of text that contains an MathJax equation is currently not possible: https://github.com/mathjax/MathJax/issues/2240
@jeisner I pushed a small update according to suggestions by the MathJax developers: https://groups.google.com/g/mathjax-users/c/1BzTQFINbqY/m/xGYAlhDNAwAJ.
If you try this new update copying text should "sort of work". It's far from perfect but I'd still like to share my progress now since I'm not sure when this issue will be entirely resolved.
With this update, if you select a paragraph that contains MathJax formulas, and do a copy, it will copy the original un-rendered text to your clipboard. Unfortunately there are a few caveats:
$ \$10 $
is not well supported at the moment Oh that's brilliant. Great find, and thanks so much for implementing it!
If the formula is at begin or end of a message, it won't be copied unless you copy a larger portion of the message
Hmm, since you (or MathJax) is doctoring the HTML anyway, could this perhaps be handled by inserting some unobtrusive character before/after a formula image that is initial/final in a message? Perhaps just U+200B Zero Width Space
? This would provide surrounding text that can be selected.
@jeisner
Perhaps just U+200B Zero Width Space? This would provide surrounding text that can be selected.
I just tried this but unfortunately it appears that zero width space is not selectable. My guess is that probably because it has zero width, it's impossible to click on the character to select it in the first place. However, the thin space character https://www.compart.com/en/unicode/U+2009 does work, though once copied out the spaces are preserved.
Unfortunately, I'm not a JS guru (perhaps not even close to a hobbyist), so I'm out of idea for this.
I do realize though, that on Mac I can triple click a message to select all of that message! So even for single formulas without context, this copies the TeX just fine.
probably because it has zero width, it's impossible to click on the character to select it in the first place
I was thinking that click-drag might be able to get past it.
the thin space character https://www.compart.com/en/unicode/U+2009 does work
Perhaps someone else will be able to figure this out then.
though once copied out the spaces are preserved.
Perhaps deletable via JS.
I do realize though, that on Mac I can triple click a message to select all of that message!
Good point! I tried this on Ubuntu and found that triple click selects a paragraph. To pick up adjacent paragraphs as well, I can triple click and drag, so I can indeed get the whole message. Not very discoverable but does work!
@jeisner I will close this issue in favor of #25, which summarizes the current TODOs.
Thanks for this awesome solution!
One issue that sometimes comes up: sometimes another user posts a formula and I want to reply with a slightly modified version, or even just quote what they said, including the formula.
Unfortunately, I can't get access to the tex that is underneath their image (unless I turn off math-with-slack!). If I was the one who posted the previous formula, then I can get at the tex by asking to edit my previous post and then canceling the edit -- but Slack won't let me ask to edit another user's post.
Any ideas about how to expose the underlying tex?
the $f(\epsilon)^2$ subexpression
.