# Prettying up this equation from Mathematica

I like to type in 2d maths into Mathematica and then generate latex code for it. It has been working fine so far until I attempted this expression:

TeXForm[HoldForm[
S (k*L) = (4*l + 1)/
2 (Integrate[
LegendreP[2*l, x]*SphericalBesselJ[0, 1/2*kl*x], {x, -1, 1}])^2/
Integrate[SphericalBesselJ[0, 1/2*kl*x]^2, {x, -1, 1}]]]

The output latex is

S (k L)=\frac{(4 l+1) \left(\int_{-1}^1 P_{2 l}(x) j_0\left(\frac{\text{kl} x}{2}\right) \,
dx\right){}^2}{2 \int_{-1}^1 j_0\left(\frac{\text{kl} x}{2}\right){}^2 \, dx}

Which looks like this when compiled.

As you can see there are many style errors (in my opinon). The Integral signs are too small with limits too big, the brackets look weird. The ^2 does not seem in the right place. The problem is if I were to type this out by hand, I come to pretty much the same code as mathematica.

Any help on making this equation beautiful is greatly appreciated.

Thanks

-

Here's a solution that uses the directive \displaystyle in both the numerator and the denominator of the fraction. (The align structure is used purely to simplify the before/after comparison.)

\documentclass{article}
\usepackage{amsmath} % for \DeclareMathOperator macro
\DeclareMathOperator{\kl}{kl}   % what does "kl" stand for?
\DeclareMathOperator{\dee}{d\!} % "differential operator"
\begin{document}

\begin{align*}
S (k L)=\frac{(4 l+1) \left(\int_{-1}^1 P_{2 l}(x) j_0\left(\frac{\text{kl} x}{2}\right) \,
dx\right){}^2}{2 \int_{-1}^1 j_0\left(\frac{\text{kl} x}{2}\right){}^2 \, dx}\\
S (k L)=\frac{\displaystyle (4 l+1) \biggl(\int_{-1}^1 P_{2 l}(x) j_0\left(\tfrac{1}{2}\kl x\right) \dee x\biggr)^2 }{\displaystyle 2 \int_{-1}^1 j_0\left(\tfrac{1}{2}\kl x\right)^2 \dee x}
\end{align*}
\end{document}
-
That is very pleasing to mine eyes. Thanks! –  Steve Hatcher Mar 24 '14 at 7:44

You didn't provide which packages are loaded. I assume minimal and have to change \text with \mathrm.

You can find more information by searching here for large integral sign, such as in Big integral sign

If you take out the {} before the exponents they'll be placed higher. I also assume you're looking for display math.

\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{,bigints}
\begin{document}
$S (k L)=\frac{(4 l+1) \left(\bigintsss_{-1}^1 P_{2 l}(x) j_0\left(\frac{\mathrm{kl} x}{2}\right) \, dx\right)^2}{2 \bigintsss_{-1}^1 j_0\left(\frac{\mathrm{kl} x}{2}\right)^2 \, dx}$
\end{document}
-
Please see the posting Why is $...$ preferable to $$...$$? for reasons for not using  in LaTeX documents. –  Mico Mar 24 '14 at 6:33
Hi, this did improve it a bit, but Mico's code made it phenomenally better. Thanks for your time though. –  Steve Hatcher Mar 24 '14 at 8:13