I am creating objects in Mathematica, which I’d like to compactly display in the front end notebook as a SummaryBox
. However, in many cases, the items that I wish to display are lengthy, and I’d like to simply limit the display width of the SummaryBox
.
Here’s how I define how MyObject
formats:
ClearAll[MyObject]; MyObject /: MakeBoxes[obj:MyObject[asc_], form : (StandardForm|TraditionalForm)] := Module[{above}, above = {{BoxForm`SummaryItem[{"Name: ", asc["Name"]}]}, {BoxForm`SummaryItem[{"Expression: ", asc["Expression"]}]}}; BoxForm`ArrangeSummaryBox[MyObject, obj, None, above, {}, form, "Interpretable" -> Automatic] ];
Then
MyObject[<|"Name" -> "My particular object", "Expression" -> 8 a^3 b + 8 a b^3 + 8 a^3 c + 24 a b^2 c + 24 a b c^2 + 8 a c^3 + 24 a^2 b d + 8 b^3 d + 24 a^2 c d + 24 b^2 c d + 24 b c^2 d + 8 c^3 d + 24 a b d^2 + 24 a c d^2 + 8 b d^3 + 8 c d^3|>]`
renders as:
which is much too wide! How do I limit the width of a SummaryBox
so that lengthy values just take multiple lines like this?
Any ideas?