# How to directly get the TeXForm of each steps from Rubi?

It's easy to read the steps from Rubi, but kind of tired to copy it out of as $$\LaTeX$$. That's what now I do:

Int[x Sin[x], x]//Steps


For example,click one step, then paste it to .nb, then //TeXForm to get the TeX code. (kind of monkey job)

I've tried FullForm, get nothing, // Trace gives back a lot of things, which seems a bit hard for me to pick out what I want. So I want a "automatical" way to do this.

• Hi. I found small problem trying to add your function to my report. Since all integrals I use come from lists, and you have SetAttributes[IntWithStepsOfTeXForm, {HoldFirst}]; then when I pass the integral to your function, it does not work. Here is an example. lst = {{Log[1 + x], x}}; result = IntWithStepsOfTeXForm[ Int[lst[[1, 1]], lst[[1, 2]]] ] ; And now the result does not work. Screen shot !Mathematica graphics Commented May 9, 2020 at 23:46
• fyi, I posted separate question on this here mathematica.stackexchange.com/questions/221547/… I could not find solution myself. Commented May 10, 2020 at 1:41
• @Nasser IntWithStepsOfTeXForm[Int[#, x]] & /@ {Sin[x], Cos[x]/x^2, Sin[x]/x^2} // MaTeX can work. Commented May 10, 2020 at 4:05

A better version is here:

https://mathematica.stackexchange.com/a/221559/68689

I found this option:

RubiPrintInformation -> False


And then write this:

SetAttributes[IntWithStepsOfTeXForm, {HoldFirst}];
IntWithStepsOfTeXForm[j_] :=
With[{TeX2Str = ConvertTeXExpressionToTeX},
Steps[j, RubiPrintInformation -> False] //
Flatten //
Most //
# /. RubiIntermediateResult[x_] -> x & //
(*ToString@*TeXForm is OK*)
Map["=&" <> (TeX2Str[HoldForm @@ #]) <> "\\\\" &] //
# /. {a___} -> {
"\\begin{aligned}",
TeX2Str@HoldForm@j,
a,
"\\end{aligned}"} & // StringRiffle
]


This function returns a string.

Usage:

Or use Print and then copy the result to clipboard for following use.