Tell me more ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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:

$\frac{1}{2}$
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 8.0.1.0.

share|improve this question
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? – Andy Ross Feb 22 '12 at 3:34
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. – user001 Feb 22 '12 at 3:38
2  
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? – Andy Ross Feb 22 '12 at 4:20
1  
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. – user001 Feb 22 '12 at 4:49
@Andy please add that valuable information to your answer. – Mr.Wizard Feb 22 '12 at 12:33
show 1 more comment

2 Answers

up vote 14 down vote accepted

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.

EDIT:

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.

share|improve this answer
Excellent, that works. Thank you very much. I suppose I can try rebooting and see if Mathematica starts issuing prompts. – user001 Feb 22 '12 at 3:47

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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