TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use LaTeX to type up my homework, but as I work I often need to pop things into Mathematica (or manually type them in, or manually use my TI-89, etc.).

Currently, I've been manually translating things like \frac{a}{b} into (a/b) for Mathematica's consumption... is there a tool out there which does this automagically?

share|improve this question
I'm also interested in whether proposed solutions work for Wolfram Alpha. – Rebekah Sep 21 '10 at 22:00
Is there a similar capability for Maple? All I can find in the documentation is the reverse - LateX export. – rogerl Nov 5 '10 at 13:20
@rogerl: That deserves a separate question, I think. – Billy ONeal Nov 5 '10 at 14:32
up vote 29 down vote accepted

Mathematica can do this itself: ToExpression["\\frac{a}{b}", TeXForm].

The mathematica frontend will automatically perform the necessary doubling of the backslashes so long as you are pasting into a string (ie, put the cursor between quotes "" before pasting)

You didn't ask, but you can also go the other way mathematica->Tex: TeXForm[a/b] gives \frac{a}{b}.

You can also use a mixture of TeX and mathematica in a file document.mtex and use the mathematica Splice["document.mtex"] command to replace <*, *> delimited mathematica input by TeXForm mathematica output. Eg:

The derivative of $x^x$ is $<*D[x^x,x]*>$.

Splices to:

The derivative of $x^x$ is $x^x (\log (x)+1)$.
share|improve this answer
Too bad it doesn't work with intergals. Thanks +1 and checkmark. – Billy ONeal Sep 23 '10 at 15:58
It does work with integrals; try 'ToExpression["\\int \\sin(\\sin(x)) \\, dx", TeXForm]' – alfC Oct 6 '11 at 7:34

Your Answer


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.