Hello I have a For
loop which outputs an expression and I want to convert everything to $\LaTeX$ at once (not line by line). This is my code:
K[Q_, n_Integer] :=
Module[{z, x},
SymmetricReduction[
SeriesCoefficient[
Product[ComposeSeries[Series[Q[z], {z, 0, n}],
Series[x[i] z, {z, 0, n}]], {i, 1, n}], n],
Table[x[i], {i, 1, n}], Table[Subscript[c, i], {i, 1, n}]][[1]] //
FactorTerms]
poly = K[Sqrt[#]/Tanh[Sqrt[#]] &, 4] /. c -> p;
primeFactorForm[n_] :=
If[Length@# == 1, First@#, CenterDot @@ #] &[
Superscript @@@ FactorInteger[n]];
For[i = 0, i < 5, i++,
poly = K[Sqrt[#]/Tanh[Sqrt[#]] &, i] /. c -> p;
Print[Subscript[L, i], " = ",
Plus @@ List @@ Distribute[poly] /.
Times[Rational[n_, d_], e__] :>
primeFactorForm[n]/ primeFactorForm[d]*e]]
I am not sure how to convert all the 10 lines to $\LaTeX$. I tried some basic functions (TeXForm
for example) but I get \text{Null}
. Can someone help me with this? Thank you!
Table
instead ofFor
andPrint
... $\endgroup$\text{Null}
fromTexForm
because you are still usingFor
along withPrint
instead ofTable
.Print
andFor
are not meant for returning results;Table
is. $\endgroup$