# Mathematica Function Definition to Latex?

Suppose I have a function defined:

g[z_]:=Sum[Sin[z/k!],{k,0,infinity}]


And I want to export the following Latex based on only the function definition

$$\sum_{k=0}^\infty \sin\left(\frac{z}{k!}\right)$$

Is it possible to do this in Mathematica? If so, how? Ideally it would work for any arbitrary function, or at least as often as possible.

You can use

g[z_] := Sum[Sin[z/k!], {k, 0, Infinity}]
g[z] // TeXForm


output is

\sum _{k=0}^{\infty } \sin \left(\frac{z}{k!}\right).


However $$g(z)$$ will be simplified, for example g[z_] := z+z will yield $$2z$$. If you want to avoid that just use g[z_] := Holdform[z+z].

The simplest way to do it select the equation and copy it as latex. It can be pasted in the latex editor as an equation. A picture is attached for references

• This helps, but I need this process automated since I'll be doing it for several hundred equations. – jippyjoe4 Apr 8 at 22:11
• You can also use TeXForm[] command available in Mathematica to get the Latex code of the equation. – Mohit Singh Apr 10 at 11:48