Recreational Challenge: Best looking output for Rubi integration steps

As some of you might know, I'm working with Albert Rich to improve the accessibility of his Rubi package for rule-based integration. I'm almost done with a first version that contains several improvements, but for the current task, I'd like to ask for input from the community.

One major strength of Rubi is that it can provide all steps and intermediate results of an integration. This, however, was a bit broken since the intermediate output was not overwritten when you evaluate an integration again. I reworked this completely and now the big question is how to format rules and intermediate results in the most stunning way.

A "step" can either be a RubiRule or a RubiIntermediateResult and I get them as

RubiRule[conditionString,
HoldComplete[leftHandSide],
HoldComplete[rightHandSide],
ruleNumber]

RubiIntermediateResult[HoldComplete[expression]]


The conditionString and the ruleNumber is not always there, but often we have this information.

Question: Who can come up with the most stunning display of these two types of expressions? Go crazy with Style, Panel, Grid, etc. but in the end, we need a nice looking output for both types.

I have prepared a small notebook that contains an example list of steps in the last portion of the Reap result. This notebook is not meant to be evaluated since you obviously don't have my development version of Rubi.m, but you can use the output that I provided to implement and test pretty-printing for RubiRule and RubiIntermediateResult.

Import["http://halirutan.github.io/Mathematica-SE-Tools/decode.m"]["http://i.stack.imgur.com/K0wqL.png"]


At the moment, it looks like this in Rubi

• Looks like Rubi.m file is missing. Jun 13, 2018 at 9:28
• Is it possible to get the conditions as expressions, rather than strings? Jun 13, 2018 at 9:29
• @AnjanKumar Yes, it is missing because this version currently only available on my machine. I wanted to give people a complete list of Rubi steps which you can just copy from the output that is also in the notebook. I'm making this clear again in the question. Jun 13, 2018 at 9:31
• @LukasLang At the moment not. The code which creates this string is from Albert and didn't want to throw everything overboard. So I re-used his complete code of extracting conditions, rules, and results and simply changed the code so that these expressions are not printed but returned. The condition string contains "If" and "let" which is created in deeply nested code that inspects the DownValues of the definitions for Rubi's Int function. I didn't dare to touch this for now. Jun 13, 2018 at 9:35
• @halirutan Ok, fair enough Jun 13, 2018 at 9:37

To give you an idea of what I had in mind, I created something that I don't hate completely. Working with Grid, Column is a pain when you want to align and size everything to your needs, but it does the job.

Intermediate results can be copied by clicking on them. Here is the code that was used as a basis for the above (I changed some small things later). The final list was wrapped in Column and I riffled some down-arrows in between.

Format[RubiIntermediateResult[HoldComplete[expr_]]] :=
Tooltip[
Button[
Deploy@Panel[Row[
{Style["Intermediate Result:", "Label", Gray],
Style[HoldForm[expr], ColorData[99, 2]]
}, Spacer[10]],
FrameMargins -> 5
], CopyToClipboard[Defer[expr]], Appearance -> None],
"Click to copy as input"
]

Format[RubiRule[cond_, HoldComplete[lhs_], HoldComplete[rhs_],
rule_: "General"]] :=
Deploy@Panel[
Grid[{
{
Style["Rubi Rule:", "Label", Gray],
Style[rule, "Label"]},
{
Style["Condition:", "Label", Gray],
Style[If[cond === "", "None", cond], ColorData[99, 3]]
},
{
Style["Transformation:", "Label", Gray],
Row[{
Style["\[DoubleLongRightArrow]", 14, ColorData[99, 1]],
}, Spacer[10], Alignment -> Center
]
}
},
Alignment -> {{Right, Left}, {Center, Center, Center}},
Spacings -> {1, 1},
Dividers -> {False, {2 -> LightGray, 3 -> LightGray}}
]
]


Update

Although no one posted a solution, I got feedback and was able to partially include it. I discussed things with Albert and we decided to a simple left/right scheme. I took the suggestion from Kuba to make the rules closable and show only the transformation rule initially. With the help of the answers here, I was able to make the layout render in the same font size as the rest! Thank you for that.

If you like, you can try it out yourself. People with Mathematica version 11.3 can install Rubi directly from GitHub

PacletInstall[
$LoadShowSteps = True; << Rubi Steps@Int[((125 - x^3)^(1/3))^2, x]  The suggestion of @b3m2a1 went into the display of the integration statistics which uses a BoxFormArrangeSummeryBox Unlike the official implements of RubiSteps, usually we care about the result only instead of rules, as we don't write rules for hand-writing formulae. So I wrote a new RubiStepsShowIntSteps, which supports more for hand-writing formula generation. The code is a bit long so I provide it at github. BUG issues are welcomed. Implementation Details RubiStepsShowIntSteps does not use the output from RubiSteps, but is implemented as a new function. RubiSteps sets RubiPrivate$ShowSteps = True and then use FixedPoint to evaluate step by step and Sow held results.
RubiStepsShowIntSteps uses two nested FixedPoints. The inner one evaluate and Sow everything except RubiSubst which stands for substituting operation. When the inner one find no replacing can be performed, the outer FixedPoint function is applied for doing substitutions.
Then ShowIntSteps uses a Reap to collect results. Note that substitutions in these results are not performed, so this information can be used for typesetting.
I've noticed the usage of Defer and HoldComplete in Steps is just Inactive and HoldForm`. The latter may be more canonical.