# How can preserve my manual edit of an expression when exporting to LaTeX?

Context

I would like to use the Mathematica front end to pre-process expressions before exporting them to LateX, for the sake of readability.

Example

Say I have this expression

   (16*((-3 + r^2)*BesselI[0, r^2/8]^2 - ((-48 + 16*r^2 + r^4)*BesselI[0, r^2/8]*
BesselI[1, r^2/8])/r^2 +
15*BesselI[1, r^2/8]^2)*Cos[2*\[Theta]])/(3*Sqrt[3]*E^(r^2/4))


which looks like this in Mathematica

Once I edit it by hand within Mathematica, it might look like this: (notice that its more publishable in that form)

(This is a great feature of the Front-End by the way!).

If I then select the expression and choose the export to latex menu, Mathematica exports the original (unedited) equation.

Question

How do I tell Mathematica to mind its own business and export to LaTeX the result of my edit, not its re-processing of it?

EDIT

Following the suggestion of @Nasser, I tried

So it does not really preserve the original expression?

• Try applying HoldForm[expr] when exporting. You might have to use HoldForm in more than one subpart of the expression if you want complete control. Hard to test it since your final expression is not posted in M code. May 29, 2014 at 23:55
• The expression you give as an example in markdown is not equivalent to the expression you show in the imbedded images. May 30, 2014 at 0:21
• @m_goldberg oops sorry. May 30, 2014 at 2:39
• @Nasser thanks. It does partially do the job, see my edit? May 30, 2014 at 2:44

For the notebook interface, you can use HoldForm[] like this

expr2 = HoldForm[16 E^(-(r^2/4)) cos (2 \[Theta]) /(3 Sqrt[3])];
expr3 = HoldForm[((r^2 - 3) BesselI[0,r^2/8]^2 + 15 BesselI[1,r^2/8]^2 -
((r^4 + 16 r^2 - 48) BesselI[1,r^2/8] BesselI[0,r^2/8])/r^2)];


which gives

Which is what you wanted. Now, for Latex export

TeXForm[expr2 expr3]


which gives the tex expression. I copied this to my texlive box and run latex on it:

\documentclass[12pt,notitlepage]{article}%
\begin{document}
$\left(\left(r^2-3\right) I_0\left(\frac{r^2}{8}\right){}^2+15 I_1 \left(\frac{r^2}{8}\right){}^2-\frac{\left(r^4+16 r^2-48\right) I_1\left(\frac{r^2}{8}\right) I_0\left(\frac{r^2}{8}\right)} {r^2}\right) \frac{16 e^{-\frac{r^2}{4}} \cos (2 \theta )}{3 \sqrt{3}}$
\end{document}


and here is the pdf file result

• Thanks again: inspired by your answer, it seems Map[HoldForm, exp]//TeXForm does more or less the trick. May 30, 2014 at 3:39