I have read that $\LaTeX$ source can be directly pasted into a Mathematica notebook. However, I have been unsuccessful in this regard. An example of the errors received are:

Syntax::sntxb: Expression cannot begin with "$ frac{1}{2}$".
Syntax::tsntxi: "$ frac" is incomplete; more input is needed.
Syntax::sntxi: Incomplete expression; more input is needed .

This is not remediated by removal of the $ signs, placement of two $ signs ($$), or use of other $\LaTeX$ math mode delimiters (e.g., \[ \], \begin{displaymath}\end{displaymath}, \begin{equation}\end{equation}, etc). I do not wish to import an entire .tex file as I merely want to pass a few select equations. Please advise as to my error. Thank you.

Edit: I am using Mathematica

  • $\begingroup$ Are you prompted whether you want to paste literal text or the corresponding typeset expression when you try to paste? Also, what version of Mathematica are you using? $\endgroup$
    – Andy Ross
    Feb 22, 2012 at 3:34
  • $\begingroup$ I am using Mathematica version 8 (see edited post). I receive no prompts when I paste -- the $TeX$ markup is simply pasted directly into a cell in the notebook. Thank you. $\endgroup$
    – user001
    Feb 22, 2012 at 3:38
  • 2
    $\begingroup$ I just learned that the prompt is controlled via GlobalOptions > MessageOptions > TeXPasteWarning in the Options Inspector which can be found under Edit > Preferences > Advanced. Yours may be set to False? $\endgroup$
    – Andy Ross
    Feb 22, 2012 at 4:20
  • 1
    $\begingroup$ Thanks for looking into that and letting me know. Despite empirical evidence to the contrary, the TexPasteWarning parameter was set to True. Rebooting Mathematica did not enable prompting either. $\endgroup$
    – user001
    Feb 22, 2012 at 4:49
  • $\begingroup$ @Andy please add that valuable information to your answer. $\endgroup$
    – Mr.Wizard
    Feb 22, 2012 at 12:33

3 Answers 3


I'm prompted by Mathematica when pasting (using 8.0.4) so I don't have this issue. The following seems to do the trick though..

ToExpression["\\frac{1}{2}", TeXForm]

I would expect others might have more illuminating responses to this.


The prompt I referred to is controlled via GlobalOptions > MessageOptions > TeXPasteWarning in the Options Inspector which can be found under Edit > Preferences > Advanced. If this is set to False you won't get prompted as to how you would like to paste the input.

  • $\begingroup$ Excellent, that works. Thank you very much. I suppose I can try rebooting and see if Mathematica starts issuing prompts. $\endgroup$
    – user001
    Feb 22, 2012 at 3:47
  • $\begingroup$ The strings must contain double backslashes, which can be problematic when copying from sources. I have not found a convenient, automatic way to double the backslashes once inside MMA, because MMA interprets single backslashes as escaping the following character. In "\frac{1}{2}", the "\f" is interpreted as a line feed. I suppose StringReplace could be brought to bear, but it would take considerable work to make a robust backslash-doubling transform. $\endgroup$
    – Reb.Cabin
    Mar 16, 2014 at 19:11
  • $\begingroup$ I'm running version 12, and TeXPasteWarning is true, but it still doesn't work for me, even if I go in and double the backslashes manually before copy/pasting $\endgroup$
    – Michael
    Jun 18, 2023 at 0:10

I find pasting $\frac{1}{2}$ works but pasting \frac{1}{2} does not. So the dollar signs seems necessary, although I realize that doesn't fix your problem it may be a useful hint to other users.


Let's assume I have the following $\LaTeX$ expression that I want to include in a Mathematica notebook

$\frac{d P(r)}{d r}=-\frac{G M \rho}{r^2}$

If I copy the expression, including the $...$ (which are essential for Mathematica to recognize $\LaTeX$) and paste it in a Mathematica notebook, the following dialog box appears

enter image description here

And after clicking the button "yes", the following expression appears in the notebook (using Mathematica 12.1), as described in the documentation

enter image description here

The related issue of converting $\LaTeX$ into Mathematica input form is discussed in this answer.

EDIT for Mathematica 12.2

Mathematica 12.2 in December 2020 introduced a new menu "Inline TeX Input" to write $\TeX$ or $\LaTeX$ input directly. Selecting the option from the Insert menu (or typing Ctrl+4)

enter image description here

Produces the following box, where one can type $\LaTeX$ directly

enter image description here

Clicking away from the box converts the $\LaTeX$ into Mathematica input

enter image description here

  • $\begingroup$ Hi divenex i do not what version of Mathematica you use but i just download a version trial 12.2.0 (the wesite of Mathematica is horrrible it is totally a mess) and I try paste formulas from MAthpix into latex for use as standar form and it is not work properly .I do not understood how mathematica do not check properly a program before to sell it , and whats mean clicling away??? $\endgroup$
    – capea
    Dec 31, 2020 at 16:02
  • $\begingroup$ @capea it seems your problem may be with mathpix & learning to use Mathematica in itself. “Clicking away” means exactly that, clicking out of the input field that is parses the latex input. At any rate, this is a new feature, and such issues may be expected with something just added to a program with such widely varied functionality. $\endgroup$ Jan 1, 2021 at 19:29
  • $\begingroup$ Thanks CA trevillan , if you see the questions of other users you realize that the problem is not the user's I try only to help , anyway MAthematica it is a great progam $\endgroup$
    – capea
    Jan 1, 2021 at 20:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.