20

I often want to copy formulas from Mathematica into a LaTeX document. Mathematica has a “copy as LaTeX” function, but it gives me not really the results that I want:

\text{Cos}[x]+\text{Sin}[x]

I rather would like to have the following:

\cos(x)+\sin(x)

I tried to use regular expressions in Python, which kind of work, but I cannot match matching brackets or parenteses. That would be very handy, since there could be anything in the cosine.

What would be a doable way to convert this?

1

1 Answer 1

24

Use TeXForm[].

In[1] := TeXForm[Cos[x] + Sin[x]]

Out[1]//TeXForm=
         \sin (x)+\cos (x)
1
  • Okay, that solves the problem directly :-) Commented Jun 24, 2012 at 12:24

You must log in to answer this question.

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