6
$\begingroup$

I am a big procrastinator when it comes to learning MathJax. I happened to remember that only before asking a question. Is there perhaps a shortcut to simply copy an equation from one part of the site and then edit according to our own question (hope this doesn't count as plagiarism for not doing the MathJax part), much like in desmos where you copy a part of an equation and then insert it somewhere else on the site.

Or maybe this feature might cause a headache, but is there a any better technique

$\endgroup$
6
  • 15
    $\begingroup$ Right-clicking on a MathJax formula (using the desktop site) brings up a menu of Math Formatting options, the top one being "Show Math As..." The "TeX Commands" subitem allows you to select the $\LaTeX$ commands that gave rise to the displayed mathematics, and you can copy and paste it between dollar signs to reproduce that formula. Try this formula: $e^{i\pi} = -1$. To avoid plagiarism, you can provide a link to that older post for context. $\endgroup$
    – hardmath
    Commented Feb 28, 2021 at 6:44
  • $\begingroup$ @hardmath oh thanks for letting me know about th dollar sign $\endgroup$ Commented Feb 28, 2021 at 6:54
  • 10
    $\begingroup$ Whenever I want to copy/paste a MathJax snippet from a question or an answer on our site I follow the procedure of 1) click the "Edit"-button under the post, 2) copy the formula from the source to the clipboard, 3) close the edit window without saving, 4) go and paste the snippet wherever it is needed. Hardmath's method is the only option when you want to copy from a comment. Somehow it feels unnatural to me, but that may say more about me rather than what is the best workflow. $\endgroup$ Commented Feb 28, 2021 at 7:02
  • 8
    $\begingroup$ You should probably explain where do you want to copy equation from. For example, it won't be easy to get the formula from a pdf file, if you had something like that in mind. If you meant copying something from another post on this site, this was explained in previous comments and you can also check this older post on meta: How to view LaTeX source of equations? $\endgroup$ Commented Feb 28, 2021 at 7:37
  • 1
    $\begingroup$ You can also hit the edit button on the post in question and copy to clipboard on your computer the relevant part (e.g. Ctrl+C on Windows). This is actually explained in the answer that Martin Sleziak gave to the linked question. $\endgroup$ Commented Mar 4, 2021 at 4:39
  • $\begingroup$ On a Mac, control and click to show the MathJax formula. $\endgroup$
    – Toby Mak
    Commented Mar 13, 2021 at 4:04

2 Answers 2

9
$\begingroup$

For posts or comments on MathSE:

Right click on the formula and select Show Math As > TeX Commands

For external sites that use MathJax:

Try the same trick as above.

Otherwise use right click on the formula and select View Page source/ Inspect Element and copy from there.

For other external sites:

Unfortunately, websites like Wikipedia or Woltram mathworld embed formulae as images. However, we can use the methods suggested by Martin Sleziak and PedroSánchezTerraf in the comments:

Right click on the image and select View Source or Inspect Element. The math code can be seen in the alt text for the image, as shown in the screenshot.Finding the formula on Wikipedia

You can also find it by clicking Edit for the article or section.

Where this does not work, one can use Mathpix to obtain the Tex commands from an OCR file.

The last resort, as always, is to look for the elsewhere or type it yourself!

$\endgroup$
5
  • 3
    $\begingroup$ Hmmm.... from Wikipedia you can often copy the source of math formula, if it is embedded in <math>...</,math>. For example, if I go to the article Leibniz formula for determinants and click on edit, I can see: this: :<math>\det(A)=\epsilon_{i_1\cdots i_n}{a}_{1i_1}\cdots {a}_{ni_n},</math> in the Wikipedia source code. In I can see the same in the HTML source code, but it is more difficult to find there. (I think it is also used as the alt-text for the image.) $\endgroup$ Commented Mar 8, 2021 at 20:01
  • 1
    $\begingroup$ I have been using Mathpix to OCR images, it works pretty well with LaTeX (re: “For other external sites”) $\endgroup$ Commented Mar 9, 2021 at 2:04
  • 1
    $\begingroup$ Thanks! These seem to be very useful methods and are new to me! @MartinSleziak $\endgroup$
    – user0
    Commented Mar 9, 2021 at 3:50
  • $\begingroup$ @PedroSánchezTerraf $\endgroup$
    – user0
    Commented Mar 9, 2021 at 3:50
  • 2
    $\begingroup$ Since Mathpix was mentioned, I'll add links to some older posts: Mathpix Snip Tool: Automatic $\rm\LaTeX$ code generation from typed or handwritten math! and What tools can be used to extract MathJax/LaTeX from scanned input? $\endgroup$ Commented Mar 9, 2021 at 5:47
7
$\begingroup$

As a coda to the existing answer/comments, let me mention a useful last resort. If there's a tex symbol you don't know, and the site you're looking at doesn't reveal its code in a useful way (or you're reading a physical text!), you can always try the site detexify. Of course this is limited, since latex doesn't exactly line up with mathjax, but it's still very useful to know about.

$\endgroup$

Not the answer you're looking for? Browse other questions tagged .